Adam K Kirchhoff wrote:
I finally got Marble Blast and was able to reproduce this. Unfortunatly, this was caused by some of my recent changes. :( The problem is that in if texture unit 1 is enabled and texture unit 0 is disabled, disable_tex will call r200UpdateTextureEnv to put it into a "pass through" mode. This is apparently as close as the r200 can get to disabling a texture unit. When the unit is disabled, texUnit->_Current will be NULL. Therefore, tObj will also be NULL.Program received signal SIGSEGV, Segmentation fault. r200UpdateTextureEnv (ctx=0x8391a38, unit=0) at r200_texstate.c:739 739 const GLenum format = tObj->Image[tObj->BaseLevel]->Format; (gdb) bt #0 r200UpdateTextureEnv (ctx=0x8391a38, unit=0) at r200_texstate.c:739 #1 0x40cc5419 in disable_tex (ctx=0x8391a38, unit=0) at r200_texstate.c:1401
In any case, here is a patch against the trunk that should fix the problem. I verified the fix by playing a few levels of Marble Blast. Cute game. It reminds me of Super Monkey Ball 2, but it's not quite as annoying. :)
This won't need to be applied to the mesa-4-0-4 branch as the problem was never introduced there.
Index: lib/GL/mesa/src/drv/r200/r200_texstate.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/r200/r200_texstate.c,v
retrieving revision 1.11
diff -u -d -r1.11 r200_texstate.c
--- lib/GL/mesa/src/drv/r200/r200_texstate.c 7 Feb 2003 20:07:03 -0000 1.11
+++ lib/GL/mesa/src/drv/r200/r200_texstate.c 13 Feb 2003 23:27:49 -0000
@@ -748,16 +748,18 @@
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- const struct gl_texture_object *tObj = texUnit->_Current;
- const GLenum format = tObj->Image[tObj->BaseLevel]->Format;
GLuint color_combine, alpha_combine;
GLuint color_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2];
GLuint alpha_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2];
+ /* texUnit->_Current can be NULL if and only if the texture unit is
+ * not actually enabled.
+ */
+ assert( (texUnit->_ReallyEnabled == 0)
+ || (texUnit->_Current != NULL) );
if ( R200_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %d ) format=%s\n", __FUNCTION__,
- ctx, unit, _mesa_lookup_enum_by_nr( format ) );
+ fprintf( stderr, "%s( %p, %d )\n", __FUNCTION__, ctx, unit );
}
/* Set the texture environment state. Isn't this nice and clean?
@@ -775,6 +777,8 @@
alpha_combine = r200_alpha_combine[unit][R200_DISABLE];
}
else {
+ const struct gl_texture_object *tObj = texUnit->_Current;
+ const GLenum format = tObj->Image[tObj->BaseLevel]->Format;
GLuint color_arg[3], alpha_arg[3];
GLuint i, numColorArgs = 0, numAlphaArgs = 0;
GLuint RGBshift = texUnit->CombineScaleShiftRGB;
@@ -1064,6 +1068,10 @@
case GL_DOT3_RGB_EXT:
case GL_DOT3_RGBA_EXT:
+ /* The EXT version of the DOT3 extension does not support the
+ * scale factor, but the ARB version (and the version in OpenGL
+ * 1.3) does.
+ */
RGBshift = 0;
Ashift = 0;
/* FALLTHROUGH */
@@ -1188,9 +1196,7 @@
}
/* Step 3:
- * Apply the scale factor. The EXT version of the DOT3 extension does
- * not support the scale factor, but the ARB version (and the version in
- * OpenGL 1.3) does.
+ * Apply the scale factor.
*/
color_scale &= ~R200_TXC_SCALE_MASK;
alpha_scale &= ~R200_TXA_SCALE_MASK;
