From f7ff0041c122c4ee3a214c126df2545b00220b36 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sat, 27 Apr 2024 11:29:03 -0400 Subject: [PATCH] agx: document another sample_mask restriction hit this with force early fragment tests. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_nir_lower_sample_mask.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/asahi/compiler/agx_nir_lower_sample_mask.c b/src/asahi/compiler/agx_nir_lower_sample_mask.c index dfbd650c3ed..f76b549fa01 100644 --- a/src/asahi/compiler/agx_nir_lower_sample_mask.c +++ b/src/asahi/compiler/agx_nir_lower_sample_mask.c @@ -52,7 +52,17 @@ * sample_mask ~0, ~discarded * sample_mask ~0, ~0 <-- incorrect: depth/stencil tests run twice * - * 4. zs_emit may be used in the shader exactly once to trigger tests. + * 4. Conversely, if a sample is tested, future sample_mask instructions may not + * discard that sample. The following code is invalid: + * + * sample_mask ~0, ~0 + * sample_mask discarded, 0 + * st_tile + * + * To implement the semantic of "force early tests with discard", manual + * colour masking must be used. It's a weird case, but CTS does it. + * + * 5. zs_emit may be used in the shader exactly once to trigger tests. * sample_mask with 0 may be used to discard early. * * This pass lowers discard_agx to sample_mask instructions satisfying these