[Scummvm-git-logs] scummvm master -> 543e53eaad7e9f0a54e1d922956ddf2467897a01

aquadran aquadran at gmail.com
Mon Nov 8 08:07:51 UTC 2021


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
dfe477e95e SURFACESDL: Implemented fallback in case lack of VSYNC
543e53eaad SURFACESDL: Implemented missing kFeatureVSync for getFeatureState()


Commit: dfe477e95e24c1a604ca195ba3f81d505b9f73d3
    https://github.com/scummvm/scummvm/commit/dfe477e95e24c1a604ca195ba3f81d505b9f73d3
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-11-08T09:07:48+01:00

Commit Message:
SURFACESDL: Implemented fallback in case lack of VSYNC

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 4e99f0a03b..f0ba3db1e4 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -2585,8 +2585,16 @@ SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height,
 
 	_renderer = SDL_CreateRenderer(_window->getSDLWindow(), -1, rendererFlags);
 	if (!_renderer) {
-		deinitializeRenderer();
-		return nullptr;
+		if (_vsync) {
+			// VSYNC might not be available, so retry without VSYNC
+			warning("SDL_SetVideoMode: SDL_CreateRenderer() failed with VSYNC option, retrying without it...");
+			rendererFlags &= ~SDL_RENDERER_PRESENTVSYNC;
+			_renderer = SDL_CreateRenderer(_window->getSDLWindow(), -1, rendererFlags);
+		}
+		if (!_renderer) {
+			deinitializeRenderer();
+			return nullptr;
+		}
 	}
 
 	getWindowSizeFromSdl(&_windowWidth, &_windowHeight);


Commit: 543e53eaad7e9f0a54e1d922956ddf2467897a01
    https://github.com/scummvm/scummvm/commit/543e53eaad7e9f0a54e1d922956ddf2467897a01
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-11-08T09:07:48+01:00

Commit Message:
SURFACESDL: Implemented missing kFeatureVSync for getFeatureState()

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 f0ba3db1e4..91579909fb 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -109,7 +109,7 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
 	_osdIconSurface(nullptr),
 #endif
 #if SDL_VERSION_ATLEAST(2, 0, 0)
-	_renderer(nullptr), _screenTexture(nullptr),
+	_renderer(nullptr), _screenTexture(nullptr), _vsync(false),
 #endif
 #if defined(WIN32) && !SDL_VERSION_ATLEAST(2, 0, 0)
 	_originalBitsPerPixel(0),
@@ -237,6 +237,10 @@ bool SurfaceSdlGraphicsManager::getFeatureState(OSystem::Feature f) const {
 #ifdef USE_ASPECT
 	case OSystem::kFeatureAspectRatioCorrection:
 		return _videoMode.aspectRatioCorrection;
+#endif
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+	case OSystem::kFeatureVSync:
+		return _vsync;
 #endif
 	case OSystem::kFeatureFilteringMode:
 		return _videoMode.filtering;
@@ -2588,6 +2592,7 @@ SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height,
 		if (_vsync) {
 			// VSYNC might not be available, so retry without VSYNC
 			warning("SDL_SetVideoMode: SDL_CreateRenderer() failed with VSYNC option, retrying without it...");
+			_vsync = false;
 			rendererFlags &= ~SDL_RENDERER_PRESENTVSYNC;
 			_renderer = SDL_CreateRenderer(_window->getSDLWindow(), -1, rendererFlags);
 		}




More information about the Scummvm-git-logs mailing list