asahi: fix sample ID with multiblock epilogs

eMRT + MSAA + epilog case.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29179>
This commit is contained in:
Alyssa Rosenzweig
2024-04-19 22:07:57 -04:00
committed by Marge Bot
parent cf653997d7
commit f4991baa89
+10 -2
View File
@@ -311,9 +311,10 @@ agx_nir_fs_epilog(nir_builder *b, const void *key_)
.io_semantics.dual_source_blend_index = dual_src);
}
/* Grab the sample ID early, this has to happen in the first block. */
nir_def *sample_id = NULL;
if (key->link.sample_shading) {
/* Ensure the sample ID is preserved in register */
nir_export_agx(b, nir_load_exported_agx(b, 1, 16, .base = 1), .base = 1);
sample_id = nir_load_exported_agx(b, 1, 16, .base = 1);
}
/* Now lower the resulting program using the key */
@@ -412,6 +413,13 @@ agx_nir_fs_epilog(nir_builder *b, const void *key_)
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);
/* 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.
*/
b->cursor = nir_after_impl(b->impl);
nir_export_agx(b, sample_id, .base = 1);
} else {
NIR_PASS(_, b->shader, agx_nir_lower_monolithic_msaa, key->nr_samples);
}