Mesa (nvfx-next-7j): nvfx: fix lodbias

Luca Barbieri lb at kemper.freedesktop.org
Thu Aug 19 14:49:52 PDT 2010


Module: Mesa
Branch: nvfx-next-7j
Commit: 0aa9fbcb29826a46bb76b80550fad4dbc64d2d40
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0aa9fbcb29826a46bb76b80550fad4dbc64d2d40

Author: Luca Barbieri <luca at 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 +++---
 src/gallium/drivers/nvfx/nvfx_screen.c  |    2 +-
 3 files changed, 5 insertions(+), 5 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;
 }
diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c
index a81a898..ffaba22 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.c
+++ b/src/gallium/drivers/nvfx/nvfx_screen.c
@@ -160,7 +160,7 @@ nvfx_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_cap param)
 	case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
 		return screen->is_nv4x ? 16.0 : 8.0;
 	case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
-		return screen->is_nv4x ? 16.0 : 4.0;
+		return 15.0;
 	default:
 		NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
 		return 0.0;



More information about the mesa-commit mailing list