[Mesa-dev] [PATCH 12/22] i965/vs: generalize brw_vs_binding_table in preparation for GS.

Paul Berry stereotype441 at gmail.com
Mon Aug 26 15:12:43 PDT 2013


---
 src/mesa/drivers/dri/i965/brw_state.h            |  6 ++++
 src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 42 ++++++++++++++++--------
 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 e7a1b40..3a2f54f 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_vec4_context_base *vec4_ctx,
                                const struct brw_vec4_prog_data *prog_data);
+void
+brw_vec4_upload_binding_table(struct brw_context *brw,
+                              GLbitfield64 brw_new_binding_table,
+                              struct brw_vec4_context_base *vec4_ctx,
+                              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 48124bf..ac612b4 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -150,14 +150,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,
+                              GLbitfield64 brw_new_binding_table,
+                              struct brw_vec4_context_base *vec4_ctx,
+                              const struct brw_vec4_prog_data *prog_data)
 {
-   struct brw_vec4_context_base *vec4_ctx = &brw->vs.base;
    uint32_t *bind;
    int i;
 
@@ -165,13 +164,13 @@ brw_vs_upload_binding_table(struct brw_context *brw)
       gen7_create_shader_time_surface(brw, &vec4_ctx->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 (vec4_ctx->bind_bo_offset != 0) {
-	 brw->state.dirty.brw |= BRW_NEW_VS_BINDING_TABLE;
+	 brw->state.dirty.brw |= brw_new_binding_table;
 	 vec4_ctx->bind_bo_offset = 0;
       }
       return;
@@ -184,12 +183,29 @@ brw_vs_upload_binding_table(struct brw_context *brw)
 			  sizeof(uint32_t) * entries,
 			  32, &vec4_ctx->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] = vec4_ctx->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_vec4_context_base *vec4_ctx = &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, vec4_ctx,
+                                 prog_data);
 }
 
 const struct brw_tracked_state brw_vs_binding_table = {
-- 
1.8.4



More information about the mesa-dev mailing list