From 51e2b3103971ff4ed83f5553e5de626b220355d0 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Tue, 29 Sep 2020 12:02:41 +0200 Subject: [PATCH] nir: Handle per-view io in nir_io_add_const_offset_to_base() This isn't strictly necessary for freedreno, since we aren't using it yet, but I wanted to avoid any problems if we do. If we wanted to handle this "properly", and handle matrix and array per-view variables, we'd probably want to encode the "view stride" (number of views per user location) and base view in the intrinsic, but for now we just don't do any offsetting and assume the indirect offset is the view. Reviewed-by: Caio Marcelo de Oliveira Filho Part-of: --- src/compiler/nir/nir_lower_io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index 16020c2ae62..9fb49c1b466 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -2260,7 +2260,9 @@ add_const_offset_to_base_block(nir_block *block, nir_builder *b, ((modes & nir_var_shader_out) && is_output(intrin))) { nir_src *offset = nir_get_io_offset_src(intrin); - if (nir_src_is_const(*offset)) { + /* TODO: Better handling of per-view variables here */ + if (nir_src_is_const(*offset) && + !nir_intrinsic_io_semantics(intrin).per_view) { unsigned off = nir_src_as_uint(*offset); nir_intrinsic_set_base(intrin, nir_intrinsic_base(intrin) + off);