diff options
author | Abdiel Janulgue <abdiel.janulgue@linux.intel.com> | 2015-04-14 14:33:17 +0300 |
---|---|---|
committer | Abdiel Janulgue <abdiel.janulgue@linux.intel.com> | 2015-09-11 10:53:25 +0300 |
commit | 7103675b1ff52f438980e9d90b897743ea24bcff (patch) | |
tree | d0afd7b6b79a8b1fd8e5377ed35852ebb05e08d8 | |
parent | a2447acba54713d6498ed9bedc9cadbf724c883c (diff) |
i965/fs: Pack UBO registers right after uniform registers
We now have two sources of constant buffers: UBOs and ordinary uniforms.
After assigning a block of push constant hw-register to normal uniforms,
just pack the UBO push constant registers right after it.
Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index ad084af543..6abe367525 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -942,6 +942,8 @@ fs_visitor::import_uniforms(fs_visitor *v) this->pull_constant_loc = v->pull_constant_loc; this->uniforms = v->uniforms; this->param_size = v->param_size; + this->nr_ubo_gather_table = v->nr_ubo_gather_table; + this->ubo_gather_table = v->ubo_gather_table; } void @@ -1362,7 +1364,8 @@ fs_visitor::assign_curb_setup() } } - prog_data->curb_read_length = ALIGN(stage_prog_data->nr_params, 8) / 8; + prog_data->curb_read_length = ALIGN(stage_prog_data->nr_params + stage_prog_data->nr_ubo_params, + 8) / 8; /* Map the offsets in the UNIFORM file to fixed HW regs. */ foreach_block_and_inst(block, fs_inst, inst, cfg) { @@ -1370,7 +1373,7 @@ fs_visitor::assign_curb_setup() if (inst->src[i].file == UNIFORM) { int uniform_nr = inst->src[i].reg + inst->src[i].reg_offset; int constant_nr; - if (uniform_nr >= 0 && uniform_nr < (int) uniforms) { + if (uniform_nr >= 0 && uniform_nr < (int) (uniforms + ubo_uniforms)) { constant_nr = push_constant_loc[uniform_nr]; } else { /* Section 5.11 of the OpenGL 4.1 spec says: @@ -1788,10 +1791,11 @@ fs_visitor::assign_constant_locations() unsigned int num_pull_constants = 0; - pull_constant_loc = ralloc_array(mem_ctx, int, uniforms); - memset(pull_constant_loc, -1, sizeof(pull_constant_loc[0]) * uniforms); + unsigned int total_uniforms = uniforms + ubo_uniforms; + pull_constant_loc = ralloc_array(mem_ctx, int, total_uniforms); + memset(pull_constant_loc, -1, sizeof(pull_constant_loc[0]) * total_uniforms); - bool is_live[uniforms]; + bool is_live[total_uniforms]; memset(is_live, 0, sizeof(is_live)); /* First, we walk through the instructions and do two things: @@ -1823,7 +1827,7 @@ fs_visitor::assign_constant_locations() } else { /* Mark the the one accessed uniform as live */ int constant_nr = inst->src[i].reg + inst->src[i].reg_offset; - if (constant_nr >= 0 && constant_nr < (int) uniforms) + if (constant_nr >= 0 && constant_nr < (int) total_uniforms) is_live[constant_nr] = true; } } @@ -1840,9 +1844,9 @@ fs_visitor::assign_constant_locations() unsigned int max_push_components = 16 * 8; unsigned int num_push_constants = 0; - push_constant_loc = ralloc_array(mem_ctx, int, uniforms); + push_constant_loc = ralloc_array(mem_ctx, int, total_uniforms); - for (unsigned int i = 0; i < uniforms; i++) { + for (unsigned int i = 0; i < total_uniforms; i++) { if (!is_live[i] || pull_constant_loc[i] != -1) { /* This UNIFORM register is either dead, or has already been demoted * to a pull const. Mark it as no longer living in the param[] array. |