emscripten: Don't fall back to simulating vsync if settings are still pending.

Fixes #16146.
Closes #16151.
This commit is contained in:
Ryan C. Gordon
2026-08-27 00:18:25 -04:00
parent 368b6cedf6
commit 618890f8fa
3 changed files with 12 additions and 0 deletions

View File

@@ -67,6 +67,12 @@ bool Emscripten_GLES_SetSwapInterval(SDL_VideoDevice *_this, int interval)
bool Emscripten_GLES_GetSwapInterval(SDL_VideoDevice *_this, int *interval)
{
const int pending = Emscripten_GetPendingSwapInterval();
if (pending >= 0) {
*interval = pending;
return true; // we're planning to set it to this once the system settles down.
}
int mode, value;
emscripten_get_main_loop_timing(&mode, &value);

View File

@@ -438,6 +438,11 @@ bool Emscripten_ShouldSetSwapInterval(int interval)
return true;
}
int Emscripten_GetPendingSwapInterval(void)
{
return pending_swap_interval;
}
static void Emscripten_PumpEvents(SDL_VideoDevice *_this)
{
if (!pumpevents_has_run) {

View File

@@ -57,5 +57,6 @@ struct SDL_WindowData
extern SDL_Window *Emscripten_fill_document_window;
bool Emscripten_ShouldSetSwapInterval(int interval);
int Emscripten_GetPendingSwapInterval(void);
#endif // SDL_emscriptenvideo_h_