From e5830e11322bc20cbae7cad9e0654376d41f2c19 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Thu, 21 Mar 2019 20:37:12 -0700 Subject: [PATCH] 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 --- src/compiler/nir/nir_loop_analyze.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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; -- 2.30.2