From: Caio Marcelo de Oliveira Filho Date: Fri, 22 Mar 2019 03:37:12 +0000 (-0700) Subject: nir: Handle array-deref-of-vector case in loop analysis X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e5830e11322bc20cbae7cad9e0654376d41f2c19;p=mesa.git nir: Handle array-deref-of-vector case in loop analysis SPIR-V can produce those for SSBO and UBO access. Found when testing the ARB_gl_spirv series. Reviewed-by: Timothy Arceri --- diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c index cb71a55f2f1..781dac27bb7 100644 --- a/src/compiler/nir/nir_loop_analyze.c +++ b/src/compiler/nir/nir_loop_analyze.c @@ -480,9 +480,12 @@ find_array_access_via_induction(loop_info_state *state, *array_index_out = array_index; nir_deref_instr *parent = nir_deref_instr_parent(d); - assert(glsl_type_is_array_or_matrix(parent->type)); - - return glsl_get_length(parent->type); + if (glsl_type_is_array_or_matrix(parent->type)) { + return glsl_get_length(parent->type); + } else { + assert(glsl_type_is_vector(parent->type)); + return glsl_get_vector_elements(parent->type); + } } return 0;