From 6b33f2e8cab7e8ad0e0ceb037e84ff25fceb20a5 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 17 Feb 2014 22:20:33 -0800 Subject: [PATCH] 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index 47675c7a1..28598207c 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -481,6 +481,10 @@ D3D_Reset(SDL_Renderer * renderer) 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 @@ D3D_Reset(SDL_Renderer * renderer) 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 */