summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2013-08-25 01:23:08 -0700
committerPaul Berry <[email protected]>2013-08-31 17:12:15 -0700
commitf986222754f5b7f53f1ad53586b3cd42257fabc7 (patch)
treee964dd7813f6d9e3143fb456d35797f59a4710fb /src/mesa/drivers/dri
parent1b19f2c576a343aca946494cf3486395b03b3531 (diff)
i965/vs: generalize brw_vs_binding_table in preparation for GS.
v2: Use GLbitfield instead of GLbitfield64 in brw_vec4_upload_binding_table. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i965/brw_state.h6
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_surface_state.c42
2 files changed, 35 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index 695a84c473b..c2df9e59ad3 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -122,6 +122,7 @@ extern const struct brw_tracked_state gen7_vs_state;
extern const struct brw_tracked_state gen7_wm_state;
extern const struct brw_tracked_state haswell_cut_index;
+
/* brw_misc_state.c */
void brw_upload_invariant_state(struct brw_context *brw);
uint32_t
@@ -228,6 +229,11 @@ brw_upload_vec4_pull_constants(struct brw_context *brw,
const struct gl_program *prog,
struct brw_stage_state *stage_state,
const struct brw_vec4_prog_data *prog_data);
+void
+brw_vec4_upload_binding_table(struct brw_context *brw,
+ GLbitfield brw_new_binding_table,
+ struct brw_stage_state *stage_state,
+ const struct brw_vec4_prog_data *prog_data);
#ifdef __cplusplus
}
diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index b55febefda0..dbf26f47cfd 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -149,14 +149,13 @@ const struct brw_tracked_state brw_vs_ubo_surfaces = {
.emit = brw_upload_vs_ubo_surfaces,
};
-/**
- * Constructs the binding table for the WM surface state, which maps unit
- * numbers to surface state objects.
- */
-static void
-brw_vs_upload_binding_table(struct brw_context *brw)
+
+void
+brw_vec4_upload_binding_table(struct brw_context *brw,
+ GLbitfield brw_new_binding_table,
+ struct brw_stage_state *stage_state,
+ const struct brw_vec4_prog_data *prog_data)
{
- struct brw_stage_state *stage_state = &brw->vs.base;
uint32_t *bind;
int i;
@@ -164,13 +163,13 @@ brw_vs_upload_binding_table(struct brw_context *brw)
gen7_create_shader_time_surface(brw, &stage_state->surf_offset[SURF_INDEX_VEC4_SHADER_TIME]);
}
- /* CACHE_NEW_VS_PROG: Skip making a binding table if we don't use textures or
- * pull constants.
+ /* Skip making a binding table if we don't use textures or pull
+ * constants.
*/
- const unsigned entries = brw->vs.prog_data->base.binding_table_size;
+ const unsigned entries = prog_data->binding_table_size;
if (entries == 0) {
if (stage_state->bind_bo_offset != 0) {
- brw->state.dirty.brw |= BRW_NEW_VS_BINDING_TABLE;
+ brw->state.dirty.brw |= brw_new_binding_table;
stage_state->bind_bo_offset = 0;
}
return;
@@ -183,12 +182,29 @@ brw_vs_upload_binding_table(struct brw_context *brw)
sizeof(uint32_t) * entries,
32, &stage_state->bind_bo_offset);
- /* BRW_NEW_SURFACES and BRW_NEW_VS_CONSTBUF */
+ /* BRW_NEW_SURFACES and BRW_NEW_*_CONSTBUF */
for (i = 0; i < entries; i++) {
bind[i] = stage_state->surf_offset[i];
}
- brw->state.dirty.brw |= BRW_NEW_VS_BINDING_TABLE;
+ brw->state.dirty.brw |= brw_new_binding_table;
+}
+
+
+/**
+ * Constructs the binding table for the WM surface state, which maps unit
+ * numbers to surface state objects.
+ */
+static void
+brw_vs_upload_binding_table(struct brw_context *brw)
+{
+ struct brw_stage_state *stage_state = &brw->vs.base;
+ /* CACHE_NEW_VS_PROG */
+ const struct brw_vec4_prog_data *prog_data = &brw->vs.prog_data->base;
+
+ /* BRW_NEW_SURFACES and BRW_NEW_VS_CONSTBUF */
+ brw_vec4_upload_binding_table(brw, BRW_NEW_VS_BINDING_TABLE, stage_state,
+ prog_data);
}
const struct brw_tracked_state brw_vs_binding_table = {