summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texenvprogram.c
diff options
context:
space:
mode:
authorAapo Tahkola <[email protected]>2006-03-28 10:26:34 +0000
committerAapo Tahkola <[email protected]>2006-03-28 10:26:34 +0000
commitb8915340eab706776244e04547f64444f0ff2f8b (patch)
treecbf6617a1d1981ea4f55a5bd0c2805f6ff954702 /src/mesa/main/texenvprogram.c
parent1155f64cc094fcc865f55f22d07ce8b5e1fa2f34 (diff)
fix #6072 (Keith Whitwell)
Diffstat (limited to 'src/mesa/main/texenvprogram.c')
-rw-r--r--src/mesa/main/texenvprogram.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index e5263916b8c..02ff833dab4 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -928,9 +928,12 @@ static void load_texture( struct texenv_fragment_program *p, GLuint unit )
/* 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[unit].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 @@ static GLboolean load_texenv_source( struct texenv_fragment_program *p,
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,16 @@ static GLboolean
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;
+ GLuint i;
+
+ 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 +1033,8 @@ create_new_program(struct state_key *key, GLcontext *ctx,
*/
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: