r200: Fix lod bias correction.

glean/pointSprite shows that rv280 is trying to read from better
quality mipmap level. We have to correct default lod bias to match
required texture selection.
This commit is contained in:
Pauli Nieminen 2010-02-07 02:50:48 +02:00
parent bfa877cdd3
commit 76a9831b2b
3 changed files with 7 additions and 4 deletions

View File

@ -950,6 +950,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R200_TEXCOORD_ZERO (7 << 16)
#define R200_TEXCOORD_MASK (7 << 16)
#define R200_LOD_BIAS_MASK (0xfff80000)
#define R200_LOD_BIAS_FIXED_ONE (0x08000000)
#define R200_LOD_BIAS_CORRECTION (0x00600000)
#define R200_LOD_BIAS_SHIFT 19
#define R200_PP_TXSIZE_0 0x2c0c /* NPOT only */
#define R200_PP_TX_WIDTHMASK_SHIFT 0

View File

@ -1386,7 +1386,7 @@ void r200InitState( r200ContextPtr rmesa )
rmesa->hw.tex[i].cmd[TEX_PP_BORDER_COLOR] = 0;
rmesa->hw.tex[i].cmd[TEX_PP_TXFORMAT_X] =
(/* R200_TEXCOORD_PROJ | */
0x100000); /* Small default bias */
R200_LOD_BIAS_CORRECTION); /* Small default bias */
if (rmesa->radeon.radeonScreen->drmSupportsFragShader) {
rmesa->hw.tex[i].cmd[TEX_PP_TXOFFSET_NEWDRM] =
rmesa->radeon.radeonScreen->texOffset[RADEON_LOCAL_TEX_HEAP];

View File

@ -324,18 +324,19 @@ static void r200TexEnv( GLcontext *ctx, GLenum target,
case GL_TEXTURE_LOD_BIAS_EXT: {
GLfloat bias, min;
GLuint b;
const int fixed_one = 0x8000000;
const int fixed_one = R200_LOD_BIAS_FIXED_ONE;
/* The R200's LOD bias is a signed 2's complement value with a
* range of -16.0 <= bias < 16.0.
*
* NOTE: Add a small bias to the bias for conform mipsel.c test.
*/
bias = *param + .01;
bias = *param;
min = driQueryOptionb (&rmesa->radeon.optionCache, "no_neg_lod_bias") ?
0.0 : -16.0;
bias = CLAMP( bias, min, 16.0 );
b = (int)(bias * fixed_one) & R200_LOD_BIAS_MASK;
b = ((int)(bias * fixed_one)
+ R200_LOD_BIAS_CORRECTION) & R200_LOD_BIAS_MASK;
if ( (rmesa->hw.tex[unit].cmd[TEX_PP_TXFORMAT_X] & R200_LOD_BIAS_MASK) != b ) {
R200_STATECHANGE( rmesa, tex[unit] );