[vlc-commits] d3d11: pass the render target(s) to D3D11_RenderQuad()
Steve Lhomme
git at videolan.org
Mon May 28 13:25:44 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jan 9 18:14:26 2018 +0100| [59d68dc0de1d66e1a3d69094d9c1b9bf88207bbb] | committer: Steve Lhomme
d3d11: pass the render target(s) to D3D11_RenderQuad()
To render to NV12 we need to render to 2 different targets (Y and UV)
Do ID3D11DeviceContext_OMSetRenderTargets() just before DrawIndex().
We don't actually need a deptch stencil.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=59d68dc0de1d66e1a3d69094d9c1b9bf88207bbb
---
modules/video_output/win32/d3d11_quad.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/modules/video_output/win32/d3d11_quad.c b/modules/video_output/win32/d3d11_quad.c
index 9d81cb28b9..b4490d5d6a 100644
--- a/modules/video_output/win32/d3d11_quad.c
+++ b/modules/video_output/win32/d3d11_quad.c
@@ -47,8 +47,6 @@ void D3D11_RenderQuad(d3d11_device_t *d3d_dev, d3d_quad_t *quad,
{
UINT offset = 0;
- ID3D11DeviceContext_OMSetRenderTargets(d3d_dev->d3dcontext, 1, &d3drenderTargetView[0], NULL);
-
/* Render the quad */
ID3D11DeviceContext_IASetPrimitiveTopology(d3d_dev->d3dcontext, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
@@ -62,15 +60,22 @@ void D3D11_RenderQuad(d3d11_device_t *d3d_dev, d3d_quad_t *quad,
ID3D11DeviceContext_VSSetShader(d3d_dev->d3dcontext, quad->d3dvertexShader, NULL, 0);
/* pixel shader */
- ID3D11DeviceContext_PSSetShader(d3d_dev->d3dcontext, quad->d3dpixelShader, NULL, 0);
-
ID3D11DeviceContext_PSSetConstantBuffers(d3d_dev->d3dcontext, 0, quad->PSConstantsCount, quad->pPixelShaderConstants);
assert(quad->resourceCount <= D3D11_MAX_SHADER_VIEW);
ID3D11DeviceContext_PSSetShaderResources(d3d_dev->d3dcontext, 0, quad->resourceCount, resourceView);
- ID3D11DeviceContext_RSSetViewports(d3d_dev->d3dcontext, 1, &quad->cropViewport[0]);
+ ID3D11DeviceContext_PSSetShader(d3d_dev->d3dcontext, quad->d3dpixelShader, NULL, 0);
+ for (size_t i=0; i<D3D11_MAX_SHADER_VIEW; i++)
+ {
+ if (!d3drenderTargetView[i])
+ break;
+
+ ID3D11DeviceContext_RSSetViewports(d3d_dev->d3dcontext, 1, &quad->cropViewport[i]);
- ID3D11DeviceContext_DrawIndexed(d3d_dev->d3dcontext, quad->indexCount, 0, 0);
+ ID3D11DeviceContext_OMSetRenderTargets(d3d_dev->d3dcontext, 1, &d3drenderTargetView[i], NULL);
+
+ ID3D11DeviceContext_DrawIndexed(d3d_dev->d3dcontext, quad->indexCount, 0, 0);
+ }
}
static bool AllocQuadVertices(vlc_object_t *o, d3d11_device_t *d3d_dev, d3d_quad_t *quad)
More information about the vlc-commits
mailing list