diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index d5f335b6a0e..eef0cdf101f 100644 --- a/src/compiler/nir/nir_linking_helpers.c +++ b/src/compiler/nir/nir_linking_helpers.c @@ -1455,7 +1455,7 @@ nir_assign_io_var_locations(nir_shader *shader, nir_variable_mode mode, unsigned *size, gl_shader_stage stage) { unsigned location = 0; - unsigned assigned_locations[VARYING_SLOT_TESS_MAX]; + unsigned assigned_locations[VARYING_SLOT_TESS_MAX][2]; uint64_t processed_locs[2] = { 0 }; struct exec_list io_vars; @@ -1547,7 +1547,7 @@ nir_assign_io_var_locations(nir_shader *shader, nir_variable_mode mode, if (processed) { /* TODO handle overlapping per-view variables */ assert(!var->data.per_view); - unsigned driver_location = assigned_locations[var->data.location]; + unsigned driver_location = assigned_locations[var->data.location][var->data.index]; var->data.driver_location = driver_location; /* An array may be packed such that is crosses multiple other arrays @@ -1568,7 +1568,7 @@ nir_assign_io_var_locations(nir_shader *shader, nir_variable_mode mode, unsigned num_unallocated_slots = last_slot_location - location; unsigned first_unallocated_slot = var_size - num_unallocated_slots; for (unsigned i = first_unallocated_slot; i < var_size; i++) { - assigned_locations[var->data.location + i] = location; + assigned_locations[var->data.location + i][var->data.index] = location; location++; } } @@ -1576,7 +1576,7 @@ nir_assign_io_var_locations(nir_shader *shader, nir_variable_mode mode, } for (unsigned i = 0; i < var_size; i++) { - assigned_locations[var->data.location + i] = location + i; + assigned_locations[var->data.location + i][var->data.index] = location + i; } var->data.driver_location = location; diff --git a/src/gallium/auxiliary/nir/nir_draw_helpers.c b/src/gallium/auxiliary/nir/nir_draw_helpers.c index 646746f5274..e10687cf8ef 100644 --- a/src/gallium/auxiliary/nir/nir_draw_helpers.c +++ b/src/gallium/auxiliary/nir/nir_draw_helpers.c @@ -228,11 +228,8 @@ lower_aaline_instr(nir_builder *b, nir_instr *instr, void *data) nir_fmin(b, nir_channel(b, tmp, 1), max)); tmp = nir_fmul(b, nir_channel(b, out_input, out_input->num_components - 1), tmp); - nir_def *components[4]; - for (unsigned i = 0; i < out_input->num_components - 1; i++) - components[i] = nir_channel(b, out_input, i); - components[out_input->num_components - 1] = tmp; - nir_def *out = nir_vec(b, components, out_input->num_components); + nir_def *out = nir_vector_insert_imm(b, out_input, tmp, + out_input->num_components - 1); nir_src_rewrite(&intrin->src[1], out); return true; }