summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-05-17 13:07:40 +1000
committerDave Airlie <airlied@redhat.com>2016-05-23 16:19:57 +1000
commitc714731653fb40d4e20cdfc98c3a200e836e2a21 (patch)
tree68592cf22893224da223cf7c4b0cb37731aec7a3 /src/compiler/glsl/ast_to_hir.cpp
parent432ac19c1ad34f32bdcfe6ec7823383ee24eb016 (diff)
downloadexternal_mesa3d-c714731653fb40d4e20cdfc98c3a200e836e2a21.zip
external_mesa3d-c714731653fb40d4e20cdfc98c3a200e836e2a21.tar.gz
external_mesa3d-c714731653fb40d4e20cdfc98c3a200e836e2a21.tar.bz2
glsl: fix subroutine uniform .length().
This fixes .length() on subroutine uniform arrays, if we don't find the identifier normally, we look up the corresponding subroutine identifier instead. Fixes: GL45-CTS.shader_subroutine.arrays_of_arrays_of_uniforms GL45-CTS.shader_subroutine.arrayed_subroutine_uniforms Reviewed-by: Chris Forbes <chrisforbes@google.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/compiler/glsl/ast_to_hir.cpp')
-rw-r--r--src/compiler/glsl/ast_to_hir.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 434734d..ecd1327 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -1917,6 +1917,14 @@ ast_expression::do_hir(exec_list *instructions,
ir_variable *var =
state->symbols->get_variable(this->primary_expression.identifier);
+ if (var == NULL) {
+ /* the identifier might be a subroutine name */
+ char *sub_name;
+ sub_name = ralloc_asprintf(ctx, "%s_%s", _mesa_shader_stage_to_subroutine_prefix(state->stage), this->primary_expression.identifier);
+ var = state->symbols->get_variable(sub_name);
+ ralloc_free(sub_name);
+ }
+
if (var != NULL) {
var->data.used = true;
result = new(ctx) ir_dereference_variable(var);