mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +00:00
(macOS) Removed the Monterey VSync workaround as Apple has patched its OS.
This commit is contained in:
parent
ab92a4135a
commit
08bba3cbaf
|
@ -962,19 +962,6 @@ void GuiMenu::openOtherOptions()
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
// macOS Monterey VSync bug workaround (hack for broken OpenGL drivers).
|
|
||||||
auto vsyncWorkaround = std::make_shared<SwitchComponent>(mWindow);
|
|
||||||
vsyncWorkaround->setState(Settings::getInstance()->getBool("VSyncWorkaround"));
|
|
||||||
s->addWithLabel("MACOS MONTEREY VSYNC BUG WORKAROUND", vsyncWorkaround);
|
|
||||||
s->addSaveFunc([vsyncWorkaround, s] {
|
|
||||||
if (vsyncWorkaround->getState() != Settings::getInstance()->getBool("VSyncWorkaround")) {
|
|
||||||
Settings::getInstance()->setBool("VSyncWorkaround", vsyncWorkaround->getState());
|
|
||||||
s->setNeedsSaving();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Run ES in the background when a game has been launched.
|
// Run ES in the background when a game has been launched.
|
||||||
auto run_in_background = std::make_shared<SwitchComponent>(mWindow);
|
auto run_in_background = std::make_shared<SwitchComponent>(mWindow);
|
||||||
run_in_background->setState(Settings::getInstance()->getBool("RunInBackground"));
|
run_in_background->setState(Settings::getInstance()->getBool("RunInBackground"));
|
||||||
|
|
|
@ -228,9 +228,6 @@ void Settings::setDefaults()
|
||||||
mStringMap["SaveGamelistsMode"] = {"always", "always"};
|
mStringMap["SaveGamelistsMode"] = {"always", "always"};
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
mBoolMap["HideTaskbar"] = {false, false};
|
mBoolMap["HideTaskbar"] = {false, false};
|
||||||
#endif
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
mBoolMap["VSyncWorkaround"] = {true, true};
|
|
||||||
#endif
|
#endif
|
||||||
mBoolMap["RunInBackground"] = {false, false};
|
mBoolMap["RunInBackground"] = {false, false};
|
||||||
#if defined(VIDEO_HW_DECODING)
|
#if defined(VIDEO_HW_DECODING)
|
||||||
|
|
|
@ -414,30 +414,7 @@ namespace Renderer
|
||||||
|
|
||||||
void swapBuffers()
|
void swapBuffers()
|
||||||
{
|
{
|
||||||
#if defined(__APPLE__)
|
|
||||||
// This is an ugly hack to work around an OpenGL VSync bug introduced in macOS 12 Monterey.
|
|
||||||
// What happens is that the VSync setting in SDL gets effectively ignored so the operating
|
|
||||||
// system will try to render as many frames as it can manage which eats all the available
|
|
||||||
// resources. If the corresponding setting is enabled via the main menu, a 10 millisecond
|
|
||||||
// delay will be introduced if the swap took less than 3 milliseconds to complete. This is
|
|
||||||
// very crude and not accurate at all but it will hopefully avoid the worst slowdowns until
|
|
||||||
// Apple releases an OS update that properly fixes the problem.
|
|
||||||
if (Settings::getInstance()->getBool("VSyncWorkaround")) {
|
|
||||||
const auto beforeSwap = std::chrono::system_clock::now();
|
|
||||||
SDL_GL_SwapWindow(getSDLWindow());
|
|
||||||
const auto afterSwap = std::chrono::system_clock::now();
|
|
||||||
|
|
||||||
if (std::chrono::duration_cast<std::chrono::milliseconds>(afterSwap - beforeSwap)
|
|
||||||
.count() < 3.0)
|
|
||||||
SDL_Delay(10);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SDL_GL_SwapWindow(getSDLWindow());
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
SDL_GL_SwapWindow(getSDLWindow());
|
SDL_GL_SwapWindow(getSDLWindow());
|
||||||
#endif
|
|
||||||
GL_CHECK_ERROR(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
|
GL_CHECK_ERROR(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue