zink: fix tcs input reservation for user vars

tcs user vars are var_size[32], which isn't actually how many slots they need,
just how big the variable is (oops), so this needs to be divided
by MAX_PATCH_VERTICES to get the real slot count

slot mapping has always been broken for all tcs inputs, but this probably fixes
all of the related issues there, including unlimited crashes when playing Tomb Raider

Fixes: 2d98efd323 ("zink: pre-populate locations in variables")

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10269>
This commit is contained in:
Mike Blumenkrantz
2021-04-15 10:20:29 -04:00
committed by Marge Bot
parent a8ba8eb12f
commit 001c6f8201

View File

@@ -550,7 +550,10 @@ assign_io_locations(nir_shader *nir, unsigned char *shader_slot_map,
if (shader_slot_map[var->data.location] == 0xff) {
assert(reserved < MAX_VARYING);
shader_slot_map[var->data.location] = reserved;
reserved += glsl_count_vec4_slots(var->type, false, false);
if (nir->info.stage == MESA_SHADER_TESS_CTRL && var->data.location >= VARYING_SLOT_VAR0)
reserved += (glsl_count_vec4_slots(var->type, false, false) / 32 /*MAX_PATCH_VERTICES*/);
else
reserved += glsl_count_vec4_slots(var->type, false, false);
}
slot = shader_slot_map[var->data.location];
assert(slot < MAX_VARYING);