Fixed bug 1491 - Directx3d Crash on resize
authorSam Lantinga <slouken@libsdl.org>
Mon, 11 Feb 2013 21:12:14 -0800
changeset 6860c16fc4e46ae5
parent 6859 7b36a8a5ee51
child 6861 c1c9eab3bd20
Fixed bug 1491 - Directx3d Crash on resize

Spinduluz

RenderTarget has to be released before a device reset is done. It's a
D3DPOOL_DEFAULT surface (resides in video memory and have to be recreated).
src/render/direct3d/SDL_render_d3d.c
     1.1 --- a/src/render/direct3d/SDL_render_d3d.c	Mon Feb 11 21:04:46 2013 -0800
     1.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Mon Feb 11 21:12:14 2013 -0800
     1.3 @@ -361,6 +361,9 @@
     1.4      D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
     1.5      HRESULT result;
     1.6  
     1.7 +    /* Release the default render target before reset */
     1.8 +    IDirect3DSurface9_Release(data->defaultRenderTarget);
     1.9 +
    1.10      result = IDirect3DDevice9_Reset(data->device, &data->pparams);
    1.11      if (FAILED(result)) {
    1.12          if (result == D3DERR_DEVICELOST) {
    1.13 @@ -377,6 +380,7 @@
    1.14      IDirect3DDevice9_SetRenderState(data->device, D3DRS_CULLMODE,
    1.15                                      D3DCULL_NONE);
    1.16      IDirect3DDevice9_SetRenderState(data->device, D3DRS_LIGHTING, FALSE);
    1.17 +    IDirect3DDevice9_GetRenderTarget(data->device, 0, &data->defaultRenderTarget);
    1.18      return 0;
    1.19  }
    1.20