direct3d: Release and NULL out vertex buffers on reset.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 02 Dec 2018 20:55:57 -0500
changeset 12444088f52a4e1b2
parent 12443 0e07e768840f
child 12445 2cdb34815a86
direct3d: Release and NULL out vertex buffers on reset.

Otherwise they are irretrievably lost on window resize, etc, which makes
rendering freeze and other disasters.

Fixes Bugzilla #4358.
src/render/direct3d/SDL_render_d3d.c
     1.1 --- a/src/render/direct3d/SDL_render_d3d.c	Sun Dec 02 02:43:32 2018 -0500
     1.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Sun Dec 02 20:55:57 2018 -0500
     1.3 @@ -1566,6 +1566,15 @@
     1.4          }
     1.5      }
     1.6  
     1.7 +	/* Release all vertex buffers */
     1.8 +    int i;
     1.9 +    for (i = 0; i < SDL_arraysize(data->vertexBuffers); ++i) {
    1.10 +        if (data->vertexBuffers[i]) {
    1.11 +            IDirect3DVertexBuffer9_Release(data->vertexBuffers[i]);
    1.12 +        }
    1.13 +        data->vertexBuffers[i] = NULL;
    1.14 +    }
    1.15 +
    1.16      result = IDirect3DDevice9_Reset(data->device, &data->pparams);
    1.17      if (FAILED(result)) {
    1.18          if (result == D3DERR_DEVICELOST) {