summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shader_query.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/shader_query.cpp')
-rw-r--r--src/mesa/main/shader_query.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index ed0c89fda17..f1ab4904450 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -1308,8 +1308,15 @@ _mesa_program_resource_prop(struct gl_shader_program *shProg,
switch (res->Type) {
case GL_UNIFORM:
case GL_BUFFER_VARIABLE:
+ /* Test if a buffer variable is an array or an unsized array.
+ * Unsized arrays return zero as array size.
+ */
+ if (RESOURCE_UNI(res)->is_shader_storage &&
+ RESOURCE_UNI(res)->array_stride > 0)
+ *val = RESOURCE_UNI(res)->array_elements;
+ else
*val = MAX2(RESOURCE_UNI(res)->array_elements, 1);
- return 1;
+ return 1;
case GL_PROGRAM_INPUT:
case GL_PROGRAM_OUTPUT:
*val = MAX2(_mesa_program_resource_array_size(res), 1);