summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2007-12-07 15:16:42 -0800
committerEric Anholt <[email protected]>2007-12-07 15:22:57 -0800
commite34a183d870e393187b2c26e37ea1e900c2ab1f7 (patch)
tree4244d590df6d6401fb808f18fd6f1988ddc831a5 /src
parentf1efacb92b4c7e52f5f060a655a2dacfdddac44b (diff)
[965] Move brw_surface_state stack allocation into the function using it.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c58
1 files changed, 28 insertions, 30 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 0a45164a0fd..bf1a8668bed 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -140,49 +140,51 @@ static GLuint translate_tex_format( GLuint mesa_format )
}
static
-void brw_update_texture_surface( GLcontext *ctx,
- GLuint unit,
- struct brw_surface_state *surf )
+void brw_update_texture_surface( GLcontext *ctx, GLuint unit )
{
struct intel_context *intel = intel_context(ctx);
struct brw_context *brw = brw_context(ctx);
struct gl_texture_object *tObj = brw->attribs.Texture->Unit[unit]._Current;
struct intel_texture_object *intelObj = intel_texture_object(tObj);
struct gl_texture_image *firstImage = tObj->Image[0][intelObj->firstLevel];
+ struct brw_surface_state surf;
- memset(surf, 0, sizeof(*surf));
+ memset(&surf, 0, sizeof(surf));
- surf->ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW;
- surf->ss0.surface_type = translate_tex_target(tObj->Target);
- surf->ss0.surface_format = translate_tex_format(firstImage->TexFormat->MesaFormat);
+ surf.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW;
+ surf.ss0.surface_type = translate_tex_target(tObj->Target);
+ surf.ss0.surface_format = translate_tex_format(firstImage->TexFormat->MesaFormat);
/* This is ok for all textures with channel width 8bit or less:
*/
-/* surf->ss0.data_return_format = BRW_SURFACERETURNFORMAT_S1; */
+/* surf.ss0.data_return_format = BRW_SURFACERETURNFORMAT_S1; */
/* BRW_NEW_LOCK */
- surf->ss1.base_addr = bmBufferOffset(intel,
+ surf.ss1.base_addr = bmBufferOffset(intel,
intelObj->mt->region->buffer);
- surf->ss2.mip_count = intelObj->lastLevel - intelObj->firstLevel;
- surf->ss2.width = firstImage->Width - 1;
- surf->ss2.height = firstImage->Height - 1;
+ surf.ss2.mip_count = intelObj->lastLevel - intelObj->firstLevel;
+ surf.ss2.width = firstImage->Width - 1;
+ surf.ss2.height = firstImage->Height - 1;
- surf->ss3.tile_walk = BRW_TILEWALK_XMAJOR;
- surf->ss3.tiled_surface = intelObj->mt->region->tiled; /* always zero */
- surf->ss3.pitch = (intelObj->mt->pitch * intelObj->mt->cpp) - 1;
- surf->ss3.depth = firstImage->Depth - 1;
+ surf.ss3.tile_walk = BRW_TILEWALK_XMAJOR;
+ surf.ss3.tiled_surface = intelObj->mt->region->tiled; /* always zero */
+ surf.ss3.pitch = (intelObj->mt->pitch * intelObj->mt->cpp) - 1;
+ surf.ss3.depth = firstImage->Depth - 1;
- surf->ss4.min_lod = 0;
+ surf.ss4.min_lod = 0;
if (tObj->Target == GL_TEXTURE_CUBE_MAP) {
- surf->ss0.cube_pos_x = 1;
- surf->ss0.cube_pos_y = 1;
- surf->ss0.cube_pos_z = 1;
- surf->ss0.cube_neg_x = 1;
- surf->ss0.cube_neg_y = 1;
- surf->ss0.cube_neg_z = 1;
+ surf.ss0.cube_pos_x = 1;
+ surf.ss0.cube_pos_y = 1;
+ surf.ss0.cube_pos_z = 1;
+ surf.ss0.cube_neg_x = 1;
+ surf.ss0.cube_neg_y = 1;
+ surf.ss0.cube_neg_z = 1;
}
+
+ brw->wm.bind.surf_ss_offset[unit + 1] =
+ brw_cache_data( &brw->cache[BRW_SS_SURFACE], &surf );
}
@@ -243,13 +245,9 @@ static void upload_wm_surfaces(struct brw_context *brw )
/* _NEW_TEXTURE, BRW_NEW_TEXDATA
*/
if (texUnit->_ReallyEnabled &&
- intel_finalize_mipmap_tree(intel,texUnit->_Current)) {
-
- struct brw_surface_state surf;
-
- brw_update_texture_surface(ctx, i, &surf);
-
- brw->wm.bind.surf_ss_offset[i+1] = brw_cache_data( &brw->cache[BRW_SS_SURFACE], &surf );
+ intel_finalize_mipmap_tree(intel,texUnit->_Current))
+ {
+ brw_update_texture_surface(ctx, i);
brw->wm.nr_surfaces = i+2;
}
else if( texUnit->_ReallyEnabled &&