summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shader_query.cpp
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsalvez <[email protected]>2015-10-05 13:14:26 +0200
committerSamuel Iglesias Gonsalvez <[email protected]>2015-10-09 08:13:55 +0200
commit3da58730eeb51d9490045260e4848ba14bf9bb65 (patch)
tree440d824a10435c2d04ca93ca8e0c9d4ceadb0039 /src/mesa/main/shader_query.cpp
parentd0992fa15a4bfaff59de50e6084a0a14882d3bdb (diff)
main: fix length of values written to glGetProgramResourceiv() for ACTIVE_VARIABLES
Return the number of values written. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main/shader_query.cpp')
-rw-r--r--src/mesa/main/shader_query.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index f1ab4904450..324e1a68fa4 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -1190,7 +1190,8 @@ get_buffer_property(struct gl_shader_program *shProg,
(*val)++;
}
return 1;
- case GL_ACTIVE_VARIABLES:
+ case GL_ACTIVE_VARIABLES: {
+ unsigned num_values = 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 =
@@ -1200,8 +1201,10 @@ get_buffer_property(struct gl_shader_program *shProg,
continue;
*val++ =
_mesa_program_resource_index(shProg, uni);
+ num_values++;
}
- return RESOURCE_UBO(res)->NumUniforms;
+ return num_values;
+ }
}
} else if (res->Type == GL_SHADER_STORAGE_BLOCK) {
switch (prop) {
@@ -1223,7 +1226,8 @@ get_buffer_property(struct gl_shader_program *shProg,
(*val)++;
}
return 1;
- case GL_ACTIVE_VARIABLES:
+ case GL_ACTIVE_VARIABLES: {
+ unsigned num_values = 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 =
@@ -1233,8 +1237,10 @@ get_buffer_property(struct gl_shader_program *shProg,
continue;
*val++ =
_mesa_program_resource_index(shProg, uni);
+ num_values++;
}
- return RESOURCE_UBO(res)->NumUniforms;
+ return num_values;
+ }
}
} else if (res->Type == GL_ATOMIC_COUNTER_BUFFER) {
switch (prop) {