dri/nv04: Enable eng3dm for A8/L8 textures.
authorAndrew Randrianasulu <randrianasulu@gmail.com>
Tue, 14 Sep 2010 02:29:52 +0000 (04:29 +0200)
committerFrancisco Jerez <currojerez@riseup.net>
Thu, 16 Sep 2010 17:44:20 +0000 (19:44 +0200)
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
src/mesa/drivers/dri/nouveau/nv04_context.c

index 1d34c8635096af9c6c24a144e660f851a074746d..9c32b480b0f030d587a2d743553da2448b7b6dcf 100644 (file)
 #include "nouveau_class.h"
 #include "nv04_driver.h"
 
+static GLboolean
+texunit_needs_combiners(struct gl_texture_unit *u)
+{
+       struct gl_texture_object *t = u->_Current;
+       struct gl_texture_image *ti = t->Image[0][t->BaseLevel];
+
+       return ti->TexFormat == MESA_FORMAT_A8 ||
+               ti->TexFormat == MESA_FORMAT_L8 ||
+               u->EnvMode == GL_COMBINE ||
+               u->EnvMode == GL_COMBINE4_NV ||
+               u->EnvMode == GL_BLEND ||
+               u->EnvMode == GL_ADD;
+}
+
 struct nouveau_grobj *
 nv04_context_engine(GLcontext *ctx)
 {
@@ -38,10 +52,8 @@ nv04_context_engine(GLcontext *ctx)
        struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw;
        struct nouveau_grobj *fahrenheit;
 
-       if (ctx->Texture.Unit[0].EnvMode == GL_COMBINE ||
-           ctx->Texture.Unit[0].EnvMode == GL_COMBINE4_NV ||
-           ctx->Texture.Unit[0].EnvMode == GL_BLEND ||
-           ctx->Texture.Unit[0].EnvMode == GL_ADD ||
+       if ((ctx->Texture.Unit[0]._ReallyEnabled &&
+            texunit_needs_combiners(&ctx->Texture.Unit[0])) ||
            ctx->Texture.Unit[1]._ReallyEnabled ||
            ctx->Stencil.Enabled)
                fahrenheit = hw->eng3dm;