summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Abbott <cwabbott0@gmail.com>2019-08-22 13:19:07 +0200
committerConnor Abbott <cwabbott0@gmail.com>2019-08-23 11:05:31 +0200
commit3eb4aeed6042693b861e710d47624af010d53bfb (patch)
treedacd915fea6bc6f4b7ebe7649504a63abd8d86ec
parenta4e6e59db82e61b47ef905f28dde80ae36a67d35 (diff)
st/nir: Fix num_inputs for VS inputs
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp5
1 files 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 9bd69383373e..2b4c45f5f550 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