diff options
author | Abdiel Janulgue <abdiel.janulgue@linux.intel.com> | 2015-01-02 05:25:31 +0200 |
---|---|---|
committer | Abdiel Janulgue <abdiel.janulgue@linux.intel.com> | 2015-09-10 12:22:27 +0300 |
commit | 9e7f7c7d8fe2144ee91c138e6a0e3693f0924b35 (patch) | |
tree | 699212b6d660bfb482122d0ce1820b3c8eeaf121 | |
parent | 23314d67b1ad6ecb091f66f58e71014a7e65d315 (diff) |
i965: Allocate space on the gather pool for UBO entries
If there are UBO constant entries, append them to stage_state->push_const_size.
The gather pool contains the combined entries of both ordinary uniforms
and UBO constants.
Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_vs_state.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c index b78166ec51..843df94604 100644 --- a/src/mesa/drivers/dri/i965/gen6_vs_state.c +++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c @@ -59,7 +59,9 @@ gen6_upload_push_constants(struct brw_context *brw, struct gl_context *ctx = &brw->ctx; if (prog_data->nr_params == 0) { - stage_state->push_const_size = 0; + if (prog_data->nr_ubo_params == 0) { + stage_state->push_const_size = 0; + } } else { /* Updates the ParamaterValues[i] pointers for all parameters of the * basic type of PROGRAM_STATE_VAR. @@ -122,10 +124,24 @@ gen6_upload_push_constants(struct brw_context *brw, } /* Allocate gather pool space for uniform and UBO entries in 512-bit chunks*/ if (brw->gather_pool.bo != NULL) { + unsigned gather_pool_next_offset = brw->gather_pool.next_offset; + if (prog_data->nr_params > 0) { int num_consts = ALIGN(prog_data->nr_params, 4) / 4; + gather_pool_next_offset += (ALIGN(num_consts, 4) / 4) * 64; + } + + if (prog_data->nr_ubo_params > 0) { + stage_state->push_const_size = ALIGN(prog_data->nr_params + prog_data->nr_ubo_params, 8) / 8; + uint32_t num_constants = ALIGN(prog_data->nr_ubo_params, 4) / 4; + gather_pool_next_offset += (ALIGN(num_constants, 4) / 4) * 64; + } + + if (gather_pool_next_offset > brw->gather_pool.next_offset) { stage_state->push_const_offset = brw->gather_pool.next_offset; - brw->gather_pool.next_offset += (ALIGN(num_consts, 4) / 4) * 64; + brw->gather_pool.next_offset = gather_pool_next_offset; + assert(brw->gather_pool.next_offset < brw->gather_pool.bo->size); + assert(stage_state->push_const_offset < brw->gather_pool.next_offset); } } } |