[Mesa-dev] [PATCH] main: fix length of values written to glGetProgramResourceiv() for ACTIVE_VARIABLES
Samuel Iglesias Gonsalvez
siglesias at igalia.com
Tue Oct 6 01:08:42 PDT 2015
Return the number of values written.
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
---
src/mesa/main/shader_query.cpp | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 17076b8..1dbe319 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -1186,7 +1186,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 =
@@ -1196,8 +1197,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) {
@@ -1219,7 +1222,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 =
@@ -1229,8 +1233,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) {
--
2.1.4
More information about the mesa-dev
mailing list