[vlc-commits] direct3d11: the flat Vertex Shader doesn't need any constants

Steve Lhomme git at videolan.org
Tue Nov 22 21:40:27 CET 2016


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Tue Nov 22 11:59:44 2016 +0100| [687fe78e4900131ad66de4a6e4586f0fa27cad33] | committer: Jean-Baptiste Kempf

direct3d11: the flat Vertex Shader doesn't need any constants

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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));



More information about the vlc-commits mailing list