i965/vs: generalize brw_vs_binding_table in preparation for GS.
authorPaul Berry <stereotype441@gmail.com>
Sun, 25 Aug 2013 08:23:08 +0000 (01:23 -0700)
committerPaul Berry <stereotype441@gmail.com>
Sun, 1 Sep 2013 00:12:15 +0000 (17:12 -0700)
v2: Use GLbitfield instead of GLbitfield64 in
brw_vec4_upload_binding_table.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_state.h
src/mesa/drivers/dri/i965/brw_vs_surface_state.c

index 695a84c473bd32a5aa1e1604fbf0872c9791a63f..c2df9e59ad3cf439899127c60f766fe39c886bf6 100644 (file)
@@ -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
 }
index b55febefda02d014fd8d4cbe773640ec3005da32..dbf26f47cfde00ec4f625e7851bfffecc662f4b9 100644 (file)
@@ -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 = {