GPUShaderInterface: Add Builtin Uniform blocks query

This makes the query of theses mandatory uniforms faster.
This commit is contained in:
2020-06-04 13:43:28 +02:00
parent 1438c1cfd5
commit 7534bbfa34
5 changed files with 55 additions and 21 deletions

View File

@@ -736,7 +736,14 @@ int GPU_shader_get_builtin_uniform(GPUShader *shader, int builtin)
{
BLI_assert(shader && shader->program);
const GPUShaderInput *uniform = GPU_shaderinterface_uniform_builtin(shader->interface, builtin);
return uniform ? uniform->location : -1;
return uniform->location;
}
int GPU_shader_get_builtin_block(GPUShader *shader, int builtin)
{
BLI_assert(shader && shader->program);
const GPUShaderInput *uniform = GPU_shaderinterface_block_builtin(shader->interface, builtin);
return uniform->binding;
}
int GPU_shader_get_uniform_block(GPUShader *shader, const char *name)