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 8224 32af2d3806d1
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
--- a/src/render/direct3d/SDL_render_d3d.c	Mon Feb 17 11:47:54 2014 -0500
+++ b/src/render/direct3d/SDL_render_d3d.c	Mon Feb 17 22:20:33 2014 -0800
@@ -481,6 +481,10 @@
         IDirect3DSurface9_Release(data->defaultRenderTarget);
         data->defaultRenderTarget = NULL;
     }
+    if (data->currentRenderTarget != NULL) {
+        IDirect3DSurface9_Release(data->currentRenderTarget);
+        data->currentRenderTarget = NULL;
+    }
 
     /* Release application render targets */
     for (texture = renderer->textures; texture; texture = texture->next) {
@@ -508,6 +512,7 @@
 
     IDirect3DDevice9_GetRenderTarget(data->device, 0, &data->defaultRenderTarget);
     D3D_InitRenderState(data);
+    D3D_SetRenderTarget(renderer, renderer->target);
     D3D_UpdateViewport(renderer);
 
     /* Let the application know that render targets were reset */