From 0d80aed363c3d8d149b6ad8323374a8e19b50be6 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 2 Mar 2022 11:33:03 -0500 Subject: [PATCH] nir/gather_info: check copy_deref instrs for writing outputs this is a valid way to write an output even though it usually gets rewritten to some other instruction later on Reviewed-by: Ilia Mirkin Part-of: --- src/compiler/nir/nir_gather_info.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index 7a366adcfd5..847aa1e697b 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -196,6 +196,10 @@ get_io_offset(nir_deref_instr *deref, nir_variable *var, bool is_arrayed, bool skip_non_arrayed) { if (var->data.compact) { + if (deref->deref_type == nir_deref_type_var) { + assert(glsl_type_is_array(var->type)); + return 0; + } assert(deref->deref_type == nir_deref_type_array); return nir_src_is_const(deref->arr.index) ? (nir_src_as_uint(deref->arr.index) + var->data.location_frac) / 4u : @@ -491,7 +495,8 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader, case nir_intrinsic_interp_deref_at_offset: case nir_intrinsic_interp_deref_at_vertex: case nir_intrinsic_load_deref: - case nir_intrinsic_store_deref:{ + case nir_intrinsic_store_deref: + case nir_intrinsic_copy_deref:{ nir_deref_instr *deref = nir_src_as_deref(instr->src[0]); if (nir_deref_mode_is_one_of(deref, nir_var_shader_in | nir_var_shader_out)) {