ac/nir: Only export positions when they are really system values.

In AMD terminology, a system value is implemented by
position export instructions.

Make sure to only emit those when they are needed.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32640>
This commit is contained in:
Timur Kristóf
2024-12-13 07:05:20 +01:00
parent f5981e8c0b
commit 4d6c00944b

View File

@@ -400,15 +400,15 @@ ac_nir_export_position(nir_builder *b,
VARYING_BIT_PRIMITIVE_SHADING_RATE;
/* clear output mask if no one written */
if (!out->outputs[VARYING_SLOT_PSIZ][0])
if (!out->outputs[VARYING_SLOT_PSIZ][0] || !out->infos[VARYING_SLOT_PSIZ].as_sysval_mask)
outputs_written &= ~VARYING_BIT_PSIZ;
if (!out->outputs[VARYING_SLOT_EDGE][0])
if (!out->outputs[VARYING_SLOT_EDGE][0] || !out->infos[VARYING_SLOT_EDGE].as_sysval_mask)
outputs_written &= ~VARYING_BIT_EDGE;
if (!out->outputs[VARYING_SLOT_PRIMITIVE_SHADING_RATE][0])
if (!out->outputs[VARYING_SLOT_PRIMITIVE_SHADING_RATE][0] || !out->infos[VARYING_SLOT_PRIMITIVE_SHADING_RATE].as_sysval_mask)
outputs_written &= ~VARYING_BIT_PRIMITIVE_SHADING_RATE;
if (!out->outputs[VARYING_SLOT_LAYER][0])
if (!out->outputs[VARYING_SLOT_LAYER][0] || !out->infos[VARYING_SLOT_LAYER].as_sysval_mask)
outputs_written &= ~VARYING_BIT_LAYER;
if (!out->outputs[VARYING_SLOT_VIEWPORT][0])
if (!out->outputs[VARYING_SLOT_VIEWPORT][0] || !out->infos[VARYING_SLOT_VIEWPORT].as_sysval_mask)
outputs_written &= ~VARYING_BIT_VIEWPORT;
if ((outputs_written & mask) || force_vrs) {