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 <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23836>
This commit is contained in:
Alyssa Rosenzweig 2023-06-26 12:54:58 -04:00 committed by Marge Bot
parent d4424950ac
commit c24b753378

View file

@ -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.
*/