From 555867d4bdbd9463df8b9e85828e6425bf0c14f8 Mon Sep 17 00:00:00 2001
From: Fabian Bieler <[email protected]>
Date: Tue, 29 Mar 2011 11:59:08 +0200
Subject: [PATCH 4/4] st/mesa: Set min/max_lod to BaseLevel w/o mipmapping
According to chapter 3.8.8 of the OpenGL 2.1 specification, the GL should always
select base_level when TEXTURE_MIN_FILTER is set to GL_LINEAR or GL_NEAREST.
---
src/mesa/state_tracker/st_atom_sampler.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 2025720..14c1285 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -163,13 +163,18 @@ update_samplers(struct st_context *st)
if (texobj->Target != GL_TEXTURE_RECTANGLE_ARB)
sampler->normalized_coords = 1;
- sampler->lod_bias = st->ctx->Texture.Unit[texUnit].LodBias +
- texobj->LodBias;
-
- sampler->min_lod = CLAMP(texobj->BaseLevel + texobj->MinLod,
- texobj->BaseLevel, texobj->MaxLevel);
- sampler->max_lod = CLAMP(texobj->BaseLevel + texobj->MaxLod,
- texobj->BaseLevel, texobj->MaxLevel);
+ if (sampler->min_mip_filter == PIPE_TEX_MIPFILTER_NONE) {
+ sampler->lod_bias = 0;
+ sampler->min_lod = texobj->BaseLevel;
+ sampler->max_lod = texobj->BaseLevel;
+ } else {
+ sampler->lod_bias = st->ctx->Texture.Unit[texUnit].LodBias +
+ texobj->LodBias;
+ sampler->min_lod = CLAMP(texobj->BaseLevel + texobj->MinLod,
+ texobj->BaseLevel, texobj->MaxLevel);
+ sampler->max_lod = CLAMP(texobj->BaseLevel + texobj->MaxLod,
+ texobj->BaseLevel, texobj->MaxLevel);
+ }
if (sampler->max_lod < sampler->min_lod) {
/* The GL spec doesn't seem to specify what to do in this case.
--
1.7.4.1
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev