summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h1
-rw-r--r--src/mesa/drivers/dri/r300/r300_tex.c19
2 files changed, 15 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index 1a90f5cabb2..6279a67ab16 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -925,6 +925,7 @@ struct r300_context {
driTextureObject swapped;
int texture_depth;
float initialMaxAnisotropy;
+ float LODBias;
/* Clientdata textures;
*/
diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c
index b672baca1b6..a3d6f90ef6a 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.c
+++ b/src/mesa/drivers/dri/r300/r300_tex.c
@@ -1005,6 +1005,7 @@ static GLenum r300TexUnitTarget(struct gl_texture_unit *unit) {
} else if (unit->Enabled & (TEXTURE_CUBE_BIT)) {
return GL_TEXTURE_CUBE_MAP;
}
+ return 0;
}
static void r300TexEnv(GLcontext * ctx, GLenum target,
@@ -1037,13 +1038,17 @@ static void r300TexEnv(GLcontext * ctx, GLenum target,
/* This next part feels quite hackish;
* is there a cleaner way? */
- struct gl_texture_object *texObj;
GLenum target = r300TexUnitTarget(&ctx->Texture.Unit[ctx->Texture.CurrentUnit]);
- texObj = _mesa_select_tex_object(ctx, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], target);
- r300TexObjPtr t = (r300TexObjPtr) texObj->DriverData;
- texObj->LodBias = bias;
+ 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);
+ r300SetTexLodBias(t, texObj->LodBias);
+ }
+
+ rmesa->LODBias = bias;
break;
}
@@ -1175,6 +1180,10 @@ static struct gl_texture_object *r300NewTextureObject(GLcontext * ctx,
return NULL;
obj->MaxAnisotropy = rmesa->initialMaxAnisotropy;
+ /* Attempt to fill LOD bias, if previously set.
+ * Should start at 0.0, which won't affect the HW. */
+ obj->LodBias = rmesa->LODBias;
+
r300AllocTexObj(obj);
return obj;
}