mesa: Make FEATURE_EXT_transform_feedback more modular.
[mesa.git] / src / mesa / state_tracker / st_atom_sampler.c
index 9d63f1c6ab6583b251e8d4d6514b0311477f3421..92fe72d4df60ba947a2694cccf80b90d5c61e43e 100644 (file)
@@ -194,9 +194,12 @@ update_samplers(struct st_context *st)
             sampler->normalized_coords = 1;
 
          sampler->lod_bias = st->ctx->Texture.Unit[su].LodBias;
-         sampler->min_lod = MAX2(0.0f, texobj->MinLod);
-         sampler->max_lod = MIN2(texobj->MaxLevel - texobj->BaseLevel,
-                                 texobj->MaxLod);
+
+         sampler->min_lod = texobj->BaseLevel + texobj->MinLod;
+         if (sampler->min_lod < texobj->BaseLevel)
+            sampler->min_lod = texobj->BaseLevel;
+
+         sampler->max_lod = MIN2((GLfloat) texobj->MaxLevel, texobj->MaxLod);
          if (sampler->max_lod < sampler->min_lod) {
             /* The GL spec doesn't seem to specify what to do in this case.
              * Swap the values.
@@ -211,7 +214,7 @@ update_samplers(struct st_context *st)
                             teximg ? teximg->_BaseFormat : GL_RGBA,
                             sampler->border_color);
 
-        sampler->max_anisotropy = texobj->MaxAnisotropy;
+        sampler->max_anisotropy = (texobj->MaxAnisotropy == 1.0 ? 0 : (GLuint)texobj->MaxAnisotropy);
 
          /* only care about ARB_shadow, not SGI shadow */
          if (texobj->CompareMode == GL_COMPARE_R_TO_TEXTURE) {