summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r200/r200_state.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2003-11-24 15:21:14 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2003-11-24 15:21:14 +0000
commit57c9814b9e87924696df4c741861c29d4236d1eb (patch)
tree63c9139693032c681fad3e7b50d743b762e0a64d /src/mesa/drivers/dri/r200/r200_state.c
parent5b5cf9cb8b3f540365e3da8e4a70f6a5040a1c6c (diff)
Import vtx-0-2-branch
Diffstat (limited to 'src/mesa/drivers/dri/r200/r200_state.c')
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 55a00cd4de..27dc6fd1f2 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -2089,10 +2089,30 @@ static void r200InvalidateState( GLcontext *ctx, GLuint new_state )
r200VtxfmtInvalidate( ctx );
}
+/* A hack. The r200 can actually cope just fine with materials
+ * between begin/ends, so fix this.
+ */
+static GLboolean check_material( GLcontext *ctx )
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ GLint i;
+
+ for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT;
+ i < _TNL_ATTRIB_MAT_BACK_INDEXES;
+ i++)
+ if (tnl->vb.AttribPtr[i] &&
+ tnl->vb.AttribPtr[i]->stride)
+ return GL_TRUE;
+
+ return GL_FALSE;
+}
+
+
static void r200WrapRunPipeline( GLcontext *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
+ GLboolean has_material;
if (0)
fprintf(stderr, "%s, newstate: %x\n", __FUNCTION__, rmesa->NewGLState);
@@ -2102,7 +2122,9 @@ static void r200WrapRunPipeline( GLcontext *ctx )
if (rmesa->NewGLState)
r200ValidateState( ctx );
- if (tnl->vb.Material) {
+ has_material = (ctx->Light.Enabled && check_material( ctx ));
+
+ if (has_material) {
TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_TRUE );
}
@@ -2110,7 +2132,7 @@ static void r200WrapRunPipeline( GLcontext *ctx )
*/
_tnl_run_pipeline( ctx );
- if (tnl->vb.Material) {
+ if (has_material) {
TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_FALSE );
r200UpdateMaterial( ctx ); /* not needed any more? */
}