mesa: fix logic error in computing enableBits in update_texture_state()
authorBrian Paul <brianp@vmware.com>
Sat, 7 Feb 2009 18:20:08 +0000 (11:20 -0700)
committerBrian Paul <brianp@vmware.com>
Sat, 7 Feb 2009 18:20:08 +0000 (11:20 -0700)
If we had a vertex shader but no fragment shader (i.e. fixed function) we
didn't get the right enabled texture targets.

Fixes blank/white texture problem.

src/mesa/main/texstate.c

index f7a4d8b323b7326a7b87baefced8e05d41f95125..be6ce186896f88798849710cc9d878fc2e79dbeb 100644 (file)
@@ -488,25 +488,27 @@ update_texture_state( GLcontext *ctx )
       texUnit->_ReallyEnabled = 0;
       texUnit->_GenFlags = 0;
 
-      /* Get the bitmask of texture enables.
+      /* Get the bitmask of texture target enables.
        * enableBits will be a mask of the TEXTURE_*_BIT flags indicating
        * which texture targets are enabled (fixed function) or referenced
        * by a fragment shader/program.  When multiple flags are set, we'll
        * settle on the one with highest priority (see texture_override below).
        */
-      if (fprog || vprog) {
-         enableBits = 0x0;
-         if (fprog)
-            enableBits |= fprog->Base.TexturesUsed[unit];
-         if (vprog)
-            enableBits |= vprog->Base.TexturesUsed[unit];
+      enableBits = 0x0;
+      if (vprog) {
+         enableBits |= vprog->Base.TexturesUsed[unit];
+      }
+      if (fprog) {
+         enableBits |= fprog->Base.TexturesUsed[unit];
       }
       else {
-         if (!texUnit->Enabled)
-            continue;
-         enableBits = texUnit->Enabled;
+         /* fixed-function fragment program */
+         enableBits |= texUnit->Enabled;
       }
 
+      if (enableBits == 0x0)
+         continue;
+
       ASSERT(texUnit->Current1D);
       ASSERT(texUnit->Current2D);
       ASSERT(texUnit->Current3D);