summaryrefslogtreecommitdiff
path: root/src/mesa/swrast/s_fragprog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/swrast/s_fragprog.c')
-rw-r--r--src/mesa/swrast/s_fragprog.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 474aab3aa2..4067fd6886 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -46,8 +46,7 @@ fetch_texel( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
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,
+ swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord,
&lambda, &rgba);
color[0] = CHAN_TO_FLOAT(rgba[0]);
color[1] = CHAN_TO_FLOAT(rgba[1]);
@@ -63,7 +62,7 @@ fetch_texel( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
static void
fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
const GLfloat texdx[4], const GLfloat texdy[4],
- GLuint unit, GLfloat color[4] )
+ GLfloat lodBias, GLuint unit, GLfloat color[4] )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
@@ -72,15 +71,17 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
const GLfloat texH = (GLfloat) texImg->HeightScale;
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]);
+ 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;
- swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current,
- 1, (const GLfloat (*)[4]) texcoord,
+ lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
+
+ swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord,
&lambda, &rgba);
color[0] = CHAN_TO_FLOAT(rgba[0]);
color[1] = CHAN_TO_FLOAT(rgba[1]);