Fixed resetting the current render target if the D3D device is reset while using a non-default render target.
authorSam Lantinga <slouken@libsdl.org>
Mon, 17 Feb 2014 22:20:33 -0800
changeset 822432af2d3806d1
parent 8223 18ffe88a2148
child 8225 14846e56e099
Fixed resetting the current render target if the D3D device is reset while using a non-default render target.
src/render/direct3d/SDL_render_d3d.c
     1.1 --- a/src/render/direct3d/SDL_render_d3d.c	Mon Feb 17 11:47:54 2014 -0500
     1.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Mon Feb 17 22:20:33 2014 -0800
     1.3 @@ -481,6 +481,10 @@
     1.4          IDirect3DSurface9_Release(data->defaultRenderTarget);
     1.5          data->defaultRenderTarget = NULL;
     1.6      }
     1.7 +    if (data->currentRenderTarget != NULL) {
     1.8 +        IDirect3DSurface9_Release(data->currentRenderTarget);
     1.9 +        data->currentRenderTarget = NULL;
    1.10 +    }
    1.11  
    1.12      /* Release application render targets */
    1.13      for (texture = renderer->textures; texture; texture = texture->next) {
    1.14 @@ -508,6 +512,7 @@
    1.15  
    1.16      IDirect3DDevice9_GetRenderTarget(data->device, 0, &data->defaultRenderTarget);
    1.17      D3D_InitRenderState(data);
    1.18 +    D3D_SetRenderTarget(renderer, renderer->target);
    1.19      D3D_UpdateViewport(renderer);
    1.20  
    1.21      /* Let the application know that render targets were reset */