Skip to content
Permalink
Browse files

Fixed infinite recursion in D3D_Reset()

  • Loading branch information
slouken committed Feb 21, 2014
1 parent ea71a5e commit 22e3217e598fe5c76e548a7feb3689ff9a59eeb8
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/render/direct3d/SDL_render_d3d.c
@@ -217,6 +217,7 @@ static int D3D_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, void **pixels, int *pitch);
static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture);
static int D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
static int D3D_UpdateViewport(SDL_Renderer * renderer);
static int D3D_UpdateClipRect(SDL_Renderer * renderer);
@@ -512,7 +513,7 @@ D3D_Reset(SDL_Renderer * renderer)

IDirect3DDevice9_GetRenderTarget(data->device, 0, &data->defaultRenderTarget);
D3D_InitRenderState(data);
D3D_SetRenderTarget(renderer, renderer->target);
D3D_SetRenderTargetInternal(renderer, renderer->target);
D3D_UpdateViewport(renderer);

/* Let the application know that render targets were reset */
@@ -1160,14 +1161,12 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}

static int
D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture)
{
D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
D3D_TextureData *texturedata;
HRESULT result;

D3D_ActivateRenderer(renderer);

/* Release the previous render target if it wasn't the default one */
if (data->currentRenderTarget != NULL) {
IDirect3DSurface9_Release(data->currentRenderTarget);
@@ -1197,6 +1196,14 @@ D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
return 0;
}

static int
D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
{
D3D_ActivateRenderer(renderer);

return D3D_SetRenderTargetInternal(renderer, texture);
}

static int
D3D_UpdateViewport(SDL_Renderer * renderer)
{

0 comments on commit 22e3217

Please sign in to comment.