i965: Move prepare_wm_surfaces texobj declarations inside of _ReallyEnabled.
authorEric Anholt <eric@anholt.net>
Tue, 17 May 2011 16:11:38 +0000 (09:11 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 31 May 2011 19:07:28 +0000 (12:07 -0700)
Interestingly, the compiler wasn't doing this for us at -O2, so we
were doing the computation for every non-_ReallyEnabled unit.

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

index de1953ed60055964948a1c05a9f95de8a9355da9..a3111768d62a64c681dcad04102146089c7d7de5 100644 (file)
@@ -558,10 +558,11 @@ prepare_wm_surfaces(struct brw_context *brw)
 
    for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
       const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
-      struct gl_texture_object *tObj = texUnit->_Current;
-      struct intel_texture_object *intelObj = intel_texture_object(tObj);
 
       if (texUnit->_ReallyEnabled) {
+        struct gl_texture_object *tObj = texUnit->_Current;
+        struct intel_texture_object *intelObj = intel_texture_object(tObj);
+
         brw_add_validated_bo(brw, intelObj->mt->region->buffer);
         nr_surfaces = SURF_INDEX_TEXTURE(i) + 1;
       }