ac/nir/tess: Various fixes for per-patch tessellation I/O
Fix a few regressions caused by the recent tessellation refactors:
- When TCS and TES are linked, only write tess factors that the TES actually reads. Otherwise we would write to a memory location reserved for another per-patch output (or corrupt the output of a different patch). This fixes a regression in Starfield. In Starfield, there is a pipeline where the TES reads only the outer tess levels (not inner) and another per-patch output. This case was handled badly without this patch.
- Fix per-patch I/O location assignment in VRAM. It is incorrect to use
BITFIELD64_BIT
forlocation
when it can beVARYING_SLOT_PATCH0
or higher (it's UB), and therefore the incorrect code path was sometimes taken for per-patch variables. This fixes the broken test cases uncovered by the ANGLE job in Mesa CI. - Fix per-patch I/O location assignment in LDS. Basically the same problem. This didn't affect any known games or test cases, but better be safe and fix it anyway.
- Use the TES
inputs_read
andpatch_inputs_read
for determining the input and output count when linking TCS and TES, to matchac_nir_lower_tess_io_to_mem
. This fixes a theoretical issue when TES reads an input that TCS didn't write.
Edited by Timur Kristóf