From 42b5cfdbd26cf1540f12d8193dd70d7bd01a9ccc Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 30 Oct 2020 13:48:55 +1000 Subject: [PATCH] gallivm/nir: fix vulkan vertex inputs the tgsi file max is used to determine the number of input slots, the old code was pretty bogus for the lavapipe cases (it worked by accident). Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/auxiliary/nir/nir_to_tgsi_info.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi_info.c b/src/gallium/auxiliary/nir/nir_to_tgsi_info.c index 20052bae9d2..eab790876f3 100644 --- a/src/gallium/auxiliary/nir/nir_to_tgsi_info.c +++ b/src/gallium/auxiliary/nir/nir_to_tgsi_info.c @@ -577,10 +577,18 @@ void nir_tgsi_scan_shader(const struct nir_shader *nir, info->num_inputs = util_bitcount64(nir->info.inputs_read); if (nir->info.inputs_read_indirectly) info->indirect_files |= 1 << TGSI_FILE_INPUT; + info->file_max[TGSI_FILE_INPUT] = info->num_inputs - 1; + } else { + int max = -1; + nir_foreach_shader_in_variable(var, nir) { + int slots = glsl_count_attribute_slots(var->type, false); + int tmax = var->data.driver_location + slots - 1; + if (tmax > max) + max = tmax; + info->file_max[TGSI_FILE_INPUT] = max; + } } - info->file_max[TGSI_FILE_INPUT] = info->num_inputs - 1; - i = 0; uint64_t processed_outputs = 0; unsigned num_outputs = 0;