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-Tag: mesa-7.8~4139^2~496^2~298^2~16^2~384^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f33fa253c66241724fe4ae6943b091e0bc0409d6;p=platform%2Fupstream%2Fmesa.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 302ad04..a8a2eaf 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 69c0fcb..5af5fbe 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 80e9473..bcd2445 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: