added null texObj ptr check (bug 15567)
This commit is contained in:
@@ -44,6 +44,7 @@ fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
|
|||||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||||
const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
|
const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
|
||||||
|
|
||||||
|
if (texObj)
|
||||||
lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
|
lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
|
||||||
|
|
||||||
/* XXX use a float-valued TextureSample routine here!!! */
|
/* XXX use a float-valued TextureSample routine here!!! */
|
||||||
@@ -68,13 +69,15 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
|
|||||||
{
|
{
|
||||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||||
const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
|
const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
|
||||||
|
GLfloat lambda;
|
||||||
|
GLchan rgba[4];
|
||||||
|
|
||||||
|
if (texObj) {
|
||||||
const struct gl_texture_image *texImg = texObj->Image[0][texObj->BaseLevel];
|
const struct gl_texture_image *texImg = texObj->Image[0][texObj->BaseLevel];
|
||||||
const GLfloat texW = (GLfloat) texImg->WidthScale;
|
const GLfloat texW = (GLfloat) texImg->WidthScale;
|
||||||
const GLfloat texH = (GLfloat) texImg->HeightScale;
|
const GLfloat texH = (GLfloat) texImg->HeightScale;
|
||||||
GLchan rgba[4];
|
|
||||||
|
|
||||||
GLfloat lambda
|
lambda = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */
|
||||||
= _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */
|
|
||||||
texdx[1], texdy[1], /* dt/dx, dt/dy */
|
texdx[1], texdy[1], /* dt/dx, dt/dy */
|
||||||
texdx[3], texdy[2], /* dq/dx, dq/dy */
|
texdx[3], texdy[2], /* dq/dx, dq/dy */
|
||||||
texW, texH,
|
texW, texH,
|
||||||
@@ -82,6 +85,7 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
|
|||||||
1.0F / texcoord[3]) + lodBias;
|
1.0F / texcoord[3]) + lodBias;
|
||||||
|
|
||||||
lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
|
lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
|
||||||
|
}
|
||||||
|
|
||||||
swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord,
|
swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord,
|
||||||
&lambda, &rgba);
|
&lambda, &rgba);
|
||||||
|
Reference in New Issue
Block a user