summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shader_query.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <timothy.arceri@collabora.com>2015-11-09 09:34:40 +1100
committerTimothy Arceri <t_arceri@yahoo.com.au>2015-11-21 07:30:12 +1100
commitf7af69c350977f03c6648bdb0b21851933cb98ad (patch)
treec25f69ed79f3463aa3f7fe78b570d1fa0ec8e86e /src/mesa/main/shader_query.cpp
parent02d2ab23786a0f4ef635914801da97faf577197a (diff)
downloadexternal_mesa3d-f7af69c350977f03c6648bdb0b21851933cb98ad.zip
external_mesa3d-f7af69c350977f03c6648bdb0b21851933cb98ad.tar.gz
external_mesa3d-f7af69c350977f03c6648bdb0b21851933cb98ad.tar.bz2
glsl: add subroutine index qualifier support
ARB_explicit_uniform_location allows the index for subroutine functions to be explicitly set in the shader. This patch reduces the restriction on the index qualifier in validate_layout_qualifiers() to allow it to be applied to subroutines and adds the new subroutine qualifier validation to ast_function::hir(). ast_fully_specified_type::has_qualifiers() is updated to allow the index qualifier on subroutine functions when explicit uniform locations is available. A new check is added to ast_type_qualifier::merge_qualifier() to stop multiple function qualifiers from being defied, before this patch this would cause a segfault. Finally a new variable is added to ir_function_signature to store the index. This value is validated and the non explicit values assigned in link_assign_subroutine_types(). Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Diffstat (limited to 'src/mesa/main/shader_query.cpp')
-rw-r--r--src/mesa/main/shader_query.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 14f849e..79a91b5 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -661,6 +661,13 @@ _mesa_program_resource_index(struct gl_shader_program *shProg,
switch (res->Type) {
case GL_ATOMIC_COUNTER_BUFFER:
return RESOURCE_ATC(res) - shProg->AtomicBuffers;
+ case GL_VERTEX_SUBROUTINE:
+ case GL_GEOMETRY_SUBROUTINE:
+ case GL_FRAGMENT_SUBROUTINE:
+ case GL_COMPUTE_SUBROUTINE:
+ case GL_TESS_CONTROL_SUBROUTINE:
+ case GL_TESS_EVALUATION_SUBROUTINE:
+ return RESOURCE_SUB(res)->index;
case GL_UNIFORM_BLOCK:
case GL_SHADER_STORAGE_BLOCK:
case GL_TRANSFORM_FEEDBACK_VARYING: