summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2005-08-18 20:01:01 +0000
committerIan Romanick <[email protected]>2005-08-18 20:01:01 +0000
commit61ac29e7c6db3a899edd9d80f8dbbb98fd7ccc90 (patch)
tree992ddf68267f85cbb05e76bf32f19a0c1cd3b9a6 /src/mesa
parentb462855c24dc750b386fbd632b60f3fca3fe7d07 (diff)
Don't try to update hardware texture fields if there is no hardware texture.
This can happen when all the texture enables for a texture unit are disabled. This fixes bugzilla #3195.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i810/i810context.c2
-rw-r--r--src/mesa/drivers/dri/i810/i810tex.c50
2 files changed, 28 insertions, 24 deletions
diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c
index f72842989e1..b2399b9061b 100644
--- a/src/mesa/drivers/dri/i810/i810context.c
+++ b/src/mesa/drivers/dri/i810/i810context.c
@@ -72,7 +72,7 @@ int I810_DEBUG = (0);
PUBLIC const char __driConfigOptions[] = { 0 };
const GLuint __driNConfigOptions = 0;
-#define DRIVER_DATE "20021125"
+#define DRIVER_DATE "20050818"
static const GLubyte *i810GetString( GLcontext *ctx, GLenum name )
{
diff --git a/src/mesa/drivers/dri/i810/i810tex.c b/src/mesa/drivers/dri/i810/i810tex.c
index 72919caba88..34a299ae744 100644
--- a/src/mesa/drivers/dri/i810/i810tex.c
+++ b/src/mesa/drivers/dri/i810/i810tex.c
@@ -282,48 +282,52 @@ static void i810TexParameter( GLcontext *ctx, GLenum target,
}
+/**
+ * Setup hardware bits for new texture environment settings.
+ *
+ * \todo
+ * Determine whether or not \c param can be used instead of
+ * \c texUnit->EnvColor in the \c GL_TEXTURE_ENV_COLOR case.
+ */
static void i810TexEnv( GLcontext *ctx, GLenum target,
GLenum pname, const GLfloat *param )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
- GLuint unit = ctx->Texture.CurrentUnit;
+ const GLuint unit = ctx->Texture.CurrentUnit;
+ const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
/* Only one env color. Need a fallback if env colors are different
* and texture setup references env color in both units.
*/
switch (pname) {
case GL_TEXTURE_ENV_COLOR: {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLfloat *fc = texUnit->EnvColor;
- GLuint r, g, b, a, col;
- CLAMPED_FLOAT_TO_UBYTE(r, fc[0]);
- CLAMPED_FLOAT_TO_UBYTE(g, fc[1]);
- CLAMPED_FLOAT_TO_UBYTE(b, fc[2]);
- CLAMPED_FLOAT_TO_UBYTE(a, fc[3]);
-
- col = ((a << 24) |
- (r << 16) |
- (g << 8) |
- (b << 0));
-
- if (imesa->Setup[I810_CTXREG_CF1] != col) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_CF1] = col;
+ GLubyte c[4];
+ GLuint envColor;
+
+ UNCLAMPED_FLOAT_TO_RGBA_CHAN( c, texUnit->EnvColor );
+ envColor = PACK_COLOR_8888( c[3], c[0], c[1], c[2] );
+
+ if (imesa->Setup[I810_CTXREG_CF1] != envColor) {
+ I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
+ imesa->Setup[I810_CTXREG_CF1] = envColor;
}
break;
}
+
case GL_TEXTURE_ENV_MODE:
imesa->TexEnvImageFmt[unit] = 0; /* force recalc of env state */
break;
- case GL_TEXTURE_LOD_BIAS_EXT:
- {
- struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
- i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData;
- t->Setup[I810_TEXREG_MLC] &= ~(MLC_LOD_BIAS_MASK);
- t->Setup[I810_TEXREG_MLC] |= i810ComputeLodBias(*param);
+ case GL_TEXTURE_LOD_BIAS: {
+ if ( texUnit->_Current != NULL ) {
+ const struct gl_texture_object *tObj = texUnit->_Current;
+ i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData;
+
+ t->Setup[I810_TEXREG_MLC] &= ~(MLC_LOD_BIAS_MASK);
+ t->Setup[I810_TEXREG_MLC] |= i810ComputeLodBias(*param);
}
break;
+ }
default:
break;