diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2008-07-08 15:11:19 -0600 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2008-07-08 15:13:23 -0600 |
commit | 9a9e839b9b132a7d42cf3b6ff45c5ddfeed1b714 (patch) | |
tree | 8a0f972bb9fe3faeb7cee492d59f1d380a70266d | |
parent | aa522e14eecdb571ee0826a44b78b36a23213be6 (diff) | |
download | mesa-9a9e839b9b132a7d42cf3b6ff45c5ddfeed1b714.tar.gz |
added null texObj ptr check (bug 15567)
-rw-r--r-- | src/mesa/swrast/s_fragprog.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index 89114ebc9d6..2bed1b7b9db 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -42,7 +42,8 @@ fetch_texel( 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, @@ -65,20 +66,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); |