Uniform arrays are subject to beeing shrunk if higher members were not accessed. Update the max_array_access flag so array members that were only accessed in the function are not optimized away.
This fixes Piglit test spec/glsl-1.10/execution/samplers/in-parameter-array.shader_test. Signed-off-by: Fabian Bieler <[email protected]> --- src/glsl/ast_function.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 00e0c05..9378894 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -322,6 +322,18 @@ generate_call(exec_list *instructions, ir_function_signature *sig, assert (!"Illegal formal parameter mode"); break; } + } else if (formal->type->is_array()) { + /* Update the max_array_access field for array parameters. + * If the max_array_access of the formal parameter is zero, chances + * are we haven't parsed the function yet. Just set the array access + * to the whole array in that case. + */ + const unsigned max_array_access = (formal->max_array_access != 0) + ? formal->max_array_access : (formal->type->array_size() - 1); + ir_variable *var = actual->whole_variable_referenced(); + if (var) + var->max_array_access = + MAX2(var->max_array_access, max_array_access); } actual_iter.next(); -- 1.8.1.2 _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
