Răsfoiți Sursa

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

Fixes #16146.
Closes #16151.
Ryan C. Gordon 3 săptămâni în urmă
părinte
comite
618890f8fa

+ 6 - 0
src/video/emscripten/SDL_emscriptenopengles.c

@@ -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);

+ 5 - 0
src/video/emscripten/SDL_emscriptenvideo.c

@@ -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) {

+ 1 - 0
src/video/emscripten/SDL_emscriptenvideo.h

@@ -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_