[vlc-devel] [PATCH v3 7/8] d3d11: use vlc_viewpoint_to_4x4 to generate view matrix

Alexandre Janniaux ajanni at videolabs.io
Fri Mar 8 10:35:44 CET 2019


---
 modules/video_output/win32/d3d11_shaders.c | 1 +
 modules/video_output/win32/d3d11_shaders.h | 1 +
 modules/video_output/win32/direct3d11.c    | 4 ++++
 3 files changed, 6 insertions(+)

diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index fb621d2d39..a591e43854 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -169,6 +169,7 @@ cbuffer VS_PROJECTION_CONST : register(b0)\n\
    float4x4 RotX;\n\
    float4x4 RotY;\n\
    float4x4 RotZ;\n\
+   float4x4 View;\n\
    float4x4 Zoom;\n\
    float4x4 Projection;\n\
 };\n\
diff --git a/modules/video_output/win32/d3d11_shaders.h b/modules/video_output/win32/d3d11_shaders.h
index 3a84b99746..c7582972ce 100644
--- a/modules/video_output/win32/d3d11_shaders.h
+++ b/modules/video_output/win32/d3d11_shaders.h
@@ -69,6 +69,7 @@ typedef struct {
     FLOAT RotX[4*4];
     FLOAT RotY[4*4];
     FLOAT RotZ[4*4];
+    FLOAT View[4*4];
     FLOAT Zoom[4*4];
     FLOAT Projection[4*4];
 } VS_PROJECTION_CONST;
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index c84e4e85d6..53f10a74dc 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -803,6 +803,10 @@ static void SetQuadVSProjection(vout_display_t *vd, d3d_quad_t *quad, const vlc_
         getZRotMatrix(f_roll,  dst_data->RotZ);
         getZoomMatrix(SPHERE_RADIUS * f_z, dst_data->Zoom);
         getProjectionMatrix(f_sar, f_fovy, dst_data->Projection);
+
+        vlc_viewpoint_t vp;
+        vlc_viewpoint_reverse(&vp, p_vp);
+        vlc_viewpoint_to_4x4(&vp, dst_data->View);
     }
     ID3D11DeviceContext_Unmap(sys->d3d_dev.d3dcontext, (ID3D11Resource *)quad->pVertexShaderConstants, 0);
 #undef RAD
-- 
2.21.0



More information about the vlc-devel mailing list