summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_linking_helpers.c
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2019-09-24 17:29:53 +0200
committerConnor Abbott <[email protected]>2019-09-25 15:53:50 +0200
commit36e000d8321814de11454c8574f2d3a8da01db8a (patch)
tree42edeb299d0a275e5c5e2ceba5e92ac75663641f /src/compiler/nir/nir_linking_helpers.c
parent66456b8d49ba2ccfe36e3dd2d7dadefaae392636 (diff)
nir: Fix overlapping vars in nir_assign_io_var_locations()
When handling two variables with overlapping locations, we process the one with lower location first, and then extend the location -> driver_location map to guarantee that it's contiguous for the second variable too. But the loop had the wrong bound, so we weren't extending the map 100%, which could lead to problems later such as an incorrect num_inputs. The loop index i is an index into the slots of the variable, so we need to stop at the final slot of the variable (var_size) instead of the number of unassigned slots. This fixes spec@arb_enhanced_layouts@execution@component-layout@vs-fs-array-interleave-range on radeonsi NIR. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_linking_helpers.c')
-rw-r--r--src/compiler/nir/nir_linking_helpers.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c
index 28d2774cae2..8d7302c93c1 100644
--- a/src/compiler/nir/nir_linking_helpers.c
+++ b/src/compiler/nir/nir_linking_helpers.c
@@ -1079,7 +1079,7 @@ nir_assign_io_var_locations(struct exec_list *var_list, unsigned *size,
if (last_slot_location > location) {
unsigned num_unallocated_slots = last_slot_location - location;
unsigned first_unallocated_slot = var_size - num_unallocated_slots;
- for (unsigned i = first_unallocated_slot; i < num_unallocated_slots; i++) {
+ for (unsigned i = first_unallocated_slot; i < var_size; i++) {
assigned_locations[var->data.location + i] = location;
location++;
}