mesa/src/asahi/compiler
Alyssa Rosenzweig 398851ca53 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>
2023-06-07 03:21:49 +00:00
..
test asahi: Reformat using the new style 2023-05-29 21:06:12 +00:00
agx_builder.h.py asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_compile.c agx: Lower discard in NIR 2023-06-07 03:21:49 +00:00
agx_compile.h agx: Lower discard in NIR 2023-06-07 03:21:49 +00:00
agx_compiler.h agx: Lower discard in NIR 2023-06-07 03:21:49 +00:00
agx_dce.c asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_debug.h asahi: Fix disk cache disable with AGX_MESA_DEBUG 2023-05-07 09:00:40 -04:00
agx_insert_waits.c agx: Don't wait at the end of the shader 2023-05-07 09:05:39 -04:00
agx_internal_formats.h agx: Add agx_internal_format_supports_mask helper 2023-02-21 08:10:15 +00:00
agx_ir.c agx: Factor out allows_16bit_immediate check 2023-03-05 09:27:02 +00:00
agx_liveness.c asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_lower_64bit.c asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_lower_parallel_copy.c asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_lower_pseudo.c asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_lower_uniform_sources.c agx: Model both sources of sample_mask 2023-06-07 03:21:49 +00:00
agx_minifloat.h asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_nir.h agx: Optimize multiplies 2023-05-11 09:23:23 -04:00
agx_nir_algebraic.py agx: Optimize multiplies 2023-05-11 09:23:23 -04:00
agx_nir_lower_address.c agx/lower_address: Match multiplies, not only shifts 2023-05-07 09:10:36 -04:00
agx_nir_lower_discard_zs_emit.c agx: Lower discard in NIR 2023-06-07 03:21:49 +00:00
agx_nir_lower_frag_sidefx.c agx: Fix clang-formatting 2023-03-10 06:33:01 +00:00
agx_nir_lower_load_mask.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
agx_nir_lower_sample_mask.c agx: Lower discard in NIR 2023-06-07 03:21:49 +00:00
agx_nir_lower_shared_bitsize.c agx: Lower legacy atomics sooner 2023-05-16 22:36:21 +00:00
agx_nir_lower_texture.c nir: Drop unused name from nir_ssa_dest_init 2023-05-17 23:46:16 +00:00
agx_nir_lower_ubo.c agx: Use load_global_constant for UBO lowering 2023-01-11 20:36:51 +00:00
agx_nir_opt_preamble.c asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_opcodes.c.py asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_opcodes.h.py asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_opcodes.py agx: Plumb in nir_intrinsic_load_sample_mask_in 2023-06-07 03:21:49 +00:00
agx_opt_cse.c asahi: fix a few typos 2023-03-17 22:11:33 +00:00
agx_optimizer.c agx: Fix abs/neg propagation into fcmpsel 2023-05-07 09:00:56 -04:00
agx_pack.c agx: Model both sources of sample_mask 2023-06-07 03:21:49 +00:00
agx_performance.c agx: Add helper for calculating occupancy 2023-04-07 03:23:03 +00:00
agx_print.c asahi: Convert to SPDX headers 2023-03-28 05:14:00 +00:00
agx_register_allocate.c agx: Rework z/s emit 2023-05-07 09:10:36 -04:00
agx_validate.c agx: Validate that collect sources are the same size 2023-05-07 09:10:36 -04:00
meson.build agx: Lower discard in NIR 2023-06-07 03:21:49 +00:00