[Scummvm-git-logs] scummvm master -> 3112fad5fa9d9676e18a894494f05bf20957d51a

sev- noreply at scummvm.org
Sun Apr 27 12:49:35 UTC 2025


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

Summary:
3112fad5fa BACKENDS: OPENGL: Fix CLUT shader lookup


Commit: 3112fad5fa9d9676e18a894494f05bf20957d51a
    https://github.com/scummvm/scummvm/commit/3112fad5fa9d9676e18a894494f05bf20957d51a
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-04-27T20:49:32+08:00

Commit Message:
BACKENDS: OPENGL: Fix CLUT shader lookup

This should fix Trac#15860.

The current code only uses a linear scaling to look at the palette
texture.
This means that lookup coordinate is on the form (when stretched to
texture size):
0.0, 1.00196, 2.00392 ... 253.49607, 254.49803, 255.5

With the newer code it will be on the form:
0.5, 1.5, 2.5, ... 253.5, 254.5, 255.5

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


diff --git a/backends/graphics/opengl/shader.cpp b/backends/graphics/opengl/shader.cpp
index 0cee3a737cd..2f2c91be632 100644
--- a/backends/graphics/opengl/shader.cpp
+++ b/backends/graphics/opengl/shader.cpp
@@ -71,11 +71,12 @@ const char *const g_lookUpFragmentShader =
 	"uniform sampler2D shaderTexture;\n"
 	"uniform sampler2D palette;\n"
 	"\n"
-	"const float adjustFactor = 255.0 / 256.0 + 1.0 / (2.0 * 256.0);"
+	"const float scaleFactor = 255.0 / 256.0;\n"
+	"const float offsetFactor = 1.0 / (2.0 * 256.0);\n"
 	"\n"
 	"void main(void) {\n"
 	"\tvec4 index = texture2D(shaderTexture, texCoord);\n"
-	"\tgl_FragColor = blendColor * texture2D(palette, vec2(index.a * adjustFactor, 0.0));\n"
+	"\tgl_FragColor = blendColor * texture2D(palette, vec2(index.a * scaleFactor + offsetFactor, 0.0));\n"
 	"}\n";
 
 } // End of anonymous namespace




More information about the Scummvm-git-logs mailing list