GPU: Fix Potential Error in Builtin Resolution.
When using ShaderCreateInfo with builtin uniform(blocks) there are cases where the current implementation could not find an existing block. The reason is that it uses name matching and name matching requires that the shader inputs are sorted based on the name hash. This change fixes this by first for the sorting of the shader inputs before resolving the builtins. Pull Request #105127
This commit is contained in:
@@ -529,6 +529,9 @@ GLShaderInterface::GLShaderInterface(GLuint program, const shader::ShaderCreateI
|
||||
}
|
||||
}
|
||||
|
||||
this->sort_inputs();
|
||||
|
||||
/* Resolving builtins must happen after the inputs have been sorted. */
|
||||
/* Builtin Uniforms */
|
||||
for (int32_t u_int = 0; u_int < GPU_NUM_UNIFORMS; u_int++) {
|
||||
GPUUniformBuiltin u = static_cast<GPUUniformBuiltin>(u_int);
|
||||
@@ -543,8 +546,6 @@ GLShaderInterface::GLShaderInterface(GLuint program, const shader::ShaderCreateI
|
||||
builtin_blocks_[u] = (block != nullptr) ? block->binding : -1;
|
||||
}
|
||||
|
||||
this->sort_inputs();
|
||||
|
||||
// this->debug_print();
|
||||
|
||||
glUseProgram(last_program);
|
||||
|
||||
Reference in New Issue
Block a user