From ed6499db6b41ce3261143fdac9b59dbd8b9dd45d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Tue, 16 Jul 2024 14:01:41 +0200 Subject: [PATCH] ac/nir/esgs: Don't emit ES outputs that aren't read by GS. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is necessary to prevent a regression from a future commit, in order to allow us to map output locations differently. Signed-off-by: Timur Kristóf Reviewed-by: Alyssa Rosenzweig Reviewed-by: Marek Olšák Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/common/ac_nir_lower_esgs_io_to_mem.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/amd/common/ac_nir_lower_esgs_io_to_mem.c b/src/amd/common/ac_nir_lower_esgs_io_to_mem.c index 28fc30e67e6..63224c671a8 100644 --- a/src/amd/common/ac_nir_lower_esgs_io_to_mem.c +++ b/src/amd/common/ac_nir_lower_esgs_io_to_mem.c @@ -150,6 +150,13 @@ lower_es_output_store(nir_builder *b, } lower_esgs_io_state *st = (lower_esgs_io_state *) state; + + /* When an ES output isn't read by GS, don't emit anything. */ + if ((io_sem.no_varying || !(st->gs_inputs_read & BITFIELD64_BIT(io_sem.location)))) { + nir_instr_remove(&intrin->instr); + return true; + } + const unsigned write_mask = nir_intrinsic_write_mask(intrin); b->cursor = nir_before_instr(&intrin->instr);