Skip to content

Commit

Permalink
direct3d11: Always set vertex buffers when updating them (thanks, Kon…
Browse files Browse the repository at this point in the history
…rad!).

Fixes Bugzilla #4913.
  • Loading branch information
icculus committed Dec 23, 2019
1 parent 982f8a8 commit 131e13a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/render/direct3d11/SDL_render_d3d11.c
Expand Up @@ -1835,6 +1835,8 @@ D3D11_UpdateVertexBuffer(SDL_Renderer *renderer,
D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
HRESULT result = S_OK;
const int vbidx = rendererData->currentVertexBuffer;
const UINT stride = sizeof(VertexPositionColor);
const UINT offset = 0;

if (dataSizeInBytes == 0) {
return 0; /* nothing to do. */
Expand All @@ -1858,8 +1860,6 @@ D3D11_UpdateVertexBuffer(SDL_Renderer *renderer,
} else {
D3D11_BUFFER_DESC vertexBufferDesc;
D3D11_SUBRESOURCE_DATA vertexBufferData;
const UINT stride = sizeof(VertexPositionColor);
const UINT offset = 0;

SAFE_RELEASE(rendererData->vertexBuffers[vbidx]);

Expand All @@ -1885,16 +1885,16 @@ D3D11_UpdateVertexBuffer(SDL_Renderer *renderer,
}

rendererData->vertexBufferSizes[vbidx] = dataSizeInBytes;

ID3D11DeviceContext_IASetVertexBuffers(rendererData->d3dContext,
0,
1,
&rendererData->vertexBuffers[vbidx],
&stride,
&offset
);
}

ID3D11DeviceContext_IASetVertexBuffers(rendererData->d3dContext,
0,
1,
&rendererData->vertexBuffers[vbidx],
&stride,
&offset
);

rendererData->currentVertexBuffer++;
if (rendererData->currentVertexBuffer >= SDL_arraysize(rendererData->vertexBuffers)) {
rendererData->currentVertexBuffer = 0;
Expand Down

0 comments on commit 131e13a

Please sign in to comment.