[vlc-commits] d3d11_quad: call PSSetShaderResources for each plane rendered

Steve Lhomme git at videolan.org
Fri Oct 23 13:02:29 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Oct 23 07:33:56 2020 +0200| [743522dbce8f82938e84e682ffeb9b3f2e5244a6] | committer: Steve Lhomme

d3d11_quad: call PSSetShaderResources for each plane rendered

Fixes some more issues of
"Resource being set to PS shader resource slot 0 is still bound on output"

Apparently we don't even need the trick to reset it anymore with this change.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=743522dbce8f82938e84e682ffeb9b3f2e5244a6
---

 modules/video_output/win32/d3d11_quad.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules/video_output/win32/d3d11_quad.c b/modules/video_output/win32/d3d11_quad.c
index 6fff189ed7..1e2b23be1a 100644
--- a/modules/video_output/win32/d3d11_quad.c
+++ b/modules/video_output/win32/d3d11_quad.c
@@ -66,7 +66,6 @@ void D3D11_RenderQuad(d3d11_device_t *d3d_dev, d3d_quad_t *quad, d3d_vshader_t *
     /* pixel shader */
     ID3D11DeviceContext_PSSetConstantBuffers(d3d_dev->d3dcontext, 0, ARRAY_SIZE(quad->pPixelShaderConstants), quad->pPixelShaderConstants);
     assert(quad->resourceCount <= D3D11_MAX_SHADER_VIEW);
-    ID3D11DeviceContext_PSSetShaderResources(d3d_dev->d3dcontext, 0, quad->resourceCount, resourceView);
 
     for (size_t i=0; i<D3D11_MAX_SHADER_VIEW; i++)
     {
@@ -76,17 +75,19 @@ void D3D11_RenderQuad(d3d11_device_t *d3d_dev, d3d_quad_t *quad, d3d_vshader_t *
         if (unlikely(!selectPlane(selectOpaque, i)))
             continue;
 
+        ID3D11DeviceContext_PSSetShaderResources(d3d_dev->d3dcontext, 0, quad->resourceCount, resourceView);
+
         ID3D11DeviceContext_PSSetShader(d3d_dev->d3dcontext, quad->d3dpixelShader[i], NULL, 0);
 
         ID3D11DeviceContext_RSSetViewports(d3d_dev->d3dcontext, 1, &quad->cropViewport[i]);
 
         ID3D11DeviceContext_DrawIndexed(d3d_dev->d3dcontext, quad->indexCount, 0, 0);
-    }
 
-    /* force unbinding the input texture, otherwise we get:
-     * OMSetRenderTargets: Resource being set to OM RenderTarget slot 0 is still bound on input! */
-    ID3D11ShaderResourceView *reset[D3D11_MAX_SHADER_VIEW] = { 0 };
-    ID3D11DeviceContext_PSSetShaderResources(d3d_dev->d3dcontext, 0, quad->resourceCount, reset);
+        // /* force unbinding the input texture, otherwise we get:
+        // * OMSetRenderTargets: Resource being set to OM RenderTarget slot 0 is still bound on input! */
+        // ID3D11ShaderResourceView *reset[D3D11_MAX_SHADER_VIEW] = { 0 };
+        // ID3D11DeviceContext_PSSetShaderResources(d3d_dev->d3dcontext, 0, quad->resourceCount, reset);
+    }
 }
 
 static bool AllocQuadVertices(vlc_object_t *o, d3d11_device_t *d3d_dev, d3d_quad_t *quad, video_projection_mode_t projection)



More information about the vlc-commits mailing list