[Mesa-dev] [RFC PATCH 37/40] i965: Assign hw-binding table entries for each ubo block.
Abdiel Janulgue
abdiel.janulgue at linux.intel.com
Sun Jan 4 06:04:51 PST 2015
Blanket the ubo blocks with a binding table. Note that the resource
streamer is able to fetch the constant buffers referred to by the gather
table only if it is referenced by the hw-binding table generator.
Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
src/mesa/drivers/dri/i965/brw_context.h | 3 +++
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 9877126..8d9adf6 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -668,6 +668,9 @@ struct brw_vs_prog_data {
/** Start of hardware binding table index for uniform gather constant entries */
#define BRW_UNIFORM_GATHER_INDEX_START 16
+/** Start of hardware binding table index for UBO gather constant entries */
+#define BRW_UBO_GATHER_INDEX_START (BRW_UNIFORM_GATHER_INDEX_START + 8)
+
/* Note: brw_gs_prog_data_compare() must be updated when adding fields to
* this struct!
*/
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 85a08d5..558a816 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -853,6 +853,7 @@ brw_upload_ubo_surfaces(struct brw_context *brw,
uint32_t *surf_offsets =
&stage_state->surf_offset[prog_data->binding_table.ubo_start];
+ bool use_gather = (brw->gather_pool.bo != NULL);
for (int i = 0; i < shader->NumUniformBlocks; i++) {
struct gl_uniform_buffer_binding *binding;
@@ -873,6 +874,11 @@ brw_upload_ubo_surfaces(struct brw_context *brw,
bo->size - binding->Offset,
&surf_offsets[i],
dword_pitch);
+ if (use_gather) {
+ int bt_idx = BRW_UBO_GATHER_INDEX_START + i;
+ gen7_update_binding_table(brw, MESA_SHADER_FRAGMENT,
+ bt_idx, surf_offsets[i]);
+ }
}
if (shader->NumUniformBlocks)
--
1.9.1
More information about the mesa-dev
mailing list