[Scummvm-git-logs] scummvm master -> 5873dfad7c546f780b0840dad9abf8f0d01f5086
SupSuper
supsuper at gmail.com
Sat Oct 23 19:53:27 UTC 2021
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3a59c28179 SDL: Generalize VSYNC option so it works for 2D games too, in both SDL surface and opengl graphic modes.
046b48f90d SDL: Add OSystem::kFeatureVSync to SDL surface and OpenGL graphics.
58a243842f SDL: Remove redundant #if.
5873dfad7c SDL: Add missing getFeatureState() case for VSYNC.
Commit: 3a59c281793077b10a42d46f5f670bfeb939071c
https://github.com/scummvm/scummvm/commit/3a59c281793077b10a42d46f5f670bfeb939071c
Author: Vanfanel (redwindwanderer at gmail.com)
Date: 2021-10-23T20:53:22+01:00
Commit Message:
SDL: Generalize VSYNC option so it works for 2D games too, in both SDL surface and opengl graphic modes.
Changed paths:
backends/graphics/openglsdl/openglsdl-graphics.cpp
backends/graphics/openglsdl/openglsdl-graphics.h
backends/graphics/surfacesdl/surfacesdl-graphics.cpp
backends/graphics/surfacesdl/surfacesdl-graphics.h
gui/options.cpp
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 870686083e..6d3af1e746 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -539,6 +539,13 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
return false;
}
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ _vsync = ConfMan.getBool("vsync");
+ if (SDL_GL_SetSwapInterval(_vsync ? 1 : 0)) {
+ warning("Unable to %s VSync: %s", _vsync ? "enable" : "disable", SDL_GetError());
+ }
+#endif
+
notifyContextCreate(rgba8888, rgba8888);
int actualWidth, actualHeight;
getWindowSizeFromSdl(&actualWidth, &actualHeight);
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h
index 6feb1ad6f6..34d7ead3d9 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.h
+++ b/backends/graphics/openglsdl/openglsdl-graphics.h
@@ -92,6 +92,9 @@ private:
bool _ignoreLoadVideoMode;
bool _gotResize;
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ bool _vsync;
+#endif
bool _wantsFullScreen;
uint _ignoreResizeEvents;
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index af1a7475d7..41635e6817 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -2560,6 +2560,7 @@ SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height,
deinitializeRenderer();
uint32 createWindowFlags = SDL_WINDOW_RESIZABLE;
+ uint32 rendererFlags = 0;
if ((flags & SDL_FULLSCREEN) != 0) {
createWindowFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}
@@ -2576,7 +2577,14 @@ SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height,
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
#endif
- _renderer = SDL_CreateRenderer(_window->getSDLWindow(), -1, 0);
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ _vsync = ConfMan.getBool("vsync");
+ if (_vsync) {
+ rendererFlags |= SDL_RENDERER_PRESENTVSYNC;
+ }
+#endif
+
+ _renderer = SDL_CreateRenderer(_window->getSDLWindow(), -1, rendererFlags);
if (!_renderer) {
deinitializeRenderer();
return nullptr;
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index 34310369ab..6da1f2637e 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -193,6 +193,7 @@ protected:
int SDL_SetColors(SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors);
int SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);
int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key);
+ bool _vsync;
#endif
/** Unseen game screen */
diff --git a/gui/options.cpp b/gui/options.cpp
index 3f179313ef..c131b3c1e7 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -1466,7 +1466,7 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
// Fullscreen checkbox
_fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", _("Fullscreen mode"), Common::U32String(), kFullscreenToggled);
- _vsyncCheckbox = new CheckboxWidget(boss, prefix + "grVSyncCheckbox", _("V-Sync in 3D Games"), _("Wait for the vertical sync to refresh the screen in 3D renderer"));
+ _vsyncCheckbox = new CheckboxWidget(boss, prefix + "grVSyncCheckbox", _("V-Sync"), _("Wait for the vertical sync to refresh the screen in order to prevent tearing artifacts"));
if (g_system->getOverlayWidth() > 320)
_rendererTypePopUpDesc = new StaticTextWidget(boss, prefix + "grRendererTypePopupDesc", _("Game 3D Renderer:"));
Commit: 046b48f90d8e7240e6d99522200aecf4faebcb24
https://github.com/scummvm/scummvm/commit/046b48f90d8e7240e6d99522200aecf4faebcb24
Author: Vanfanel (redwindwanderer at gmail.com)
Date: 2021-10-23T20:53:22+01:00
Commit Message:
SDL: Add OSystem::kFeatureVSync to SDL surface and OpenGL graphics.
Changed paths:
backends/graphics/openglsdl/openglsdl-graphics.cpp
backends/graphics/surfacesdl/surfacesdl-graphics.cpp
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 6d3af1e746..5985063c5e 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -201,6 +201,7 @@ bool OpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) const {
case OSystem::kFeatureIconifyWindow:
#if SDL_VERSION_ATLEAST(2, 0, 0)
case OSystem::kFeatureFullscreenToggleKeepsContext:
+ case OSystem::kFeatureVSync:
#endif
return true;
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 41635e6817..8197dd6ae4 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -193,6 +193,7 @@ bool SurfaceSdlGraphicsManager::hasFeature(OSystem::Feature f) const {
#if SDL_VERSION_ATLEAST(2, 0, 0)
(f == OSystem::kFeatureFullscreenToggleKeepsContext) ||
(f == OSystem::kFeatureStretchMode) ||
+ (f == OSystem::kFeatureVSync) ||
#endif
(f == OSystem::kFeatureCursorPalette) ||
(f == OSystem::kFeatureIconifyWindow);
Commit: 58a243842f905b8d878ccd6c07dc76be779f48e3
https://github.com/scummvm/scummvm/commit/58a243842f905b8d878ccd6c07dc76be779f48e3
Author: Vanfanel (redwindwanderer at gmail.com)
Date: 2021-10-23T20:53:22+01:00
Commit Message:
SDL: Remove redundant #if.
Changed paths:
backends/graphics/surfacesdl/surfacesdl-graphics.cpp
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 8197dd6ae4..4e99f0a03b 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -2578,12 +2578,10 @@ SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height,
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
#endif
-#if SDL_VERSION_ATLEAST(2, 0, 0)
_vsync = ConfMan.getBool("vsync");
if (_vsync) {
rendererFlags |= SDL_RENDERER_PRESENTVSYNC;
}
-#endif
_renderer = SDL_CreateRenderer(_window->getSDLWindow(), -1, rendererFlags);
if (!_renderer) {
Commit: 5873dfad7c546f780b0840dad9abf8f0d01f5086
https://github.com/scummvm/scummvm/commit/5873dfad7c546f780b0840dad9abf8f0d01f5086
Author: Vanfanel (redwindwanderer at gmail.com)
Date: 2021-10-23T20:53:22+01:00
Commit Message:
SDL: Add missing getFeatureState() case for VSYNC.
Changed paths:
backends/graphics/openglsdl/openglsdl-graphics.cpp
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 5985063c5e..22b19554de 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -244,6 +244,10 @@ bool OpenGLSdlGraphicsManager::getFeatureState(OSystem::Feature f) const {
return _wantsFullScreen;
}
#endif
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ case OSystem::kFeatureVSync:
+ return SDL_GL_GetSwapInterval() != 0;
+#endif
default:
return OpenGLGraphicsManager::getFeatureState(f);
More information about the Scummvm-git-logs
mailing list