aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-01-08 16:49:43 -0700
committerBrian <[email protected]>2007-01-08 16:49:43 -0700
commit41a4e828d9e06e42bba78166975cb283674c0d9f (patch)
tree726afbae2132e30eab7380680cea5a851319737a
parent8cad795a80077f661d70121f271ab59c68f8bff3 (diff)
check if _Current == NULL for TXB
-rw-r--r--src/mesa/swrast/s_fragprog.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index c59e24debed..517b63c91b2 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -1358,6 +1358,8 @@ execute_program( GLcontext *ctx,
case OPCODE_TXB: /* GL_ARB_fragment_program only */
/* Texel lookup with LOD bias */
{
+ const struct gl_texture_unit *texUnit
+ = &ctx->Texture.Unit[inst->TexSrcUnit];
GLfloat coord[4], color[4], lambda, bias;
if (inst->SrcReg[0].File == PROGRAM_INPUT &&
inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0+inst->TexSrcUnit)
@@ -1366,9 +1368,9 @@ execute_program( GLcontext *ctx,
lambda = 0.0;
fetch_vector4(ctx, &inst->SrcReg[0], machine, program, coord);
/* coord[3] is the bias to add to lambda */
- bias = ctx->Texture.Unit[inst->TexSrcUnit].LodBias
- + ctx->Texture.Unit[inst->TexSrcUnit]._Current->LodBias
- + coord[3];
+ bias = texUnit->LodBias + coord[3];
+ if (texUnit->_Current)
+ bias += texUnit->_Current->LodBias;
fetch_texel(ctx, coord, lambda + bias, inst->TexSrcUnit, color);
store_vector4( inst, machine, color );
}