summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shader_query.cpp
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsalvez <[email protected]>2015-10-01 15:05:00 +0200
committerSamuel Iglesias Gonsalvez <[email protected]>2015-10-09 08:13:55 +0200
commit66ca8e6632b2623425f848b9efc16edbed56f306 (patch)
treebb2f437a113682d3535cd9f6114624549d5619bd /src/mesa/main/shader_query.cpp
parent77c0b64ce335c7013de5da3b9ac497cb400ef8ce (diff)
main: consider that unsized arrays have at least one active element
From ARB_shader_storage_buffer_object: "When using the ARB_program_interface_query extension to enumerate the set of active buffer variables, only the first element of arrays (sized or unsized) will be enumerated" _mesa_program_resource_array_size() is used when getting the name (and name length) of the active variables. When it is an unsized array, we want to indicate it has one active element so the returned name would have "[0]" at the end. v2: - Use array_stride > 0 and array_elements == 0 to detect unsized arrays. Because of that, we don't need is_unsized_array flag (Timothy) Signed-off-by: Samuel Iglesias Gonsalvez <[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.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index a1db4c23acc..ed0c89fda17 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -485,8 +485,14 @@ _mesa_program_resource_array_size(struct gl_program_resource *res)
case GL_COMPUTE_SUBROUTINE_UNIFORM:
case GL_TESS_CONTROL_SUBROUTINE_UNIFORM:
case GL_TESS_EVALUATION_SUBROUTINE_UNIFORM:
- case GL_BUFFER_VARIABLE:
return RESOURCE_UNI(res)->array_elements;
+ case GL_BUFFER_VARIABLE:
+ /* Unsized arrays */
+ if (RESOURCE_UNI(res)->array_stride > 0 &&
+ RESOURCE_UNI(res)->array_elements == 0)
+ return 1;
+ else
+ return RESOURCE_UNI(res)->array_elements;
case GL_VERTEX_SUBROUTINE:
case GL_GEOMETRY_SUBROUTINE:
case GL_FRAGMENT_SUBROUTINE: