[Scummvm-git-logs] scummvm master -> d379af1fc0cf23479b23bcb9adc391da6fed1dac
lephilousophe
noreply at scummvm.org
Sat Oct 8 23:34:21 UTC 2022
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:
131acc39ea BACKENDS: OPENGL: Add compatibility shims when needed
d379af1fc0 BACKENDS: OPENGL: Properly remove comments
Commit: 131acc39ea0465eea165d39f2819adb8bc2268d9
https://github.com/scummvm/scummvm/commit/131acc39ea0465eea165d39f2819adb8bc2268d9
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2022-10-09T01:32:54+02:00
Commit Message:
BACKENDS: OPENGL: Add compatibility shims when needed
Changed paths:
backends/graphics/opengl/pipelines/libretro.cpp
diff --git a/backends/graphics/opengl/pipelines/libretro.cpp b/backends/graphics/opengl/pipelines/libretro.cpp
index ddb992ad09a..b5aff56c65b 100644
--- a/backends/graphics/opengl/pipelines/libretro.cpp
+++ b/backends/graphics/opengl/pipelines/libretro.cpp
@@ -77,10 +77,39 @@ static const ImageLoader s_imageLoaders[] = {
{ nullptr, nullptr }
};
-const char *const g_libretroShaderAttributes[] = {
+static const char *const g_libretroShaderAttributes[] = {
"VertexCoord", nullptr
};
+// some libretro shaders use texture without checking version
+static const char *g_compatVertex =
+ "#if defined(GL_ES)\n"
+ "#if !defined(HAS_ROUND)\n"
+ "#define round(x) (sign(x) * floor(abs(x) + .5))\n"
+ "#endif\n"
+ "#elif __VERSION__ < 130\n"
+ "#if !defined(HAS_ROUND)\n"
+ "#define round(x) (sign(x) * floor(abs(x) + .5))\n"
+ "#endif\n"
+ "#endif\n";
+
+static const char *g_compatFragment =
+ "#if defined(GL_ES)\n"
+ "#if !defined(HAS_ROUND)\n"
+ "#define round(x) (sign(x) * floor(abs(x) + .5))\n"
+ "#endif\n"
+ "#if !defined(HAS_TEXTURE)\n"
+ "#define texture texture2D\n"
+ "#endif\n"
+ "#elif __VERSION__ < 130\n"
+ "#if !defined(HAS_ROUND)\n"
+ "#define round(x) (sign(x) * floor(abs(x) + .5))\n"
+ "#endif\n"
+ "#if !defined(HAS_TEXTURE)\n"
+ "#define texture texture2D\n"
+ "#endif\n"
+ "#endif\n";
+
LibRetroPipeline::LibRetroPipeline()
: ShaderPipeline(ShaderMan.query(ShaderManager::kDefault)),
_shaderPreset(nullptr), _applyProjectionChanges(false),
@@ -289,6 +318,16 @@ bool LibRetroPipeline::loadPasses() {
UniformsMap uniformParams;
stripShaderParameters(shaderFileStart, uniformParams);
+ Common::String shimsDetected;
+ if (strstr(shaderFileStart, "#define texture(")) {
+ shimsDetected += "#define HAS_TEXTURE\n";
+ } else if (strstr(shaderFileStart, "#define texture ")) {
+ shimsDetected += "#define HAS_TEXTURE\n";
+ }
+ if (strstr(shaderFileStart, "#define round(")) {
+ shimsDetected += "#define HAS_ROUND\n";
+ }
+
// TODO: Handle alias defines
Shader *shader = new Shader;
@@ -296,12 +335,16 @@ bool LibRetroPipeline::loadPasses() {
const char *const vertexSources[] = {
version,
"#define VERTEX\n#define PARAMETER_UNIFORM\n",
+ shimsDetected.c_str(),
+ g_compatVertex,
// TODO: alias defines
shaderFileStart,
};
const char *const fragmentSources[] = {
version,
"#define FRAGMENT\n#define PARAMETER_UNIFORM\n",
+ shimsDetected.c_str(),
+ g_compatFragment,
// TODO: alias defines
shaderFileStart,
};
Commit: d379af1fc0cf23479b23bcb9adc391da6fed1dac
https://github.com/scummvm/scummvm/commit/d379af1fc0cf23479b23bcb9adc391da6fed1dac
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2022-10-09T01:32:54+02:00
Commit Message:
BACKENDS: OPENGL: Properly remove comments
Before that comments at the end of a line were not stripped
Changed paths:
backends/graphics/opengl/pipelines/libretro/parser.cpp
diff --git a/backends/graphics/opengl/pipelines/libretro/parser.cpp b/backends/graphics/opengl/pipelines/libretro/parser.cpp
index 845bf69d9da..447ccdd520c 100644
--- a/backends/graphics/opengl/pipelines/libretro/parser.cpp
+++ b/backends/graphics/opengl/pipelines/libretro/parser.cpp
@@ -109,15 +109,18 @@ bool PresetParser::parsePreset(Common::SeekableReadStream &stream) {
return false;
}
+ size_t sharpPos = line.findFirstOf('#');
+ if (sharpPos != line.npos) {
+ // Remove the end of line
+ line.erase(sharpPos);
+ }
+
if (line.empty()) {
continue;
}
bool empty = true;
for (uint i = 0; i < line.size(); i++) {
- if (line[i] == '#')
- break;
-
if (!Common::isSpace(line[i])) {
empty = false;
break;
More information about the Scummvm-git-logs
mailing list