gallium: add missing mip level clamp
authorBrian <brian.paul@tungstengraphics.com>
Sat, 16 Feb 2008 20:55:47 +0000 (13:55 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Sat, 16 Feb 2008 20:55:47 +0000 (13:55 -0700)
src/gallium/drivers/softpipe/sp_tex_sample.c

index a15bd43166d24ceed33cafded6eb66493eef5220..c54e9d385c25bba0545e47a97d7dab0c8d9526cd 100644 (file)
@@ -474,7 +474,8 @@ choose_mipmap_levels(struct tgsi_sampler *sampler,
 {
    if (sampler->state->min_mip_filter == PIPE_TEX_MIPFILTER_NONE) {
       /* no mipmap selection needed */
-      *level0 = *level1 = (int) sampler->state->min_lod;
+      *level0 = *level1 = CLAMP((int) sampler->state->min_lod,
+                                0, (int) sampler->texture->last_level);
 
       if (sampler->state->min_img_filter != sampler->state->mag_img_filter) {
          /* non-mipmapped texture, but still need to determine if doing