From dcf04559dbd64d2763a8f514f671da7a2fc01da8 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 23 Nov 2023 18:28:43 -0500 Subject: [PATCH] render: GL-based renderers should treat adaptive vsync as vsync being enabled. Fixes #8004. --- src/render/opengl/SDL_render_gl.c | 8 +++----- src/render/opengles2/SDL_render_gles2.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index d63eef782..c047c08c6 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1701,7 +1701,7 @@ static int GL_SetVSync(SDL_Renderer *renderer, const int vsync) return retval; } - if (interval > 0) { + if (interval != 0) { renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } else { renderer->info.flags &= ~SDL_RENDERER_PRESENTVSYNC; @@ -1850,10 +1850,8 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window *window, SDL_PropertiesID crea int interval = 0; if (SDL_GL_GetSwapInterval(&interval) < 0) { /* Error */ - } else { - if (interval > 0) { - renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; - } + } else if (interval != 0) { + renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } } diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index 9b7ca50c4..1eb17c6e1 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -1988,7 +1988,7 @@ static int GLES2_SetVSync(SDL_Renderer *renderer, const int vsync) return retval; } - if (interval > 0) { + if (interval != 0) { renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } else { renderer->info.flags &= ~SDL_RENDERER_PRESENTVSYNC; @@ -2151,10 +2151,8 @@ static SDL_Renderer *GLES2_CreateRenderer(SDL_Window *window, SDL_PropertiesID c int interval = 0; if (SDL_GL_GetSwapInterval(&interval) < 0) { /* Error */ - } else { - if (interval > 0) { - renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; - } + } else if (interval != 0) { + renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } }