i915: Redo texture unit walking on i830.
authorEric Anholt <eric@anholt.net>
Wed, 23 Apr 2014 22:35:27 +0000 (15:35 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 30 Apr 2014 21:21:59 +0000 (14:21 -0700)
We now know what the max unit is in the context state.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i915/i830_texblend.c

index c08b2b0..e5542af 100644 (file)
@@ -440,20 +440,16 @@ void
 i830EmitTextureBlend(struct i830_context *i830)
 {
    struct gl_context *ctx = &i830->intel.ctx;
-   GLuint unit, last_stage = 0, blendunit = 0;
+   GLuint unit, blendunit = 0;
 
    I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND_ALL, false);
 
-   if (ctx->Texture._EnabledUnits) {
-      for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++)
+   if (ctx->Texture._MaxEnabledTexImageUnit != -1) {
+      for (unit = 0; unit < ctx->Texture._MaxEnabledTexImageUnit; unit++)
          if (ctx->Texture.Unit[unit]._ReallyEnabled)
-            last_stage = unit;
-
-      for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++)
-         if (ctx->Texture.Unit[unit]._ReallyEnabled)
-            emit_texblend(i830, unit, blendunit++, last_stage == unit);
-   }
-   else {
+            emit_texblend(i830, unit, blendunit++,
+                          unit == ctx->Texture._MaxEnabledTexImageUnit);
+   } else {
       emit_passthrough(i830);
    }
 }