summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/shader_query.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index b5f1d082c3e..14280582c78 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -860,13 +860,23 @@ get_buffer_property(struct gl_shader_program *shProg,
*val = RESOURCE_UBO(res)->UniformBufferSize;
return 1;
case GL_NUM_ACTIVE_VARIABLES:
- *val = RESOURCE_UBO(res)->NumUniforms;
+ *val = 0;
+ for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
+ const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName;
+ struct gl_program_resource *uni =
+ _mesa_program_resource_find_name(shProg, GL_UNIFORM, iname);
+ if (!uni)
+ continue;
+ (*val)++;
+ }
return 1;
case GL_ACTIVE_VARIABLES:
for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName;
struct gl_program_resource *uni =
_mesa_program_resource_find_name(shProg, GL_UNIFORM, iname);
+ if (!uni)
+ continue;
*val++ =
_mesa_program_resource_index(shProg, uni);
}