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.
This commit is contained in:
2022-01-28 23:28:53 +01:00
parent cb09485ff2
commit 0a8fa07735

View File

@@ -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();