i965: Replace struct with bit shifting for WM null surfaces.
authorEric Anholt <eric@anholt.net>
Tue, 17 May 2011 17:55:40 +0000 (10:55 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 31 May 2011 19:07:29 +0000 (12:07 -0700)
Reduces compiled size of brw_wm_surface_state.o another 1.9%.

Overall, this brw_wm_surface_state reduction series cuts
firefox-talos-gfx runtime by 0.68% +/- 0.42% (n=6).

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_wm_surface_state.c

index 854e69dcd3a4f8820bf44f7eeaa0266c62096349..6c1eba69d4b248eaf7218f1f7bde301dbbfae33b 100644 (file)
@@ -400,23 +400,23 @@ static void
 brw_update_null_renderbuffer_surface(struct brw_context *brw, unsigned int unit)
 {
    struct intel_context *intel = &brw->intel;
-   struct brw_surface_state *surf;
-
-   surf = brw_state_batch(brw, sizeof(*surf), 32,
-                        &brw->wm.surf_offset[unit]);
-   memset(surf, 0, sizeof(*surf));
+   uint32_t *surf;
 
-   surf->ss0.surface_type = BRW_SURFACE_NULL;
-   surf->ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
+   surf = brw_state_batch(brw, 6 * 4, 32, &brw->wm.surf_offset[unit]);
 
+   surf[0] = (BRW_SURFACE_NULL << BRW_SURFACE_TYPE_SHIFT |
+             BRW_SURFACEFORMAT_B8G8R8A8_UNORM << BRW_SURFACE_FORMAT_SHIFT);
    if (intel->gen < 6) {
-      /* _NEW_COLOR */
-      surf->ss0.color_blend = 0;
-      surf->ss0.writedisable_red =   1;
-      surf->ss0.writedisable_green = 1;
-      surf->ss0.writedisable_blue =  1;
-      surf->ss0.writedisable_alpha = 1;
+      surf[0] |= (1 << BRW_SURFACE_WRITEDISABLE_R_SHIFT |
+                 1 << BRW_SURFACE_WRITEDISABLE_G_SHIFT |
+                 1 << BRW_SURFACE_WRITEDISABLE_B_SHIFT |
+                 1 << BRW_SURFACE_WRITEDISABLE_A_SHIFT);
    }
+   surf[1] = 0;
+   surf[2] = 0;
+   surf[3] = 0;
+   surf[4] = 0;
+   surf[5] = 0;
 }
 
 /**