summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdiel Janulgue <abdiel.janulgue@linux.intel.com>2015-11-18 17:35:29 +0200
committerAbdiel Janulgue <abdiel.janulgue@linux.intel.com>2015-11-18 17:35:29 +0200
commit751a1c925c21aa2e5cdd37872d9fc87509467ee7 (patch)
tree093d6123f1eb6fb10fea7f169c10a1bd08c43244
parentbc9f1abdfb25a1b8697c7eaa308b3feb86a008ff (diff)
Calculate size of live arrays during compile time
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h7
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp11
2 files changed, 15 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 95bc216797..daf247917a 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -347,7 +347,9 @@ struct brw_shader_program {
struct gl_shader_program base;
drm_intel_bo *bo; /**< Actual uniform backing store */
- unsigned next_offset;
+
+ uint32_t next_offset;
+ uint32_t tail_offset;
/** If true, the head pointer should be reset to zero at next use.*/
bool zero_offsets;
@@ -375,6 +377,7 @@ struct brw_shader_program {
*/
bool needs_update;
unsigned size;
+ unsigned live_size; /* Make size above redundant? */
unsigned elements;
int offset;
@@ -1570,7 +1573,7 @@ struct brw_context
uint32_t size;
} gather_pool;
- uint32_t **needs_offset_reset;
+ struct brw_shader_program **needs_offset_reset;
uint32_t num_offset_reset;
struct {
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 737b493de5..f491df6d2e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1955,6 +1955,8 @@ fs_visitor::assign_constant_locations()
prog->storage_table[loc].live_array_nr = 0;
}
+ unsigned max_array_index[locs];
+ memset(max_array_index, 0, sizeof(max_array_index));
int nr_p = 0;
for (unsigned i = 0; i < this->nr_gather_table; i++) {
int const_idx = this->ubo_gather_table[i].reg;
@@ -2009,7 +2011,14 @@ fs_visitor::assign_constant_locations()
arr_idx, prog
);
-
+ /* Calculate actual size minus unused array elements */
+ const unsigned base_size = prog->storage_table[loc].size /
+ prog->storage_table[loc].elements;
+ max_array_index[loc] = MAX2(max_array_index[loc],
+ prog->storage_table[loc]
+ .live_array_indices[arr_idx].array_index);
+ prog->storage_table[loc].live_size = base_size *
+ (max_array_index[loc] + 1);
}
//printf("Nr_params: %d nr_p : %d\n", stage_prog_data->nr_params, nr_p);