--- Begin Message ---
Aapo Tahkola wrote:
key->unit[unit].Optx.Source was set to SRC_PRIMARY_COLOR and thus didn't get 
caught by load_texenv_source().

Hope that helps.


Aapo,

Try this patch, it fixes a couple of glitches in the texture preload logic.

Keith
Index: texenvprogram.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/main/texenvprogram.c,v
retrieving revision 1.41
diff -u -r1.41 texenvprogram.c
--- texenvprogram.c	24 Jan 2006 23:04:51 -0000	1.41
+++ texenvprogram.c	17 Mar 2006 14:53:47 -0000
@@ -928,9 +928,12 @@
 			  
       /* TODO: Use D0_MASK_XY where possible.
        */
-      p->src_texture[unit] = emit_texld( p, OPCODE_TXP,
-					 tmp, WRITEMASK_XYZW, 
-					 unit, dim, texcoord );
+      if (p->state->unit[src - SRC_TEXTURE0].enabled) 
+	 p->src_texture[unit] = emit_texld( p, OPCODE_TXP,
+					    tmp, WRITEMASK_XYZW, 
+					    unit, dim, texcoord );
+      else
+	 p->src_texture[unit] = get_zero(p);
    }
 }
 
@@ -950,8 +953,6 @@
    case SRC_TEXTURE5:
    case SRC_TEXTURE6:
    case SRC_TEXTURE7:       
-      if (!p->state->unit[src - SRC_TEXTURE0].enabled)
-	 return GL_FALSE;
       load_texture(p, src - SRC_TEXTURE0);
       break;
       
@@ -970,12 +971,15 @@
 load_texunit_sources( struct texenv_fragment_program *p, int unit )
 {
    struct state_key *key = p->state;
-   int i, nr = key->unit[unit].NumArgsRGB;
-   for (i = 0; i < nr; i++) {
-      if (!load_texenv_source( p, key->unit[unit].OptRGB[i].Source, unit) ||
-	  !load_texenv_source( p, key->unit[unit].OptA[i].Source, unit ))
-	 return GL_FALSE;
+
+   for (i = 0; i < key->unit[unit].NumArgsRGB; i++) {
+      load_texenv_source( p, key->unit[unit].OptRGB[i].Source, unit);
+   }
+
+   for (i = 0; i < key->unit[unit].NumArgsA; i++) {
+      load_texenv_source( p, key->unit[unit].OptA[i].Source, unit );
    }
+
    return GL_TRUE;
 }
 
@@ -1028,8 +1032,8 @@
        */
       for (unit = 0 ; unit < ctx->Const.MaxTextureUnits ; unit++)
 	 if (key->unit[unit].enabled) {
-	    if (load_texunit_sources( &p, unit ))
-	       p.last_tex_stage = unit;
+	    load_texunit_sources( &p, unit );
+	    p.last_tex_stage = unit;
 	 }
 
       /* Second pass - emit combine instructions to build final color:

--- End Message ---

Reply via email to