From f4042afd5779f6e98b4369e90e9af4952bb0161c Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 16 Aug 2023 17:58:27 -0400 Subject: [PATCH] nir: Add layer_id_written_agx sysval We'll implement layer ID reads in the frag shader with a varying read, but if the VS doesn't write the varying we need to return 0 per the spec. Add a sysval to detect that case so we can handle it at runtime without keys. Signed-off-by: Alyssa Rosenzweig --- src/compiler/nir/nir_intrinsics.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py index 50b25ed85b2..f24df485132 100644 --- a/src/compiler/nir/nir_intrinsics.py +++ b/src/compiler/nir/nir_intrinsics.py @@ -1695,6 +1695,11 @@ intrinsic("load_coefficients_agx", indices=[COMPONENT, IO_SEMANTICS, INTERP_MODE], flags=[CAN_ELIMINATE, CAN_REORDER]) +# In a fragment shader, boolean system value that is true if the last vertex +# stage writes the layer ID. If false, layer IDs are defined to read back zero. +# This system value facilitates that. 16-bit 0/~0 bool allows easy masking. +system_value("layer_id_written_agx", 1, bit_sizes=[16]) + # Load/store a pixel in local memory. This operation is formatted, with # conversion between the specified format and the implied register format of the # source/destination (for store/loads respectively). This mostly matters for