[Scummvm-git-logs] scummvm branch-2-8 -> ac60a35a38b331a1cdb0d3684c1df71a0db9b4b7
lephilousophe
noreply at scummvm.org
Thu Dec 28 08:33:52 UTC 2023
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:
ac60a35a38 OPENGL: Fix GLSL version parsing
Commit: ac60a35a38b331a1cdb0d3684c1df71a0db9b4b7
https://github.com/scummvm/scummvm/commit/ac60a35a38b331a1cdb0d3684c1df71a0db9b4b7
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-12-28T09:33:26+01:00
Commit Message:
OPENGL: Fix GLSL version parsing
Some old GLES2 implementation did have a different version prefix.
Be more relax like almost everyone and look for the first digit to start
parsing.
Changed paths:
graphics/opengl/context.cpp
diff --git a/graphics/opengl/context.cpp b/graphics/opengl/context.cpp
index ae8105129c4..3597812611e 100644
--- a/graphics/opengl/context.cpp
+++ b/graphics/opengl/context.cpp
@@ -359,16 +359,20 @@ int Context::getGLSLVersion() const {
return 0;
}
- const char *glslVersionFormat;
- if (type == kContextGL) {
- glslVersionFormat = "%d.%d";
- } else {
- glslVersionFormat = "OpenGL ES GLSL ES %d.%d";
+ // Search for the first digit in the version string and parse from there
+ const char *glslVersionStringNum;
+ for (glslVersionStringNum = glslVersionString; *glslVersionStringNum != '\0'; glslVersionStringNum++) {
+ if (*glslVersionStringNum >= '0' &&
+ *glslVersionStringNum <= '9') {
+ break;
+ }
}
+ // Here *glslVersionStringNum is either a digit or a NUL character
+
int glslMajorVersion, glslMinorVersion;
- if (sscanf(glslVersionString, glslVersionFormat, &glslMajorVersion, &glslMinorVersion) != 2) {
- warning("Could not parse GLSL version '%s'", glslVersionString);
+ if (sscanf(glslVersionStringNum, "%d.%d", &glslMajorVersion, &glslMinorVersion) != 2) {
+ warning("Could not parse GLSL version '%s' extracted from '%s'", glslVersionStringNum, glslVersionString);
return 0;
}
More information about the Scummvm-git-logs
mailing list