panfrost/bi: Separate va_shader_output from bitmasks

The new pass will need to iterate on the enum varyings

Signed-off-by: Lorenzo Rossi <lorenzo.rossi@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40537>
This commit is contained in:
Lorenzo Rossi 2026-03-20 12:50:55 +01:00 committed by Marge Bot
parent d5b9411331
commit 922405ab71
2 changed files with 18 additions and 9 deletions

View file

@ -1089,18 +1089,19 @@ bifrost_nir_lower_vs_atomics_impl(nir_builder *b, nir_intrinsic_instr *intr,
continue;
nir_io_semantics sem = nir_intrinsic_io_semantics(parent_intr);
output_mask |= va_shader_output_from_semantics(&sem);
output_mask |= BITFIELD_BIT(va_shader_output_from_semantics(&sem));
}
/* In case they are not written to any outputs, we default to only output in
* the position stage */
if (output_mask == 0)
output_mask |= VA_SHADER_OUTPUT_POSITION;
output_mask |= VA_SHADER_OUTPUT_POSITION_BIT;
/* In case they are not written to both IDVS stages, we just do not try
* lowering it */
if (((output_mask & VA_SHADER_OUTPUT_VARY) &&
(output_mask & (VA_SHADER_OUTPUT_POSITION | VA_SHADER_OUTPUT_ATTRIB))))
if (((output_mask & VA_SHADER_OUTPUT_VARY_BIT) &&
(output_mask & (VA_SHADER_OUTPUT_POSITION_BIT |
VA_SHADER_OUTPUT_ATTRIB_BIT))))
return false;
/* In case we know we have only outputs to a certain type, we can make the
@ -6435,10 +6436,11 @@ bi_compile_variant_nir(nir_shader *nir,
if (offset == 0)
ctx->nir = nir = nir_shader_clone(ctx, nir);
uint64_t position = VA_SHADER_OUTPUT_POSITION | VA_SHADER_OUTPUT_ATTRIB;
uint64_t position = VA_SHADER_OUTPUT_POSITION_BIT |
VA_SHADER_OUTPUT_ATTRIB_BIT;
NIR_PASS(_, nir, nir_inline_sysval, nir_intrinsic_load_shader_output_pan,
(idvs == BI_IDVS_POSITION) ? position : VA_SHADER_OUTPUT_VARY);
(idvs == BI_IDVS_POSITION) ? position : VA_SHADER_OUTPUT_VARY_BIT);
/* After specializing, clean up the mess */
bool progress = true;

View file

@ -177,15 +177,22 @@ va_op_dest_modifier_does_convert(enum bi_opcode op)
enum va_shader_output {
/* Output position data */
VA_SHADER_OUTPUT_POSITION = BITFIELD_BIT(0),
VA_SHADER_OUTPUT_POSITION,
/* Output position FIFO attributes */
VA_SHADER_OUTPUT_ATTRIB = BITFIELD_BIT(1),
VA_SHADER_OUTPUT_ATTRIB,
/* Output varying */
VA_SHADER_OUTPUT_VARY = BITFIELD_BIT(2),
VA_SHADER_OUTPUT_VARY,
/* Number of variants, keep last */
VA_SHADER_OUTPUT_COUNT
};
#define VA_SHADER_OUTPUT_POSITION_BIT BITFIELD_BIT(VA_SHADER_OUTPUT_POSITION)
#define VA_SHADER_OUTPUT_ATTRIB_BIT BITFIELD_BIT(VA_SHADER_OUTPUT_ATTRIB)
#define VA_SHADER_OUTPUT_VARY_BIT BITFIELD_BIT(VA_SHADER_OUTPUT_VARY)
#ifdef __cplusplus
} /* extern C */
#endif