OSDN Git Service

gallium: in gen_mipmap, also set sampler lod_bias and do a flush() after rendering...
authorBrian Paul <brian.paul@tungstengraphics.com>
Mon, 17 Mar 2008 15:42:08 +0000 (09:42 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Mon, 17 Mar 2008 15:42:08 +0000 (09:42 -0600)
src/mesa/state_tracker/st_gen_mipmap.c

index 9c4e103..6ae235d 100644 (file)
@@ -282,8 +282,13 @@ st_render_mipmap(struct st_context *st,
 
       /*
        * Setup sampler state
+       * Note: we should only have to set the min/max LOD clamps to ensure
+       * we grab texels from the right mipmap level.  But some hardware
+       * has trouble with min clamping so we also setting the lod_bias to
+       * try to work around that.
        */
       sampler.min_lod = sampler.max_lod = srcLevel;
+      sampler.lod_bias = srcLevel;
       sampler_cso = pipe->create_sampler_state(pipe, &sampler);
       pipe->bind_sampler_states(pipe, 1, &sampler_cso);
 
@@ -298,6 +303,7 @@ st_render_mipmap(struct st_context *st,
 
       draw_quad(st->ctx);
 
+      pipe->flush(pipe, PIPE_FLUSH_WAIT);
       pipe->delete_sampler_state(pipe, sampler_cso);
    }