<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 23, 2016 at 12:52 PM, Dave Airlie <span dir="ltr"><<a href="mailto:airlied@gmail.com" target="_blank">airlied@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>
<br>
This fixes .length() on subroutine uniform arrays, if<br>
we don't find the identifier normally, we look up the corresponding<br>
subroutine identifier instead.<br>
<br>
Fixes:<br>
GL45-CTS.shader_subroutine.arrays_of_arrays_of_uniforms<br>
GL45-CTS.shader_subroutine.arrayed_subroutine_uniforms<br>
<br>
Signed-off-by: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>
---<br>
src/compiler/glsl/ast_to_hir.cpp | 8 ++++++++<br>
1 file changed, 8 insertions(+)<br>
<br>
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp<br>
index 434734d..ecd1327 100644<br>
--- a/src/compiler/glsl/ast_to_hir.cpp<br>
+++ b/src/compiler/glsl/ast_to_hir.cpp<br>
@@ -1917,6 +1917,14 @@ ast_expression::do_hir(exec_list *instructions,<br>
ir_variable *var =<br>
state->symbols->get_variable(this->primary_expression.identifier);<br>
<br>
+ if (var == NULL) {<br>
+ /* the identifier might be a subroutine name */<br></blockquote><div><br></div><div>Being pedantic, but `subroutine uniform name`, right?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ char *sub_name;<br>
+ sub_name = ralloc_asprintf(ctx, "%s_%s", _mesa_shader_stage_to_subroutine_prefix(state->stage), this->primary_expression.identifier);<br>
+ var = state->symbols->get_variable(sub_name);<br>
+ ralloc_free(sub_name);<br>
+ }<br>
+<br>
if (var != NULL) {<br>
var->data.used = true;<br>
result = new(ctx) ir_dereference_variable(var);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.5<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>