From: Connor Abbott Date: Thu, 22 Aug 2019 11:19:07 +0000 (+0200) Subject: st/nir: Fix num_inputs for VS inputs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3eb4aeed6042693b861e710d47624af010d53bfb;p=mesa.git st/nir: Fix num_inputs for VS inputs Reviewed-by: Marek Olšák --- 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