From c24b7533781e6c75135230ea717ee2596bb93f14 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 26 Jun 2023 12:54:58 -0400 Subject: [PATCH] nir/lower_blend: Optimize masked out RTs While debugging KHR-GLES31.core.draw_buffers_indexed.color_masks, the noise from piles of store_output(load_output) instructions got in the way. Optimize it out. This does not fix the test, but if this case ever happened in a real app it would improve performance. This is only load bearing on Asahi (and PanVK?), since Panfrost wouldn't call nir_lower_blend at all in this case. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_lower_blend.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/nir/nir_lower_blend.c b/src/compiler/nir/nir_lower_blend.c index bfbf985fa2e..8cb17546841 100644 --- a/src/compiler/nir/nir_lower_blend.c +++ b/src/compiler/nir/nir_lower_blend.c @@ -515,6 +515,12 @@ nir_lower_blend_instr(nir_builder *b, nir_instr *instr, void *data) */ b->cursor = nir_after_block(instr->block); + /* Don't bother copying the destination to the source for disabled RTs */ + if (options->rt[rt].colormask == 0) { + nir_instr_remove(instr); + return true; + } + /* Grab the input color. We always want 4 channels during blend. Dead * code will clean up any channels we don't need. */