Move refreshDisplay() after test window creation

SDL invalidates cached display modes after a window creation, so this avoids paying a second mode enumeration cost when the user enters the settings page.
This commit is contained in:
Cameron Gutman
2026-03-28 22:01:15 -05:00
parent 91ce7a41e5
commit b6407492c7

View File

@@ -184,9 +184,6 @@ void SystemProperties::startAsyncLoad()
return; return;
} }
// Update display related attributes (max FPS, native resolution, etc).
refreshDisplays();
testWindow = SDL_CreateWindow("", 0, 0, 1280, 720, testWindow = SDL_CreateWindow("", 0, 0, 1280, 720,
SDL_WINDOW_HIDDEN | StreamUtils::getPlatformWindowFlags()); SDL_WINDOW_HIDDEN | StreamUtils::getPlatformWindowFlags());
if (!testWindow) { if (!testWindow) {
@@ -204,6 +201,13 @@ void SystemProperties::startAsyncLoad()
} }
} }
// Update display related attributes (max FPS, native resolution, etc).
//
// NB: SDL3 will forcefully refresh displays when a window is created,
// so we place this after the window creation to ensure we don't pay
// the penalty for mode enumeration twice.
refreshDisplays();
systemPropertyQueryThread = new SystemPropertyQueryThread(this); systemPropertyQueryThread = new SystemPropertyQueryThread(this);
systemPropertyQueryThread->start(); systemPropertyQueryThread->start();
} }