Skip to content

Commit 01e8cee

Browse files
wiiu/render: Avoid calling GX2SetSwapInterval in background
1 parent 114280c commit 01e8cee

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/render/wiiu/SDL_rpresent_wiiu.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,21 @@ static SDL_bool tvDrcEnabled = SDL_FALSE;
3838

3939
int WIIU_SDL_SetVSync(SDL_Renderer * renderer, const int vsync)
4040
{
41-
GX2SetSwapInterval(vsync ? 1 : 0);
41+
WIIU_VideoData *videodata = (WIIU_VideoData *) SDL_GetVideoDevice()->driverdata;
42+
uint32_t swapInterval = vsync ? 1 : 0;
4243

43-
if (GX2GetSwapInterval() > 0) {
44+
// Don't attempt to update swap interval if in background
45+
if (!videodata->hasForeground) {
46+
return 0;
47+
}
48+
49+
if (GX2GetSwapInterval() == swapInterval) {
50+
return 0;
51+
}
52+
53+
GX2SetSwapInterval(swapInterval);
54+
55+
if (swapInterval > 0) {
4456
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
4557
} else {
4658
renderer->info.flags &= ~SDL_RENDERER_PRESENTVSYNC;

0 commit comments

Comments
 (0)