agx: Lower discard in NIR
We already lower discard in NIR when depth/stencil writes are used in the shader. In this patch, we extend that lowering for when depth/stencil writes are not used, in which case the discard is lowered to a sample_mask instruction. This is a step towards multisampling, since the old lowering assumed single-sample and there's no way to express a sample mask with a standard NIR discard instructions so we need to lower in NIR anyway for sample shading (i.e. if a discard_if diverges between samples in a pixel). This changes the lowering for discard_if to be free of control flow (instead executing a sample mask instruction unconditionally). This seems to be slightly faster in SuperTuxKart and slightly slower in Dolphin, but I'm not too worried right now. To make this work, we do need some extra lowering to ensure we always execute a sample_mask instruction, in case a discard_if is buried in other control flow (as occurs with Dolphin's ubershaders). So that's added too. We need that for MSAA anyway, so pardon the line count. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
This commit is contained in:

committed by
Marge Bot

parent
989d6fd378
commit
398851ca53
@@ -379,7 +379,7 @@ typedef struct {
|
||||
unsigned alloc;
|
||||
|
||||
/* I don't really understand how writeout ops work yet */
|
||||
bool did_writeout, did_sample_mask;
|
||||
bool did_writeout;
|
||||
|
||||
/* Has r0l been zeroed yet due to control flow? */
|
||||
bool any_cf;
|
||||
@@ -793,7 +793,8 @@ void agx_emit_parallel_copies(agx_builder *b, struct agx_copy *copies,
|
||||
void agx_compute_liveness(agx_context *ctx);
|
||||
void agx_liveness_ins_update(BITSET_WORD *live, agx_instr *I);
|
||||
|
||||
bool agx_nir_lower_zs_emit(nir_shader *s);
|
||||
bool agx_nir_lower_discard_zs_emit(nir_shader *s);
|
||||
bool agx_nir_lower_sample_mask(nir_shader *s, unsigned nr_samples);
|
||||
bool agx_nir_lower_texture(nir_shader *s, bool support_lod_bias);
|
||||
bool agx_nir_opt_preamble(nir_shader *s, unsigned *preamble_size);
|
||||
bool agx_nir_lower_load_mask(nir_shader *shader);
|
||||
|
Reference in New Issue
Block a user