[vlc-commits] d3d11_quad: move the Quad stride size in d3d_quad_t

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


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Fri Dec  1 14:02:55 2017 +0100| [2993e701c8d4de80179528f5ea985fc5c6e1de2c] | committer: Steve Lhomme

d3d11_quad: move the Quad stride size in d3d_quad_t

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

 modules/video_output/win32/d3d11_quad.h | 1 +
 modules/video_output/win32/direct3d11.c | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/video_output/win32/d3d11_quad.h b/modules/video_output/win32/d3d11_quad.h
index 6db34cfb84..f21324bf2a 100644
--- a/modules/video_output/win32/d3d11_quad.h
+++ b/modules/video_output/win32/d3d11_quad.h
@@ -37,6 +37,7 @@ typedef struct
     UINT                      resourceCount;
     ID3D11Buffer              *pVertexBuffer;
     UINT                      vertexCount;
+    UINT                      vertexStride;
     ID3D11VertexShader        *d3dvertexShader;
     ID3D11Buffer              *pIndexBuffer;
     UINT                      indexCount;
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 52df558e55..d669151194 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1061,14 +1061,13 @@ static void UpdateQuadLuminanceScale(vout_display_t *vd, d3d_quad_t *quad, float
 static void D3D11_RenderQuad(d3d11_device_t *d3d_dev, d3d_quad_t *quad, ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW],
                              ID3D11RenderTargetView *d3drenderTargetView)
 {
-    UINT stride = sizeof(d3d_vertex_t);
     UINT offset = 0;
 
     ID3D11DeviceContext_OMSetRenderTargets(d3d_dev->d3dcontext, 1, &d3drenderTargetView, NULL);
 
     /* Render the quad */
     /* vertex shader */
-    ID3D11DeviceContext_IASetVertexBuffers(d3d_dev->d3dcontext, 0, 1, &quad->pVertexBuffer, &stride, &offset);
+    ID3D11DeviceContext_IASetVertexBuffers(d3d_dev->d3dcontext, 0, 1, &quad->pVertexBuffer, &quad->vertexStride, &offset);
     ID3D11DeviceContext_IASetIndexBuffer(d3d_dev->d3dcontext, quad->pIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
     if ( quad->pVertexShaderConstants )
         ID3D11DeviceContext_VSSetConstantBuffers(d3d_dev->d3dcontext, 0, 1, &quad->pVertexShaderConstants);
@@ -2657,10 +2656,12 @@ static bool AllocQuadVertices(vout_display_t *vd, d3d_quad_t *quad)
         return false;
     }
 
+    quad->vertexStride = sizeof(d3d_vertex_t);
+
     D3D11_BUFFER_DESC bd;
     memset(&bd, 0, sizeof(bd));
     bd.Usage = D3D11_USAGE_DYNAMIC;
-    bd.ByteWidth = sizeof(d3d_vertex_t) * quad->vertexCount;
+    bd.ByteWidth = quad->vertexStride * quad->vertexCount;
     bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
     bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
 



More information about the vlc-commits mailing list