summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_fragprog.c
diff options
context:
space:
mode:
authorJulien Cristau <[email protected]>2008-07-13 19:20:03 +0200
committerJulien Cristau <[email protected]>2008-07-13 19:20:03 +0200
commit64e57ed257c559ea31cf162c67a7ef61fdc562e4 (patch)
treedee99970e9d1e6d892f21db31488470bc7929d18 /src/mesa/swrast/s_fragprog.c
parentdabd09f5a92e5497ac6ac9b4ba26f806ddb25206 (diff)
parent4fab47b13c214dc79e0ae5d8001521029ce34231 (diff)
Merge branch 'master' of git://anongit.freedesktop.org/git/mesa/mesa into debian-experimental
Conflicts: progs/tests/antialias.c progs/tools/trace/Makefile
Diffstat (limited to 'src/mesa/swrast/s_fragprog.c')
-rw-r--r--src/mesa/swrast/s_fragprog.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index ecace9c5025..bf7a1de03bc 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -44,7 +44,8 @@ fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
- lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
+ if (texObj)
+ lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
/* XXX use a float-valued TextureSample routine here!!! */
swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord,
@@ -68,20 +69,23 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
- const struct gl_texture_image *texImg = texObj->Image[0][texObj->BaseLevel];
- const GLfloat texW = (GLfloat) texImg->WidthScale;
- const GLfloat texH = (GLfloat) texImg->HeightScale;
+ GLfloat lambda;
GLchan rgba[4];
- GLfloat lambda
- = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */
- texdx[1], texdy[1], /* dt/dx, dt/dy */
- texdx[3], texdy[2], /* dq/dx, dq/dy */
- texW, texH,
- texcoord[0], texcoord[1], texcoord[3],
- 1.0F / texcoord[3]) + lodBias;
+ if (texObj) {
+ const struct gl_texture_image *texImg = texObj->Image[0][texObj->BaseLevel];
+ const GLfloat texW = (GLfloat) texImg->WidthScale;
+ const GLfloat texH = (GLfloat) texImg->HeightScale;
- lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
+ lambda = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */
+ texdx[1], texdy[1], /* dt/dx, dt/dy */
+ texdx[3], texdy[2], /* dq/dx, dq/dy */
+ texW, texH,
+ texcoord[0], texcoord[1], texcoord[3],
+ 1.0F / texcoord[3]) + lodBias;
+
+ lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
+ }
swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord,
&lambda, &rgba);