[vlc-devel] [PATCH] direct3d11: fix the horizontally flipped texture

Steve Lhomme robux4 at videolabs.io
Tue Dec 6 11:33:42 CET 2016


Now the projection matrices correspond to the one from OpenGL and DirectXMath.

--
replaces https://patches.videolan.org/patch/15229/
- the mouse movements where inverted, now they are in line with OpenGL
---
 modules/video_output/win32/direct3d11.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 29702a1..88f3ebe 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -828,7 +828,7 @@ static void getProjectionMatrix(float sar, float fovy, FLOAT matrix[static 16])
     const FLOAT m[] = {
         f / sar, 0.f,                   0.f,                0.f,
         0.f,     f,                     0.f,                0.f,
-        0.f,     0.f,    -(zNear + zFar) / (zNear - zFar),  1.f,
+        0.f,     0.f,     (zNear + zFar) / (zNear - zFar), -1.f,
         0.f,     0.f, (2 * zNear * zFar) / (zNear - zFar),  0.f};
 
      memcpy(matrix, m, sizeof(m));
@@ -843,9 +843,9 @@ static void SetQuadVSProjection(vout_display_t *vd, d3d_quad_t *quad, const vlc_
     if (SUCCEEDED(hr)) {
         VS_PROJECTION_CONST *dst_data = mapped.pData;
 #define RAD(d) ((float) ((d) * M_PI / 180.f))
-        getXRotMatrix(-RAD(p_vp->pitch), dst_data->RotX);
-        getYRotMatrix(-RAD(p_vp->yaw),   dst_data->RotY);
-        getZRotMatrix(-RAD(p_vp->roll),  dst_data->RotZ);
+        getXRotMatrix(RAD(p_vp->pitch), dst_data->RotX);
+        getYRotMatrix(RAD(p_vp->yaw),   dst_data->RotY);
+        getZRotMatrix(RAD(p_vp->roll),  dst_data->RotZ);
         getZoomMatrix(SPHERE_RADIUS, dst_data->View); /* FIXME */
         float sar = (float) vd->cfg->display.width / vd->cfg->display.height;
         getProjectionMatrix(sar, RAD(p_vp->fov), dst_data->Projection);
@@ -1852,12 +1852,12 @@ static void SetupQuadSphere(d3d_vertex_t *dst_data, WORD *triangle_pos)
             unsigned off = (lat * nbLatBands + lon) * 3 * 2;
 
             triangle_pos[off] = first;
-            triangle_pos[off + 1] = second;
-            triangle_pos[off + 2] = first + 1;
+            triangle_pos[off + 1] = first + 1;
+            triangle_pos[off + 2] = second;
 
             triangle_pos[off + 3] = second;
-            triangle_pos[off + 4] = second + 1;
-            triangle_pos[off + 5] = first + 1;
+            triangle_pos[off + 4] = first + 1;
+            triangle_pos[off + 5] = second + 1;
         }
     }
 }
-- 
2.10.1



More information about the vlc-devel mailing list