[vlc-devel] [PATCH 2/3] direct3d11: keep track of the number of vertices we use
Steve Lhomme
robux4 at videolabs.io
Tue Nov 15 17:30:30 CET 2016
---
modules/video_output/win32/common.h | 1 +
modules/video_output/win32/direct3d11.c | 9 ++++-----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index 8dc980c..d64668e 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -61,6 +61,7 @@ typedef struct
typedef struct
{
ID3D11Buffer *pVertexBuffer;
+ UINT vertexCount;
ID3D11Texture2D *pTexture;
ID3D11ShaderResourceView *d3dresViewY;
ID3D11ShaderResourceView *d3dresViewUV;
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 4a29d5f..b42b00e 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1688,11 +1688,12 @@ static int AllocQuad(vout_display_t *vd, const video_format_t *fmt, d3d_quad_t *
vout_display_sys_t *sys = vd->sys;
D3D11_MAPPED_SUBRESOURCE mappedResource;
HRESULT hr;
+ quad->vertexCount = 4;
D3D11_BUFFER_DESC bd;
memset(&bd, 0, sizeof(bd));
bd.Usage = D3D11_USAGE_DYNAMIC;
- bd.ByteWidth = sizeof(d3d_vertex_t) * 4;
+ bd.ByteWidth = sizeof(d3d_vertex_t) * quad->vertexCount;
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
@@ -1947,10 +1948,8 @@ static void UpdateQuadOpacity(vout_display_t *vd, const d3d_quad_t *quad, float
if (SUCCEEDED(hr)) {
d3d_vertex_t *dst_data = mappedResource.pData;
- dst_data[0].opacity = opacity;
- dst_data[1].opacity = opacity;
- dst_data[2].opacity = opacity;
- dst_data[3].opacity = opacity;
+ for (size_t i=0; i<quad->vertexCount; ++i)
+ dst_data[i].opacity = opacity;
ID3D11DeviceContext_Unmap(sys->d3dcontext, (ID3D11Resource *)quad->pVertexBuffer, 0);
}
--
2.10.1
More information about the vlc-devel
mailing list