From 45554a957a71c0bb04388bf2c9389956e1b84bb1 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 7 Mar 2023 11:38:36 -0500 Subject: [PATCH] agx: Lower discard late Fixes regression with Dolphin's ubershaders. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 83e13f8..151d80f 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -2317,7 +2317,6 @@ agx_preprocess_nir(nir_shader *nir, bool support_lod_bias) NIR_PASS_V(nir, nir_lower_ssbo); if (nir->info.stage == MESA_SHADER_FRAGMENT) { NIR_PASS_V(nir, agx_nir_lower_frag_sidefx); - NIR_PASS_V(nir, agx_nir_lower_zs_emit); /* Interpolate varyings at fp16 and write to the tilebuffer at fp16. As an * exception, interpolate flat shaded at fp32. This works around a @@ -2406,6 +2405,11 @@ agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key, out->depth_layout = layout; } + /* Late clip plane lowering created discards */ + if (nir->info.stage == MESA_SHADER_FRAGMENT) { + NIR_PASS_V(nir, agx_nir_lower_zs_emit); + } + /* Late sysval lowering creates large loads. Load lowering creates unpacks */ NIR_PASS_V(nir, nir_lower_mem_access_bit_sizes, nir_var_mem_ssbo | nir_var_mem_constant | -- 2.7.4