From e764f10ea557c9d819ad25bf1e700b1b3bd83277 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 May 2011 10:55:40 -0700 Subject: i965: Replace struct with bit shifting for WM null surfaces. 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 --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/mesa') 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 854e69dcd3a..6c1eba69d4b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -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; } /** -- cgit v1.2.3