Module: Mesa
Branch: nvfx-merge-candidate
Commit: fc3862a5b343615a33979717edffc5d5ef1f607d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc3862a5b343615a33979717edffc5d5ef1f607d

Author: Luca Barbieri <l...@luca-barbieri.com>
Date:   Thu Aug 19 22:47:03 2010 +0200

nvfx: fix lodbias

---

 src/gallium/drivers/nvfx/nv30_fragtex.c |    2 +-
 src/gallium/drivers/nvfx/nv40_fragtex.c |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nv30_fragtex.c 
b/src/gallium/drivers/nvfx/nv30_fragtex.c
index db8a8fc..0c3d43f 100644
--- a/src/gallium/drivers/nvfx/nv30_fragtex.c
+++ b/src/gallium/drivers/nvfx/nv30_fragtex.c
@@ -21,7 +21,7 @@ nv30_sampler_state_init(struct pipe_context *pipe,
                        ps->en |= NV34TCL_TX_ENABLE_ANISO_2X;
        }
 
-       limit = CLAMP(cso->lod_bias, -16.0, 15.0);
+       limit = CLAMP(cso->lod_bias, -16.0, 15.0 + (255.0 / 256.0));
        ps->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff;
 
        ps->max_lod = (int)CLAMP(cso->max_lod, 0.0, 15.0);
diff --git a/src/gallium/drivers/nvfx/nv40_fragtex.c 
b/src/gallium/drivers/nvfx/nv40_fragtex.c
index 5fe742f..106ce71 100644
--- a/src/gallium/drivers/nvfx/nv40_fragtex.c
+++ b/src/gallium/drivers/nvfx/nv40_fragtex.c
@@ -29,11 +29,11 @@ nv40_sampler_state_init(struct pipe_context *pipe,
                        ps->en |= NV40TCL_TEX_ENABLE_ANISO_2X;
        }
 
-       limit = CLAMP(cso->lod_bias, -16.0, 15.0);
+       limit = CLAMP(cso->lod_bias, -16.0, 15.0 + (255.0 / 256.0));
        ps->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff;
 
-       ps->max_lod = (int)(CLAMP(cso->max_lod, 0.0, 15.0) * 256.0);
-       ps->min_lod = (int)(CLAMP(cso->min_lod, 0.0, 15.0) * 256.0);
+       ps->max_lod = (int)(CLAMP(cso->max_lod, 0.0, 15.0 + (255.0 / 256.0)) * 
256.0);
+       ps->min_lod = (int)(CLAMP(cso->min_lod, 0.0, 15.0 + (255.0 / 256.0)) * 
256.0);
 
        ps->en |= NV40TCL_TEX_ENABLE_ENABLE;
 }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to