summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/swrast/s_texture.c')
-rw-r--r--src/mesa/swrast/s_texture.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index b9e08148ecf..36f2975312d 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -4200,9 +4200,12 @@ _swrast_texture_span( GLcontext *ctx, struct sw_span *span )
if (span->arrayMask & SPAN_LAMBDA) {
if (texUnit->LodBias + curObj->LodBias != 0.0F) {
/* apply LOD bias, but don't clamp yet */
+ const GLfloat bias = CLAMP(texUnit->LodBias + curObj->LodBias,
+ -ctx->Const.MaxTextureLodBias,
+ ctx->Const.MaxTextureLodBias);
GLuint i;
for (i = 0; i < span->end; i++) {
- lambda[i] += (texUnit->LodBias + curObj->LodBias);
+ lambda[i] += bias;
}
}