diff options
author | marha <marha@users.sourceforge.net> | 2013-09-06 12:06:57 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-09-06 12:06:57 +0200 |
commit | 2414a1de3cc17f438219f8f2a58b530d33e99a5e (patch) | |
tree | a7d7ca359bf84115689b071d30dfae0887efc057 /mesalib/src/glsl/link_functions.cpp | |
parent | b828531d8b6da75a258d12f97df0f4e49f75ab98 (diff) | |
download | vcxsrv-2414a1de3cc17f438219f8f2a58b530d33e99a5e.tar.gz vcxsrv-2414a1de3cc17f438219f8f2a58b530d33e99a5e.tar.bz2 vcxsrv-2414a1de3cc17f438219f8f2a58b530d33e99a5e.zip |
mesa pixman xserver xkeyboard-config
xserver commit 6f89ae3e64c4dfeea508813e546c10ba1da3ea8e
xkeyboard-config commit c2309b50e7ef7b9263278fd8ff73dda1484d72db
pixman commit 8ad63f90cd8392a40f115c56b16c54d45012070e
mesa commit 505fad04f10eee1efdfcd8986b4d484b49d39986
Diffstat (limited to 'mesalib/src/glsl/link_functions.cpp')
-rw-r--r-- | mesalib/src/glsl/link_functions.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mesalib/src/glsl/link_functions.cpp b/mesalib/src/glsl/link_functions.cpp index 6b3e15448..dd6f24716 100644 --- a/mesalib/src/glsl/link_functions.cpp +++ b/mesalib/src/glsl/link_functions.cpp @@ -173,6 +173,38 @@ public: return visit_continue; } + virtual ir_visitor_status visit_leave(ir_call *ir) + { + /* Traverse list of function parameters, and for array parameters + * propagate max_array_access. Otherwise arrays that are only referenced + * from inside functions via function parameters will be incorrectly + * optimized. This will lead to incorrect code being generated (or worse). + * Do it when leaving the node so the children would propagate their + * array accesses first. + */ + + const exec_node *formal_param_node = ir->callee->parameters.get_head(); + if (formal_param_node) { + const exec_node *actual_param_node = ir->actual_parameters.get_head(); + while (!actual_param_node->is_tail_sentinel()) { + ir_variable *formal_param = (ir_variable *) formal_param_node; + ir_rvalue *actual_param = (ir_rvalue *) actual_param_node; + + formal_param_node = formal_param_node->get_next(); + actual_param_node = actual_param_node->get_next(); + + if (formal_param->type->is_array()) { + ir_dereference_variable *deref = actual_param->as_dereference_variable(); + if (deref && deref->var && deref->var->type->is_array()) { + deref->var->max_array_access = + MAX2(formal_param->max_array_access, deref->var->max_array_access); + } + } + } + } + return visit_continue; + } + virtual ir_visitor_status visit(ir_dereference_variable *ir) { if (hash_table_find(locals, ir->var) == NULL) { |