summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdiel Janulgue <abdiel.janulgue@linux.intel.com>2016-01-07 13:23:06 +0200
committerAbdiel Janulgue <abdiel.janulgue@linux.intel.com>2016-01-07 13:23:06 +0200
commit03aaa1fbd47eeeae3cec987ed913582716a530c8 (patch)
treecc582c3e7efecee356df48f3f404e24e698e7bf8
parent4e71b3e47bf8a1bf3ffeab62b731e2b01a7c2edd (diff)
vs-op-selection-bool-float-float.shader_test
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.cpp80
1 files changed, 53 insertions, 27 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 58b7adbd15..933fc729b0 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -688,12 +688,13 @@ vec4_visitor::pack_uniform_registers()
.live_array_indices[arr_idx].array_index);
prog->storage_table[loc].live_size = prog->storage_table[loc].base_size *
(max_array_index[loc] + 1);
- printf(" Generate GT[%d] from gt[%d] | components: %d |mask :0x%x |"
- "new_loc: %d | arr_idx: %d\n",
+ printf(" Generate GT[%d] from gt[%d] | comps: %d |mask :0x%x |"
+ "new_loc: %d | arr_idx: %d | offs: %d\n",
gather_index, uni_position, this->ubo_gather_table[i].components,
this->ubo_gather_table[i].channel_mask,
(gather_index == new_loc[uni_position] ? gather_index :
- (new_loc[uni_position] + 1), arr_idx)
+ (new_loc[uni_position] + 1), arr_idx),
+ this->ubo_gather_table[i].const_offset
);
}
@@ -713,55 +714,80 @@ vec4_visitor::pack_uniform_registers()
// the uniform location.
bool reindexed_location[total_uniforms];
-
+ int current_index = 0;
for (int i = 0; i < stage_prog_data->nr_gather_table; i++) {
// TODO: rename .reg to .uniform_location
const int uni_position = stage_prog_data->gather_table[i].reg;
reindexed_location[uni_position] = false;
- if (i == new_loc[uni_position])
+ if (i == new_loc[uni_position]) {
+ printf(" [Skipping %d]\n", i);
continue;
+ }
+ /* Actual register position as packed uniform entry */
int nloc = new_loc[uni_position];
- int new_idx = gather_index_loc[nloc] + 1;
- int prev_gather_index = gather_index_loc[uni_position];
- printf(" TEST uniform reg: %d new_loc: %d | prev idx: %d Pos: %d\n",
- uni_position, nloc, prev_gather_index,
- gather_index_loc[nloc] + 1);
- gather_index_loc[nloc] = prev_gather_index;
+ /* Gather table index of previous packed uniform */
+ int prev_index = MAX2(0, nloc - 1);
+ int current_index = gather_index_loc[prev_index] + 1;
+
+ /* New index is always inserted right after an existing entry */
+ int target_idx = gather_index_loc[nloc] + 1;
+
+ /* Update the packed uniform's position within the gather table */
+ int unpacked_gather_index = gather_index_loc[uni_position];
+
+ printf(" Tst Uniform reg: %d(%d) new_loc: %d | Cur pcked GTidx: %d | "
+ "unpcked GT idx: %d target_idx: %d | Sz: %d\n",
+ uni_position, i, nloc, gather_index_loc[nloc],
+ unpacked_gather_index, target_idx,
+ this->uniform_vector_size[nloc]);
+ gather_index_loc[nloc] = unpacked_gather_index;
+
+ /* Do we still have space in the target location for another slot? */
+ bool slot_filled = false;
+ // for (int p = 0; p < ARRAY_SIZE(gather_index_loc); p++) {
+ // if (p == target_idx) {
+ // slot_filled = this->uniform_vector_size[new_loc[p]] == 4;
+ // }
+ // }
// gather_index_loc[uni_position] = nloc;
// Update the uniform location
- printf(" ... change reg: %d => %d\n",
- stage_prog_data->gather_table[i].reg, nloc);
+ printf(" ... change reg: %d => %d | Target %d Cur idx?: %d\n",
+ stage_prog_data->gather_table[i].reg, nloc, target_idx,
+ current_index);
stage_prog_data->gather_table[i].reg = nloc;
- if (i == new_idx) {
+
+ if (i == target_idx || i == current_index) {
// stage_prog_data->gather_table[i].channel_mask = 0xf;
printf(" [Skipping %d]\n", i);
continue;
}
+ current_index++;
+ /* Nudge the subsequent entries from the target index one
+ * step forward to make space for the re-indexed entry.
+ */
struct brw_gather_table re_index = stage_prog_data->gather_table[i];
printf(" ==> Target index %d: GT[%d] (data_mask: 0x%x) sz: %d IDx GT: %d "
"Updated target? %s\n",
- new_idx, i, re_index.channel_mask,
+ target_idx, i, re_index.channel_mask,
this->uniform_vector_size[uni_position],
gather_index_loc[uni_position],
- reindexed_location[new_idx] ? "True":"False");
-
-
+ reindexed_location[target_idx] ? "True":"False");
int src_idx = i - 1;
- if (new_idx != src_idx) {
- for (; src_idx >= new_idx; src_idx--) {
+ if (target_idx != src_idx) {
+ for (; src_idx >= target_idx; src_idx--) {
int src_uni_loc = stage_prog_data->gather_table[src_idx]
.uniform_location;
int new_gather_idx = src_idx + 1;
printf(" i: %d, New index: %d newgt: %d, src_id: %d\n", i,
- new_idx, new_gather_idx, src_idx);
- // if (new_idx == src_idx)
+ target_idx, new_gather_idx, src_idx);
+ // if (target_idx == src_idx)
// break;
// stage_prog_data->gather_table[src_idx].channel_mask = 0xf;
@@ -794,22 +820,22 @@ vec4_visitor::pack_uniform_registers()
}
}
// Really from index 0??
- if (reindexed_location[new_idx]) {
+ if (reindexed_location[target_idx]) {
const int old_index = prog->storage_table[re_index.uniform_location]
.live_array_indices[0].gather_index;
printf(" ->Moving GT: %d <-- (*Updated) %d | data (mask): 0x%x | i: %d\n",
- new_idx, i, re_index.channel_mask, i);
+ target_idx, i, re_index.channel_mask, i);
prog->storage_table[re_index.uniform_location]
- .live_array_indices[0].gather_index = new_idx;
+ .live_array_indices[0].gather_index = target_idx;
- stage_prog_data->gather_table[new_idx] = re_index;
+ stage_prog_data->gather_table[target_idx] = re_index;
reindexed_location[i] = true;
}
}
#if 1
// Make sure that each register fetch is aligned to 16-bytes.
- // Add padding zeroes if necessary.
+ // Modify the channel mask to add padding zeroes if necessary.
printf("\n\n");
for (int i = 0; i < stage_prog_data->nr_gather_table - 1; i++) {
// if (!reindexed_location[i])