Skip to content

Commit

Permalink
SDL: Fix clear-only render passes getting silently discarded
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Dec 20, 2024
1 parent b288d4d commit 69318da
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/FNA3D_Driver_SDL.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,23 @@ static void SDLGPU_INTERNAL_BindRenderTarget(
textureHandle->boundAsRenderTarget = 1;
}

static void SDLGPU_INTERNAL_BeginRenderPass(
SDLGPU_Renderer* renderer
);

static void SDLGPU_INTERNAL_EndRenderPass(
SDLGPU_Renderer *renderer
) {
/* If we got to EndRenderPass without actually making a new render pass,
* we're looking at a clear-only pass, so just forcibly start it so we
* can have the clear execute instead of silently discarding it.
* -flibit
*/
if (renderer->needNewRenderPass)
{
SDLGPU_INTERNAL_BeginRenderPass(renderer);
}

if (renderer->renderPass != NULL)
{
SDL_EndGPURenderPass(
Expand Down Expand Up @@ -756,6 +770,7 @@ static void SDLGPU_INTERNAL_BeginRenderPass(
{
return;
}
renderer->needNewRenderPass = 0;

SDLGPU_INTERNAL_EndRenderPass(renderer);

Expand Down Expand Up @@ -897,8 +912,6 @@ static void SDLGPU_INTERNAL_BeginRenderPass(
&scissorRect
);

renderer->needNewRenderPass = 0;

renderer->shouldClearColorOnBeginPass = 0;
renderer->shouldClearDepthOnBeginPass = 0;
renderer->shouldClearStencilOnBeginPass = 0;
Expand Down

0 comments on commit 69318da

Please sign in to comment.