Skip to content

Commit 50697f7

Browse files
mardyWinterMute
authored andcommitted
ogc: avoid copying to XFB when clearing with a render target
If we are rendering to a texture, we must avoid writing to the XFB, because the image we are rendering might not be intended to be shown as-is on the XFB. So, when clearing the display, pay attention to whether we are rendering to a texture and, in that case, do not copy the EFB to the XFB. Instead, copy it to the texture itself (not that we care a lot about this copy, since the texture will anyway be overwitten once it stops being a render target; but we do care about this operation causing a full clearing of the EFB).
1 parent 09fb6f8 commit 50697f7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/render/ogc/SDL_render_ogc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,11 @@ static int OGC_RenderClear(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
384384

385385
data->clear_color = c;
386386
GX_SetCopyClear(c, GX_MAX_Z24);
387-
GX_CopyDisp(OGC_video_get_xfb(SDL_GetVideoDevice()), GX_TRUE);
387+
if (renderer->target) {
388+
save_efb_to_texture(renderer->target);
389+
} else {
390+
GX_CopyDisp(OGC_video_get_xfb(SDL_GetVideoDevice()), GX_TRUE);
391+
}
388392

389393
return 0;
390394
}

0 commit comments

Comments
 (0)