If we have constant initialisers up until this point, collapse things and set the array size to 1.
This fixes tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-const-index.shader_test Signed-off-by: Dave Airlie <[email protected]> --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index b4b9dae..f087220 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3498,8 +3498,9 @@ glsl_to_tgsi_visitor::calc_deref_offsets(ir_dereference *head, *index += array_index->value.u[0] * *array_elements; /* if this is just a constant 1D array deref - adjust base and return 1 array elements */ - if (array_index && deref_arr->array->ir_type == ir_type_dereference_variable && head == tail) { + if (array_index && deref_arr->array->ir_type == ir_type_dereference_variable && indirect->file == PROGRAM_UNDEFINED) { *base = *index; + *array_elements = 1; } else { *array_elements *= deref_arr->array->type->length; } -- 2.5.0 _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
