mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 23:15:38 +00:00
Small improvements to the VSync setup and logging.
This commit is contained in:
parent
e2b3ca55be
commit
001a46341e
|
@ -377,21 +377,20 @@ namespace Renderer
|
|||
|
||||
void setSwapInterval()
|
||||
{
|
||||
// vsync.
|
||||
if (Settings::getInstance()->getBool("VSync")) {
|
||||
// SDL_GL_SetSwapInterval(0) for immediate updates (no vsync, default),
|
||||
// 1 for updates synchronized with the vertical retrace,
|
||||
// or -1 for late swap tearing.
|
||||
// SDL_GL_SetSwapInterval returns 0 on success, -1 on error.
|
||||
// if vsync is requested, try normal vsync; if that doesn't work, try late swap tearing
|
||||
// if that doesn't work, report an error.
|
||||
if (SDL_GL_SetSwapInterval(1) != 0 && SDL_GL_SetSwapInterval(-1) != 0) {
|
||||
LOG(LogWarning) << "Tried to enable vsync, but it failed. (" <<
|
||||
SDL_GetError() << ")";
|
||||
// Adaptive VSync seems to be nonfunctional or having issues on some hardware
|
||||
// and drivers, so only attempt to apply regular VSync.
|
||||
if (SDL_GL_SetSwapInterval(1) == 0) {
|
||||
LOG(LogInfo) << "Enabling VSync...";
|
||||
}
|
||||
else {
|
||||
LOG(LogWarning) << "Could not enable VSync: " << SDL_GetError();
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
SDL_GL_SetSwapInterval(0);
|
||||
LOG(LogInfo) << "Disabling VSync...";
|
||||
}
|
||||
}
|
||||
|
||||
void swapBuffers()
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace Renderer
|
|||
LOG(LogInfo) << "GL renderer: " << renderer;
|
||||
LOG(LogInfo) << "GL version: " << version;
|
||||
LOG(LogInfo) << "EmulationStation renderer: OpenGL ES 1.0";
|
||||
LOG(LogInfo) << "Checking available OpenGL extensions...";
|
||||
LOG(LogInfo) << "Checking available OpenGL ES extensions...";
|
||||
std::string glExts = glGetString(GL_EXTENSIONS) ?
|
||||
reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)) : "";
|
||||
LOG(LogInfo) << "GL_OES_texture_npot: " <<
|
||||
|
@ -240,21 +240,19 @@ namespace Renderer
|
|||
|
||||
void setSwapInterval()
|
||||
{
|
||||
// vsync.
|
||||
if (Settings::getInstance()->getBool("VSync")) {
|
||||
// SDL_GL_SetSwapInterval(0) for immediate updates (no vsync, default),
|
||||
// 1 for updates synchronized with the vertical retrace,
|
||||
// or -1 for late swap tearing.
|
||||
// SDL_GL_SetSwapInterval returns 0 on success, -1 on error.
|
||||
// if vsync is requested, try normal vsync; if that doesn't work, try late swap tearing
|
||||
// if that doesn't work, report an error.
|
||||
if (SDL_GL_SetSwapInterval(1) != 0 && SDL_GL_SetSwapInterval(-1) != 0) {
|
||||
LOG(LogWarning) << "Tried to enable vsync, but it failed. (" <<
|
||||
SDL_GetError() << ")";
|
||||
// Adaptive VSync seems to be nonfunctional or having issues on some hardware
|
||||
// and drivers, so only attempt to apply regular VSync.
|
||||
if (SDL_GL_SetSwapInterval(1) == 0) {
|
||||
LOG(LogInfo) << "Enabling VSync...";
|
||||
}
|
||||
else {
|
||||
LOG(LogWarning) << "Could not enable VSync: " << SDL_GetError();
|
||||
}
|
||||
}
|
||||
else {
|
||||
SDL_GL_SetSwapInterval(0);
|
||||
LOG(LogInfo) << "Disabling VSync...";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue