From 9d64e6b442b52f45ce6519a844941be92caadda0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 3 Aug 2021 00:29:33 -0700 Subject: [PATCH] Revert "direct3d: Commit dirty viewport state before clearing." This reverts commit 0e16ee833060660318cc324cf99c9736f4d48499. --- src/render/direct3d/SDL_render_d3d.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index 9e04e367d..30d9b02f0 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -1318,7 +1318,6 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti const SDL_Rect *viewport = &data->drawstate.viewport; const int backw = istarget ? renderer->target->w : data->pparams.BackBufferWidth; const int backh = istarget ? renderer->target->h : data->pparams.BackBufferHeight; - const SDL_bool viewport_unequal = ((viewport->x == 0) && (viewport->y == 0) && (viewport->w == backw) && (viewport->h == backh)) ? SDL_FALSE : SDL_TRUE; if (data->drawstate.cliprect_enabled || data->drawstate.cliprect_enabled_dirty) { IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE, FALSE); @@ -1326,13 +1325,13 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti } /* Don't reset the viewport if we don't have to! */ - if (!data->drawstate.viewport_dirty && !viewport_unequal) { + if (!viewport->x && !viewport->y && (viewport->w == backw) && (viewport->h == backh)) { IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0); } else { /* Clear is defined to clear the entire render target */ const D3DVIEWPORT9 wholeviewport = { 0, 0, backw, backh, 0.0f, 1.0f }; IDirect3DDevice9_SetViewport(data->device, &wholeviewport); - data->drawstate.viewport_dirty = viewport_unequal; + data->drawstate.viewport_dirty = SDL_TRUE; IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0); }