OSDN Git Service

svga: add 0.5 in float->int conversion of sample min/max lod
authorBrian Paul <brianp@vmware.com>
Wed, 18 Jan 2012 17:05:25 +0000 (10:05 -0700)
committerBrian Paul <brianp@vmware.com>
Wed, 18 Jan 2012 17:44:05 +0000 (10:44 -0700)
This makes lod clamping more consistent with other drivers.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/drivers/svga/svga_pipe_sampler.c

index 4885d20..13c7b18 100644 (file)
@@ -125,8 +125,8 @@ svga_create_sampler_state(struct pipe_context *pipe,
     *    - min/max LOD clamping
     */
    cso->min_lod = 0;
-   cso->view_min_lod = MAX2(sampler->min_lod, 0);
-   cso->view_max_lod = MAX2(sampler->max_lod, 0);
+   cso->view_min_lod = MAX2((int) (sampler->min_lod + 0.5), 0);
+   cso->view_max_lod = MAX2((int) (sampler->max_lod + 0.5), 0);
 
    /* Use min_mipmap */
    if (svga->debug.use_min_mipmap) {