opengl: default to vsync=0 everywhere.

This reverts commit 3ee29f2e7a, among other
changes. This means getting a scary warning on the javascript console in
Emscripten by default, but this is easily fixed by setting a GL swap
interval at startup or creating a 2D renderer with the appropriate property
(or call to SDL_SetRenderVSync()).

Fixes #14625.
This commit is contained in:
Ryan C. Gordon
2025-12-08 15:12:06 -05:00
parent a296c40867
commit b3cdeb942a
2 changed files with 3 additions and 11 deletions

View File

@@ -1238,16 +1238,8 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props)
SDL_AddWindowEventWatch(SDL_WINDOW_EVENT_WATCH_NORMAL, SDL_RendererEventWatch, renderer);
}
#ifdef SDL_PLATFORM_EMSCRIPTEN // don't change vsync on Emscripten unless explicitly requested; we already set this with a mainloop, and a 0 default causes problems here.
if (SDL_HasProperty(props, SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER)) {
const int vsync = (int)SDL_GetNumberProperty(props, SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER, 0);
SDL_SetRenderVSync(renderer, vsync);
}
#else // everything else defaults to no vsync if not requested.
const int vsync = (int)SDL_GetNumberProperty(props, SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER, 0);
int vsync = (int)SDL_GetNumberProperty(props, SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER, 0);
SDL_SetRenderVSync(renderer, vsync);
#endif
SDL_CalculateSimulatedVSyncInterval(renderer, window);
SDL_LogInfo(SDL_LOG_CATEGORY_RENDER,

View File

@@ -1107,8 +1107,8 @@ SDL_GLContext SDL_EGL_CreateContext(SDL_VideoDevice *_this, EGLSurface egl_surfa
return NULL;
}
// The default swap interval is 1, according to the spec
_this->egl_data->egl_swapinterval = 1;
// The default swap interval is 1, according to the spec, but SDL3's policy is to default vsync to off by default.
_this->egl_data->egl_swapinterval = 0;
if (!SDL_EGL_MakeCurrent(_this, egl_surface, (SDL_GLContext)egl_context)) {
// Delete the context