[vlc-devel] [PATCH 6/6] direct3d11: the flat Vertex Shader doesn't need any constants

Steve Lhomme robux4 at videolabs.io
Tue Nov 22 11:59:44 CET 2016


---
 modules/video_output/win32/direct3d11.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index eeef392..1aa7128 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -2077,15 +2077,18 @@ static int AllocQuad(vout_display_t *vd, const video_format_t *fmt, d3d_quad_t *
     }
 
     /* vertex shader constant buffer */
-    constantDesc.ByteWidth = sizeof(VS_PROJECTION_CONST);
-    static_assert((sizeof(VS_PROJECTION_CONST)%16)==0,"Constant buffers require 16-byte alignment");
-    hr = ID3D11Device_CreateBuffer(sys->d3ddevice, &constantDesc, NULL, &quad->pVertexShaderConstants);
-    if(FAILED(hr)) {
-        msg_Err(vd, "Could not create the vertex shader constant buffer. (hr=0x%lX)", hr);
-        goto error;
-    }
+    if ( projection == PROJECTION_MODE_EQUIRECTANGULAR )
+    {
+        constantDesc.ByteWidth = sizeof(VS_PROJECTION_CONST);
+        static_assert((sizeof(VS_PROJECTION_CONST)%16)==0,"Constant buffers require 16-byte alignment");
+        hr = ID3D11Device_CreateBuffer(sys->d3ddevice, &constantDesc, NULL, &quad->pVertexShaderConstants);
+        if(FAILED(hr)) {
+            msg_Err(vd, "Could not create the vertex shader constant buffer. (hr=0x%lX)", hr);
+            goto error;
+        }
 
-    SetQuadVSProjection( vd, quad, &vd->cfg->viewpoint );
+        SetQuadVSProjection( vd, quad, &vd->cfg->viewpoint );
+    }
 
     D3D11_TEXTURE2D_DESC texDesc;
     memset(&texDesc, 0, sizeof(texDesc));
-- 
2.10.1



More information about the vlc-devel mailing list