[Scummvm-git-logs] scummvm branch-2-9 -> 587eb1f0224c016847ab4becb0f315bd171806f7

lephilousophe noreply at scummvm.org
Sat May 3 10:55:41 UTC 2025


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

Summary:
f60acfba09 ANDROID: RGB888 and BGR888 are not supported by OpenGL backend
587eb1f022 BACKENDS: OPENGL: Don't use HW CLUT8 lookup on low precision devices


Commit: f60acfba09447ffa4e2d423f768666a012eab781
    https://github.com/scummvm/scummvm/commit/f60acfba09447ffa4e2d423f768666a012eab781
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-05-03T12:54:06+02:00

Commit Message:
ANDROID: RGB888 and BGR888 are not supported by OpenGL backend

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


diff --git a/backends/graphics/android/android-graphics.cpp b/backends/graphics/android/android-graphics.cpp
index 33cb865dced..1600928a6a7 100644
--- a/backends/graphics/android/android-graphics.cpp
+++ b/backends/graphics/android/android-graphics.cpp
@@ -87,10 +87,10 @@ void AndroidGraphicsManager::initSurface() {
 		notifyContextCreate(OpenGL::kContextGLES2,
 				new OpenGL::Backbuffer(),
 #ifdef SCUMM_BIG_ENDIAN
-				Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0),
+				Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0),
 				Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)
 #else
-				Graphics::PixelFormat(3, 8, 8, 8, 0, 0, 8, 16, 0),
+				Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24),
 				Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24)
 #endif
 		);


Commit: 587eb1f0224c016847ab4becb0f315bd171806f7
    https://github.com/scummvm/scummvm/commit/587eb1f0224c016847ab4becb0f315bd171806f7
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-05-03T12:54:50+02:00

Commit Message:
BACKENDS: OPENGL: Don't use HW CLUT8 lookup on low precision devices

This will hopefully fix Trac#15860 for good.
I also hope that nothing else will get broken because of this.

Changed paths:
    backends/graphics/opengl/texture.h
    graphics/opengl/context.cpp
    graphics/opengl/context.h


diff --git a/backends/graphics/opengl/texture.h b/backends/graphics/opengl/texture.h
index ab251f3e318..6ef1767fe75 100644
--- a/backends/graphics/opengl/texture.h
+++ b/backends/graphics/opengl/texture.h
@@ -434,7 +434,9 @@ public:
 	static bool isSupportedByContext() {
 		return OpenGLContext.shadersSupported
 		    && OpenGLContext.multitextureSupported
-		    && OpenGLContext.framebufferObjectSupported;
+		    && OpenGLContext.framebufferObjectSupported
+		    // With 2^-8 precision this is too prone to approximation errors
+		    && OpenGLContext.textureLookupPrecision > 8;
 	}
 private:
 	void lookUpColors();
diff --git a/graphics/opengl/context.cpp b/graphics/opengl/context.cpp
index 5e888125c48..ec30949a180 100644
--- a/graphics/opengl/context.cpp
+++ b/graphics/opengl/context.cpp
@@ -78,6 +78,7 @@ void Context::reset() {
 	textureBorderClampSupported = false;
 	textureMirrorRepeatSupported = false;
 	textureMaxLevelSupported = false;
+	textureLookupPrecision = 0;
 }
 
 void Context::initialize(ContextType contextType) {
@@ -240,6 +241,13 @@ void Context::initialize(ContextType contextType) {
 		// No border clamping in GLES2
 		textureMirrorRepeatSupported = true;
 		// TODO: textureMaxLevelSupported with GLES3
+
+		// In GLES2, texture lookup is done using lowp (and mediump is not always available)
+		GLint range[2];
+		GLint precision = 0;
+		glGetShaderPrecisionFormat(GL_FRAGMENT_SHADER, GL_LOW_FLOAT, range, &precision);
+		textureLookupPrecision = precision;
+
 		debug(5, "OpenGL: GLES2 context initialized");
 	} else if (type == kContextGLES) {
 		// GLES doesn't support shaders natively
@@ -252,6 +260,8 @@ void Context::initialize(ContextType contextType) {
 		textureEdgeClampSupported = true;
 		// No border clamping in GLES
 		// No mirror repeat in GLES
+		// Precision is irrelevant (shaders) in GLES
+
 		debug(5, "OpenGL: GLES context initialized");
 	} else if (type == kContextGL) {
 		// Official support of shaders starts with version 110
@@ -285,6 +295,10 @@ void Context::initialize(ContextType contextType) {
 		if (isGLVersionOrHigher(1, 4)) {
 			textureMirrorRepeatSupported = true;
 		}
+
+		// In OpenGL precision is always enough
+		textureLookupPrecision = UINT_MAX;
+
 		debug(5, "OpenGL: GL context initialized");
 	} else {
 		warning("OpenGL: Unknown context initialized");
@@ -315,6 +329,7 @@ void Context::initialize(ContextType contextType) {
 	debug(5, "OpenGL: Texture border clamping support: %d", textureBorderClampSupported);
 	debug(5, "OpenGL: Texture mirror repeat support: %d", textureMirrorRepeatSupported);
 	debug(5, "OpenGL: Texture max level support: %d", textureMaxLevelSupported);
+	debug(5, "OpenGL: Texture lookup precision: %d", textureLookupPrecision);
 }
 
 int Context::getGLSLVersion() const {
diff --git a/graphics/opengl/context.h b/graphics/opengl/context.h
index 925ff0607fc..9079dbebad1 100644
--- a/graphics/opengl/context.h
+++ b/graphics/opengl/context.h
@@ -120,6 +120,9 @@ public:
 	/** Whether texture max level is available or not. */
 	bool textureMaxLevelSupported;
 
+	/** Texture lookup result precision. */
+	unsigned int textureLookupPrecision;
+
 private:
 	/**
 	 * Returns the native GLSL version supported by the driver.




More information about the Scummvm-git-logs mailing list