r300: Make LOD bias a persistent environment variable.
Per airlied's suggestion.
This commit is contained in:
@@ -1381,6 +1381,18 @@ static void r500SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings)
|
||||
}
|
||||
}
|
||||
|
||||
static GLuint r300CalculateTexLodBias(GLfloat bias)
|
||||
{
|
||||
GLuint b;
|
||||
b = (unsigned int)fabsf(ceilf(bias*31));
|
||||
if (signbit(bias)) {
|
||||
b ^= 0x3ff; /* 10 bits */
|
||||
}
|
||||
b <<= 3;
|
||||
b &= R300_LOD_BIAS_MASK;
|
||||
return b;
|
||||
}
|
||||
|
||||
static void r300SetupTextures(GLcontext * ctx)
|
||||
{
|
||||
int i, mtu;
|
||||
@@ -1444,7 +1456,8 @@ static void r300SetupTextures(GLcontext * ctx)
|
||||
r300->hw.tex.filter.cmd[R300_TEX_VALUE_0 +
|
||||
hw_tmu] =
|
||||
gen_fixed_filter(t->filter) | (hw_tmu << 28);
|
||||
r300->hw.tex.filter_1.cmd[R300_TEX_VALUE_0 + hw_tmu] = t->filter_1;
|
||||
r300->hw.tex.filter_1.cmd[R300_TEX_VALUE_0 + hw_tmu] = t->filter_1
|
||||
| r300CalculateTexLodBias(r300->LODBias);
|
||||
r300->hw.tex.size.cmd[R300_TEX_VALUE_0 + hw_tmu] =
|
||||
t->size;
|
||||
r300->hw.tex.format.cmd[R300_TEX_VALUE_0 +
|
||||
|
@@ -284,7 +284,6 @@ static r300TexObjPtr r300AllocTexObj(struct gl_texture_object *texObj)
|
||||
r300SetTexWrap(t, texObj->WrapS, texObj->WrapT, texObj->WrapR);
|
||||
r300SetTexFilter(t, texObj->MinFilter, texObj->MagFilter, texObj->MaxAnisotropy);
|
||||
r300SetTexBorderColor(t, texObj->_BorderChan);
|
||||
r300SetTexLodBias(t, texObj->LodBias);
|
||||
}
|
||||
|
||||
return t;
|
||||
@@ -1036,18 +1035,6 @@ static void r300TexEnv(GLcontext * ctx, GLenum target,
|
||||
"no_neg_lod_bias") ? 0.0 : -16.0;
|
||||
bias = CLAMP(bias, min, 16.0);
|
||||
|
||||
/* This next part feels quite hackish;
|
||||
* is there a cleaner way? */
|
||||
GLenum target = r300TexUnitTarget(&ctx->Texture.Unit[ctx->Texture.CurrentUnit]);
|
||||
if (target) {
|
||||
struct gl_texture_object *texObj =
|
||||
_mesa_select_tex_object(ctx, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], target);
|
||||
r300TexObjPtr t = (r300TexObjPtr) texObj->DriverData;
|
||||
texObj->LodBias = bias;
|
||||
|
||||
r300SetTexLodBias(t, texObj->LodBias);
|
||||
}
|
||||
|
||||
rmesa->LODBias = bias;
|
||||
|
||||
break;
|
||||
|
Reference in New Issue
Block a user