gallium: implement min vs. mag filter determination for non-mipmapped textures
authorBrian <brian.paul@tungstengraphics.com>
Sat, 16 Feb 2008 17:05:01 +0000 (10:05 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Sat, 16 Feb 2008 17:05:24 +0000 (10:05 -0700)
Fixes tests/minmag.c

src/gallium/drivers/softpipe/sp_tex_sample.c

index 2f82fd6..c0128f8 100644 (file)
@@ -476,6 +476,19 @@ choose_mipmap_levels(struct tgsi_sampler *sampler,
       /* 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) {
+         /* non-mipmapped texture, but still need to determine if doing
+          * minification or magnification.
+          */
+         float lambda = compute_lambda(sampler, s, t, p, lodbias);
+         if (lambda < 0.5) { /* XXX this may need tweaking... */
+            *imgFilter = sampler->state->mag_img_filter;
+         }
+         else {
+            *imgFilter = sampler->state->min_img_filter;
+         }
+      }
    }
    else {
       float lambda;