[Scummvm-git-logs] scummvm master -> a4f8491c559aea84c3b8cf410d74da7e0fa344d3

lephilousophe noreply at scummvm.org
Sat Oct 15 14:46:44 UTC 2022


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

Summary:
a4f8491c55 BACKENDS: OPENGL: Try to recover from shader error at startup time


Commit: a4f8491c559aea84c3b8cf410d74da7e0fa344d3
    https://github.com/scummvm/scummvm/commit/a4f8491c559aea84c3b8cf410d74da7e0fa344d3
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2022-10-15T16:45:24+02:00

Commit Message:
BACKENDS: OPENGL: Try to recover from shader error at startup time

Let's just retry without the shader.

Changed paths:
    backends/graphics/opengl/opengl-graphics.cpp


diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index bed25322f2c..1ecedade297 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -407,6 +407,10 @@ OSystem::TransactionError OpenGLGraphicsManager::endGFXTransaction() {
 		const uint requestedWidth  = _currentState.gameWidth;
 		const uint requestedHeight = intToFrac(requestedWidth) / desiredAspect;
 
+		// Consider that shader is OK by default
+		// If loadVideoMode fails, we won't consider that shader was the error
+		bool shaderOK = true;
+
 		if (!loadVideoMode(requestedWidth, requestedHeight,
 #ifdef USE_RGB_COLOR
 		                   _currentState.gameFormat
@@ -414,7 +418,7 @@ OSystem::TransactionError OpenGLGraphicsManager::endGFXTransaction() {
 		                   Graphics::PixelFormat::createFormatCLUT8()
 #endif
 		                  )
-			|| !loadShader(_currentState.shader)
+			|| !(shaderOK = loadShader(_currentState.shader))
 		   // HACK: This is really nasty but we don't have any guarantees of
 		   // a context existing before, which means we don't know the maximum
 		   // supported texture size before this. Thus, we check whether the
@@ -466,6 +470,12 @@ OSystem::TransactionError OpenGLGraphicsManager::endGFXTransaction() {
 					// Try to set up the old state.
 					continue;
 				}
+				// If the shader failed and we had not a valid old state, try to unset the shader and do it again
+				if (!shaderOK && !_currentState.shader.empty()) {
+					_currentState.shader = "";
+					_transactionMode = kTransactionRollback;
+					continue;
+				}
 			}
 
 			// DON'T use error(), as this tries to bring up the debug




More information about the Scummvm-git-logs mailing list