Skip to content

Commit

Permalink
direct3d: Release and NULL out vertex buffers on reset.
Browse files Browse the repository at this point in the history
Otherwise they are irretrievably lost on window resize, etc, which makes
rendering freeze and other disasters.

Fixes Bugzilla #4358.
  • Loading branch information
icculus committed Dec 3, 2018
1 parent d4a21f5 commit 3c93615
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/render/direct3d/SDL_render_d3d.c
Expand Up @@ -1566,6 +1566,15 @@ D3D_Reset(SDL_Renderer * renderer)
}
}

/* Release all vertex buffers */
int i;
for (i = 0; i < SDL_arraysize(data->vertexBuffers); ++i) {
if (data->vertexBuffers[i]) {
IDirect3DVertexBuffer9_Release(data->vertexBuffers[i]);
}
data->vertexBuffers[i] = NULL;
}

result = IDirect3DDevice9_Reset(data->device, &data->pparams);
if (FAILED(result)) {
if (result == D3DERR_DEVICELOST) {
Expand Down

0 comments on commit 3c93615

Please sign in to comment.