[Mesa-dev] [RFC PATCH 26/40] i965: Allocate space on the gather pool for UBO entries

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Sun Jan 4 06:04:40 PST 2015


In addition, append the UBO entries to stage_state->push_const_size

Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
 src/mesa/drivers/dri/i965/gen6_vs_state.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c
index 5e71a44..9b32ec2 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.
@@ -130,6 +132,14 @@ gen6_upload_push_constants(struct brw_context *brw,
          stage_state->push_const_offset = brw->gather_pool.next_offset;
          brw->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_ubo_params, 8) / 8;
+
+         uint32_t num_constants = ALIGN(prog_data->nr_ubo_params, 4) / 4;
+         stage_state->push_const_offset = brw->gather_pool.next_offset;
+         brw->gather_pool.next_offset += (ALIGN(num_constants, 4) / 4) * 64;
+      }
    }
 }
 
-- 
1.9.1



More information about the mesa-dev mailing list