From 4a71355172d2ac153e7876eef320254984b9dbd4 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 5 Nov 2024 09:52:40 -0400 Subject: [PATCH] asahi: fix a2c with sample shading, harder Fixes: 9bbe93d1589 ("hk: fix alpha-to-coverage with sample shading") Signed-off-by: Alyssa Rosenzweig (cherry picked from commit b94bcf0318f28eb9f75e7c238d3bd4fd606aee0a) Part-of: --- .pick_status.json | 2 +- src/asahi/lib/agx_nir_prolog_epilog.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 473f2ee96b6..9197b3cd85d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -344,7 +344,7 @@ "description": "asahi: fix a2c with sample shading, harder", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "9bbe93d158915f5b4b0904c12e52d393dc30f4ae", "notes": null diff --git a/src/asahi/lib/agx_nir_prolog_epilog.c b/src/asahi/lib/agx_nir_prolog_epilog.c index 99a4bcb6a01..fcd3e442cfe 100644 --- a/src/asahi/lib/agx_nir_prolog_epilog.c +++ b/src/asahi/lib/agx_nir_prolog_epilog.c @@ -448,16 +448,17 @@ agx_nir_fs_epilog(nir_builder *b, const void *key_) * to the epilog, when sample shading is not used but blending is. */ if (key->link.sample_shading) { - NIR_PASS(_, b->shader, agx_nir_lower_to_per_sample); - NIR_PASS(_, b->shader, agx_nir_lower_fs_active_samples_to_register); - /* Lower the resulting discards. Done in agx_nir_lower_monolithic_msaa for - * the pixel shaded path. + * the pixel shaded path. Must be done before agx_nir_lower_to_per_sample + * to avoid duplicating tests. */ if (key->blend.alpha_to_coverage) { NIR_PASS(_, b->shader, agx_nir_lower_sample_mask); } + NIR_PASS(_, b->shader, agx_nir_lower_to_per_sample); + NIR_PASS(_, b->shader, agx_nir_lower_fs_active_samples_to_register); + /* Ensure the sample ID is preserved in register. We do this late since it * has to go in the last block, and the above passes might add control * flow when lowering.