From a74d22ba715da5e52efb15aebd15a74851f87d43 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 29 Jun 2008 10:30:47 -0700 Subject: [PATCH] r300: Change LOD bias emission to more closely follow per-tex rules. Okay, this time it's for real, and for good. This should be a perma-fix. --- src/mesa/drivers/dri/r300/r300_state.c | 6 ++++-- src/mesa/drivers/dri/r300/r300_tex.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 1d4472d59ef..00351014af3 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1456,8 +1456,10 @@ 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 - | r300CalculateTexLodBias(r300->LODBias); + /* Make LOD bias a bit more per-tex and less per-everything. */ + t->filter_1 &= ~R300_LOD_BIAS_MASK; + t->filter_1 |= r300CalculateTexLodBias(ctx->Texture.Unit[i].LodBias); + r300->hw.tex.filter_1.cmd[R300_TEX_VALUE_0 + hw_tmu] = t->filter_1; r300->hw.tex.size.cmd[R300_TEX_VALUE_0 + hw_tmu] = t->size; r300->hw.tex.format.cmd[R300_TEX_VALUE_0 + diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index 505951329fe..4ed71777d39 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -955,7 +955,6 @@ static void r300TexEnv(GLcontext * ctx, GLenum target, */ switch (pname) { case GL_TEXTURE_LOD_BIAS_EXT: { - /* Needs to be relocated in order to make sure we got the right tmu */ GLfloat bias, min; /* The R300's LOD bias is a signed 2's complement value with a @@ -968,7 +967,14 @@ static void r300TexEnv(GLcontext * ctx, GLenum target, "no_neg_lod_bias") ? 0.0 : -16.0; bias = CLAMP(bias, min, 16.0); - rmesa->LODBias = bias; + /* There's probably a magic Mesa method for finding the REAL + * texture unit. I don't know it, though. */ + if (!(ctx->Texture._EnabledUnits & (1 << ctx->Texture.CurrentUnit))) { + break; + } + + /* Save our newly clamped LOD bias. */ + ctx->Texture.Unit[ctx->Texture.CurrentUnit].LodBias = bias; break; } -- 2.30.2