Mesa (master): i965: Use brw_upload_binding_table() for the pixel shader as well.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Sep 19 17:53:39 UTC 2013


Module: Mesa
Branch: master
Commit: 113a75ff2d5013583bc41f5bd71e24d7897cd459
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=113a75ff2d5013583bc41f5bd71e24d7897cd459

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Sep 13 15:27:04 2013 -0700

i965: Use brw_upload_binding_table() for the pixel shader as well.

This is not quite the same: brw_upload_binding_table() also has code to
early-return if there are no entries, while the existing code did not.

The PS binding table is unlikely to be empty since it will have at least
one color buffer.  If it ever is empty, early returning seems wise.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |   23 ++++-----------------
 1 files changed, 5 insertions(+), 18 deletions(-)

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 8d87786..a7daa0a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -862,25 +862,12 @@ const struct brw_tracked_state brw_wm_ubo_surfaces = {
 static void
 brw_upload_wm_binding_table(struct brw_context *brw)
 {
-   uint32_t *bind;
-   int i;
+   struct brw_stage_state *stage_state = &brw->wm.base;
 
-   if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
-      gen7_create_shader_time_surface(brw, &brw->wm.base.surf_offset[SURF_INDEX_WM_SHADER_TIME]);
-   }
-
-   /* CACHE_NEW_WM_PROG */
-   unsigned entries = brw->wm.prog_data->binding_table_size;
-   bind = brw_state_batch(brw, AUB_TRACE_BINDING_TABLE,
-			  sizeof(uint32_t) * entries,
-			  32, &brw->wm.base.bind_bo_offset);
-
-   /* BRW_NEW_SURFACES */
-   for (i = 0; i < entries; i++) {
-      bind[i] = brw->wm.base.surf_offset[i];
-   }
-
-   brw->state.dirty.brw |= BRW_NEW_PS_BINDING_TABLE;
+   /* BRW_NEW_SURFACES and CACHE_NEW_WM_PROG */
+   brw_upload_binding_table(brw, BRW_NEW_PS_BINDING_TABLE, stage_state,
+                            brw->wm.prog_data->binding_table_size,
+                            SURF_INDEX_WM_SHADER_TIME);
 }
 
 const struct brw_tracked_state brw_wm_binding_table = {




More information about the mesa-commit mailing list