summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 2b53741460f..19d41e7061a 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -166,7 +166,9 @@ update_samplers(struct st_context *st)
sampler->lod_bias = st->ctx->Texture.Unit[texUnit].LodBias +
texobj->LodBias;
- sampler->min_lod = MAX2(0.0f, texobj->MinLod);
+ sampler->min_lod = CLAMP(texobj->MinLod,
+ 0.0f,
+ (GLfloat) texobj->MaxLevel - texobj->BaseLevel);
sampler->max_lod = MIN2((GLfloat) texobj->MaxLevel - texobj->BaseLevel,
texobj->MaxLod);
if (sampler->max_lod < sampler->min_lod) {