spirv: only consider IO variables when adjusting patch locations for TES

With TES, the primitive ID is an input variable but it's considered a
sysval by SPIRV->NIR. Though, its value is greater than
VARYING_SLOT_VAR0 which means its location was adjusted by mistake.

This fixes compiling a tessellation evaluation shader in debug build
with Enshrouded.

Fixes: dfbc03fa88 ("spirv: Fix locations for per-patch varyings")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27413>
This commit is contained in:
Samuel Pitoiset 2024-01-30 14:48:12 +01:00 committed by Marge Bot
parent c12300844d
commit 78ea304a06

View file

@ -2044,7 +2044,9 @@ adjust_patch_locations(struct vtn_builder *b, struct vtn_variable *var)
for (uint16_t i = 0; i < num_data; i++) {
vtn_assert(data[i].location < VARYING_SLOT_PATCH0);
if (data[i].patch && data[i].location >= VARYING_SLOT_VAR0)
if (data[i].patch &&
(data[i].mode == nir_var_shader_in || data[i].mode == nir_var_shader_out) &&
data[i].location >= VARYING_SLOT_VAR0)
data[i].location += VARYING_SLOT_PATCH0 - VARYING_SLOT_VAR0;
}
}