st/nir: Fix num_inputs for VS inputs
authorConnor Abbott <cwabbott0@gmail.com>
Thu, 22 Aug 2019 11:19:07 +0000 (13:19 +0200)
committerConnor Abbott <cwabbott0@gmail.com>
Fri, 23 Aug 2019 09:05:31 +0000 (11:05 +0200)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_glsl_to_nir.cpp

index 9bd69383373eea442857ad1ed8af665276a58ae6..2b4c45f5f550107aca02655bc6a3a0db5c1f973c 100644 (file)
@@ -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