gallium: tweak texture filter min/mag thresholds
[mesa.git] / src / gallium / drivers / softpipe / sp_tex_sample.c
index c0128f81d71627d56f131ee6c8b00278cc1a7354..a15bd43166d24ceed33cafded6eb66493eef5220 100644 (file)
@@ -474,7 +474,6 @@ choose_mipmap_levels(struct tgsi_sampler *sampler,
 {
    if (sampler->state->min_mip_filter == PIPE_TEX_MIPFILTER_NONE) {
       /* no mipmap selection needed */
-      *imgFilter = sampler->state->mag_img_filter;
       *level0 = *level1 = (int) sampler->state->min_lod;
 
       if (sampler->state->min_img_filter != sampler->state->mag_img_filter) {
@@ -482,13 +481,16 @@ choose_mipmap_levels(struct tgsi_sampler *sampler,
           * minification or magnification.
           */
          float lambda = compute_lambda(sampler, s, t, p, lodbias);
-         if (lambda < 0.5) { /* XXX this may need tweaking... */
+         if (lambda <= 0.0) {
             *imgFilter = sampler->state->mag_img_filter;
          }
          else {
             *imgFilter = sampler->state->min_img_filter;
          }
       }
+      else {
+         *imgFilter = sampler->state->mag_img_filter;
+      }
    }
    else {
       float lambda;
@@ -500,7 +502,7 @@ choose_mipmap_levels(struct tgsi_sampler *sampler,
          /* vertex shader */
          lambda = lodbias; /* not really a bias, but absolute LOD */
 
-      if (lambda < 0.0) { /* XXX threshold depends on the filter */
+      if (lambda <= 0.0) { /* XXX threshold depends on the filter */
          /* magnifying */
          *imgFilter = sampler->state->mag_img_filter;
          *level0 = *level1 = 0;