From: Ben Skeggs Date: Wed, 13 Feb 2008 08:33:41 +0000 (+1100) Subject: nv40: attempt at obeying sampler min_lod/max_lod/lod_bias X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f33fa253c66241724fe4ae6943b091e0bc0409d6;p=mesa.git nv40: attempt at obeying sampler min_lod/max_lod/lod_bias --- diff --git a/src/mesa/pipe/nv40/nv40_context.c b/src/mesa/pipe/nv40/nv40_context.c index 302ad04c154..a8a2eaf2157 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: