Commit e6a843c0 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

direct3d11: keep track of the number of vertices we use

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 8e8c4013
......@@ -61,6 +61,7 @@ typedef struct
typedef struct
{
ID3D11Buffer *pVertexBuffer;
UINT vertexCount;
ID3D11Texture2D *pTexture;
ID3D11ShaderResourceView *d3dresViewY;
ID3D11ShaderResourceView *d3dresViewUV;
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment