From 3eb4aeed6042693b861e710d47624af010d53bfb Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Thu, 22 Aug 2019 13:19:07 +0200 Subject: [PATCH] st/nir: Fix num_inputs for VS inputs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- src/mesa/state_tracker/st_glsl_to_nir.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index 9bd69383373..2b4c45f5f55 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -83,19 +83,18 @@ st_nir_fixup_varying_slots(struct st_context *st, struct exec_list *var_list) static void st_nir_assign_vs_in_locations(nir_shader *nir) { - nir->num_inputs = 0; + nir->num_inputs = util_bitcount64(nir->info.inputs_read); nir_foreach_variable_safe(var, &nir->inputs) { /* NIR already assigns dual-slot inputs to two locations so all we have * to do is compact everything down. */ if (var->data.location == VERT_ATTRIB_EDGEFLAG) { /* bit of a hack, mirroring st_translate_vertex_program */ - var->data.driver_location = util_bitcount64(nir->info.inputs_read); + var->data.driver_location = nir->num_inputs++; } else if (nir->info.inputs_read & BITFIELD64_BIT(var->data.location)) { var->data.driver_location = util_bitcount64(nir->info.inputs_read & BITFIELD64_MASK(var->data.location)); - nir->num_inputs++; } else { /* Move unused input variables to the globals list (with no * initialization), to avoid confusing drivers looking through the -- 2.30.2