Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-01-29 01:28:53 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-01-29 01:28:53 +0300
commit0a8fa07735cdb89081b652c032c73863e34f8ff1 (patch)
tree8ac8434b6d42145808581ce0202e21b5b5d1fa6b /source/blender
parentcb09485ff2bd7a4931bff0d4bf951b663aafd000 (diff)
Fix T95278: Crash on startup because of GLSL compiler bug
The GLSL defines used to make the uniform names unusable for local variable is being interpreted as recursive on some implementation. This avoids it by create a second macro avoiding the recursion.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/gpu/opengl/gl_shader.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc
index 6f39d69e6ff..79182ea05e6 100644
--- a/source/blender/gpu/opengl/gl_shader.cc
+++ b/source/blender/gpu/opengl/gl_shader.cc
@@ -416,7 +416,9 @@ std::string GLShader::resources_declare(const ShaderCreateInfo &info) const
ss << ";\n";
}
for (const ShaderCreateInfo::PushConst &uniform : info.push_constants_) {
- ss << "#define " << uniform.name << " (" << uniform.name << ")\n";
+ /* T95278: Double macro to avoid some compilers think it is recusive. */
+ ss << "#define " << uniform.name << "_ " << uniform.name << "\n";
+ ss << "#define " << uniform.name << " (" << uniform.name << _ ")\n";
}
ss << "\n";
return ss.str();