[vlc-commits] d3d11_quad: make cropViewport a table

Steve Lhomme git at videolan.org
Mon May 28 13:25:43 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jan  9 18:08:26 2018 +0100| [7ce2b5f778c111b98b8308368971c1bd693fd94f] | committer: Steve Lhomme

d3d11_quad: make cropViewport a table

Since the viewport must be different for each NV12 target views

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

 modules/video_output/win32/d3d11_quad.c | 17 ++++++++++-------
 modules/video_output/win32/d3d11_quad.h |  2 +-
 modules/video_output/win32/direct3d11.c |  4 +++-
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/modules/video_output/win32/d3d11_quad.c b/modules/video_output/win32/d3d11_quad.c
index cc986e650a..9d81cb28b9 100644
--- a/modules/video_output/win32/d3d11_quad.c
+++ b/modules/video_output/win32/d3d11_quad.c
@@ -68,7 +68,7 @@ void D3D11_RenderQuad(d3d11_device_t *d3d_dev, d3d_quad_t *quad,
     assert(quad->resourceCount <= D3D11_MAX_SHADER_VIEW);
     ID3D11DeviceContext_PSSetShaderResources(d3d_dev->d3dcontext, 0, quad->resourceCount, resourceView);
 
-    ID3D11DeviceContext_RSSetViewports(d3d_dev->d3dcontext, 1, &quad->cropViewport);
+    ID3D11DeviceContext_RSSetViewports(d3d_dev->d3dcontext, 1, &quad->cropViewport[0]);
 
     ID3D11DeviceContext_DrawIndexed(d3d_dev->d3dcontext, quad->indexCount, 0, 0);
 }
@@ -779,8 +779,11 @@ int D3D11_SetupQuad(vlc_object_t *o, d3d11_device_t *d3d_dev, const video_format
     if (!D3D11_UpdateQuadPosition(o, d3d_dev, quad, output, orientation))
         goto error;
 
-    quad->cropViewport.MinDepth = 0.0f;
-    quad->cropViewport.MaxDepth = 1.0f;
+    for (size_t i=0; i<D3D11_MAX_SHADER_VIEW; i++)
+    {
+        quad->cropViewport[i].MinDepth = 0.0f;
+        quad->cropViewport[i].MaxDepth = 1.0f;
+    }
     quad->d3dvertexShader = d3dvertexShader;
     quad->pVertexLayout   = pVertexLayout;
     quad->resourceCount = DxgiResourceCount(quad->formatInfo);
@@ -794,8 +797,8 @@ error:
 
 void D3D11_UpdateViewport(d3d_quad_t *quad, const RECT *rect)
 {
-    quad->cropViewport.TopLeftX = rect->left;
-    quad->cropViewport.TopLeftY = rect->top;
-    quad->cropViewport.Width    = rect->right  - rect->left;
-    quad->cropViewport.Height   = rect->bottom - rect->top;
+    quad->cropViewport[0].TopLeftX = rect->left;
+    quad->cropViewport[0].TopLeftY = rect->top;
+    quad->cropViewport[0].Width    = rect->right  - rect->left;
+    quad->cropViewport[0].Height   = rect->bottom - rect->top;
 }
diff --git a/modules/video_output/win32/d3d11_quad.h b/modules/video_output/win32/d3d11_quad.h
index db917f1ec2..34b49d37f5 100644
--- a/modules/video_output/win32/d3d11_quad.h
+++ b/modules/video_output/win32/d3d11_quad.h
@@ -45,7 +45,7 @@ typedef struct
     UINT                       PSConstantsCount;
     ID3D11PixelShader         *d3dpixelShader;
     ID3D11InputLayout         *pVertexLayout;
-    D3D11_VIEWPORT            cropViewport;
+    D3D11_VIEWPORT            cropViewport[D3D11_MAX_SHADER_VIEW];
     unsigned int              i_width;
     unsigned int              i_height;
     video_projection_mode_t   projection;
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 2df89b58ea..f378655032 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1396,7 +1396,9 @@ static void UpdatePicQuadPosition(vout_display_t *vd)
     SetQuadVSProjection(vd, &sys->picQuad, &vd->cfg->viewpoint);
 
 #ifndef NDEBUG
-    msg_Dbg(vd, "picQuad position (%.02f,%.02f) %.02fx%.02f", sys->picQuad.cropViewport.TopLeftX, sys->picQuad.cropViewport.TopLeftY, sys->picQuad.cropViewport.Width, sys->picQuad.cropViewport.Height );
+    msg_Dbg( vd, "picQuad position (%.02f,%.02f) %.02fx%.02f",
+             sys->picQuad.cropViewport[0].TopLeftX, sys->picQuad.cropViewport[0].TopLeftY,
+             sys->picQuad.cropViewport[0].Width, sys->picQuad.cropViewport[0].Height );
 #endif
 }
 



More information about the vlc-commits mailing list