Fix #131227: OpenGL: Sequence editor crash on legacy Intel platforms
There seems to be an issue inside Intel OpenGL driver of legacy platforms that fails to link `gpu_shader_sequencer_strips`. Uniform locations are used to fix an specialization constants issue. This PR only adds the uniform location when the shader can be specialized. It is unclear what is actually failing inside the driver but there are other issues with the driver. Pull Request: https://projects.blender.org/blender/blender/pulls/131293
This commit is contained in:
@@ -600,13 +600,16 @@ std::string GLShader::resources_declare(const ShaderCreateInfo &info) const
|
||||
ss << "\n/* Push Constants. */\n";
|
||||
int location = 0;
|
||||
for (const ShaderCreateInfo::PushConst &uniform : info.push_constants_) {
|
||||
ss << "layout( location = " << location << ") ";
|
||||
/* See #131227: Work around legacy Intel bug when using layout locations. */
|
||||
if (!info.specialization_constants_.is_empty()) {
|
||||
ss << "layout(location = " << location << ") ";
|
||||
location += std::max(1, uniform.array_size);
|
||||
}
|
||||
ss << "uniform " << to_string(uniform.type) << " " << uniform.name;
|
||||
if (uniform.array_size > 0) {
|
||||
ss << "[" << uniform.array_size << "]";
|
||||
}
|
||||
ss << ";\n";
|
||||
location += std::max(1, uniform.array_size);
|
||||
}
|
||||
#if 0 /* #95278: This is not be enough to prevent some compilers think it is recursive. */
|
||||
for (const ShaderCreateInfo::PushConst &uniform : info.push_constants_) {
|
||||
|
||||
Reference in New Issue
Block a user