[vlc-commits] d3d11_quad: move the Quad stride size in d3d_quad_t
Steve Lhomme
git at videolan.org
Wed Oct 17 16:07:14 CEST 2018
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at videolabs.io> | Fri Dec 1 14:02:55 2017 +0100| [80492aca5ab5dba3a6377759f49c83e6a5dd2346] | committer: Steve Lhomme
d3d11_quad: move the Quad stride size in d3d_quad_t
(cherry picked from commit 2993e701c8d4de80179528f5ea985fc5c6e1de2c)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=80492aca5ab5dba3a6377759f49c83e6a5dd2346
---
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 94ee44cd96..c11b439bcd 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1096,14 +1096,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);
@@ -2676,10 +2675,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