diff options
author | Ben Skeggs <[email protected]> | 2008-02-13 19:33:41 +1100 |
---|---|---|
committer | Ben Skeggs <[email protected]> | 2008-02-13 19:33:41 +1100 |
commit | 263de4b814eb78cc971ad28f173985b61b77465c (patch) | |
tree | 0f7f9033f8b2b2572dfdf21d0264aefef79a9de7 /src/mesa | |
parent | 6be095ae15d411c82f7417c98a87867dbdf1947b (diff) |
nv40: attempt at obeying sampler min_lod/max_lod/lod_bias
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/pipe/nv40/nv40_context.c | 2 | ||||
-rw-r--r-- | src/mesa/pipe/nv40/nv40_fragtex.c | 5 | ||||
-rw-r--r-- | src/mesa/pipe/nv40/nv40_state.c | 14 |
3 files changed, 17 insertions, 4 deletions
diff --git a/src/mesa/pipe/nv40/nv40_context.c b/src/mesa/pipe/nv40/nv40_context.c index 4343d493cc5..a6e5f332e63 100644 --- a/src/mesa/pipe/nv40/nv40_context.c +++ b/src/mesa/pipe/nv40/nv40_context.c @@ -74,7 +74,7 @@ nv40_get_paramf(struct pipe_context *pipe, int param) case PIPE_CAP_MAX_TEXTURE_ANISOTROPY: return 16.0; case PIPE_CAP_MAX_TEXTURE_LOD_BIAS: - return 4.0; + return 16.0; case PIPE_CAP_BITMAP_TEXCOORD_BIAS: return 0.0; default: diff --git a/src/mesa/pipe/nv40/nv40_fragtex.c b/src/mesa/pipe/nv40/nv40_fragtex.c index 69c0fcb5e05..5af5fbe7465 100644 --- a/src/mesa/pipe/nv40/nv40_fragtex.c +++ b/src/mesa/pipe/nv40/nv40_fragtex.c @@ -108,10 +108,9 @@ nv40_fragtex_build(struct nv40_context *nv40, int unit) so_reloc (so, nv40mt->buffer, txf, tex_flags | NOUVEAU_BO_OR, NV40TCL_TEX_FORMAT_DMA0, NV40TCL_TEX_FORMAT_DMA1); so_data (so, ps->wrap); - so_data (so, NV40TCL_TEX_ENABLE_ENABLE | ps->en | - (0x00078000) /* mipmap related? */); + so_data (so, NV40TCL_TEX_ENABLE_ENABLE | ps->en); so_data (so, txs); - so_data (so, ps->filt | 0x3fd6 /*voodoo*/); + so_data (so, ps->filt | 0x2000 /*voodoo*/); so_data (so, (pt->width[0] << NV40TCL_TEX_SIZE0_W_SHIFT) | pt->height[0]); so_data (so, ps->bcol); diff --git a/src/mesa/pipe/nv40/nv40_state.c b/src/mesa/pipe/nv40/nv40_state.c index 80e94737efb..bcd244528d5 100644 --- a/src/mesa/pipe/nv40/nv40_state.c +++ b/src/mesa/pipe/nv40/nv40_state.c @@ -193,6 +193,20 @@ nv40_sampler_state_create(struct pipe_context *pipe, ps->filt = filter; + { + float limit; + + limit = CLAMP(cso->lod_bias, -16.0, 15.0); + ps->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff; + + limit = CLAMP(cso->max_lod, 0.0, 15.0); + ps->en |= (int)(limit * 256.0) << 7; + + limit = CLAMP(cso->min_lod, 0.0, 15.0); + ps->en |= (int)(limit * 256.0) << 19; + } + + if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { switch (cso->compare_func) { case PIPE_FUNC_NEVER: |