Mesa (master): svga: add 0.5 in float->int conversion of sample min/max lod

Brian Paul brianp at kemper.freedesktop.org
Wed Jan 18 17:45:35 UTC 2012


Module: Mesa
Branch: master
Commit: 5abcd198b8e644c0d97c6766c6707e20fe22f0fb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5abcd198b8e644c0d97c6766c6707e20fe22f0fb

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Jan 18 10:05:25 2012 -0700

svga: add 0.5 in float->int conversion of sample min/max lod

This makes lod clamping more consistent with other drivers.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca at vmware.com>

---

 src/gallium/drivers/svga/svga_pipe_sampler.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
index 4885d20..13c7b18 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -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) {




More information about the mesa-commit mailing list