On Die, 2003-02-25 at 05:13, Keith Whitwell wrote:
> > 
> > I think I figured out the underlying problem.
> > 
> > In core mesa, all statechanges are preceded by a call to 
> > ctx->Driver.FlushVertices(), to ensure all buffered vertices are fired 
> > before the state is changed.  This is currently set to 
> > _tnl_FlushVertices(), which doesn't do anything to notify the driver 
> > about this impending statechange.
> > 
> > We should probably wrap _tnl_FlushVertices() and install that instead in 
> > ctx->Driver.FlushVertices().
> > 
> > I'll code something up & post a patch.
> > 
> > Keith
> 
> Can you test this change?

It does fix the problems I saw with SW TCL in the r200 driver. For
reference, here's my result of applying the patch to the r200 driver.

I suspect there's still a similar bug in the r100 vtxfmt code, causing
the wrong textures in armagetron (this patch doesn't help that).


-- 
Earthling Michel D�nzer (MrCooper)/ Debian GNU/Linux (powerpc) developer
XFree86 and DRI project member   /  CS student, Free Software enthusiast
Index: lib/GL/mesa/src/drv/r200/r200_context.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/r200/r200_context.c,v
retrieving revision 1.19
diff -p -u -r1.19 r200_context.c
--- lib/GL/mesa/src/drv/r200/r200_context.c	6 Feb 2003 20:41:40 -0000	1.19
+++ lib/GL/mesa/src/drv/r200/r200_context.c	25 Feb 2003 21:27:44 -0000
@@ -433,6 +433,7 @@ GLboolean r200CreateContext( const __GLc
     */
    _tnl_destroy_pipeline( ctx );
    _tnl_install_pipeline( ctx, r200_pipeline );
+   ctx->Driver.FlushVertices = r200FlushVertices;
 
    /* Try and keep materials and vertices separate:
     */
Index: lib/GL/mesa/src/drv/r200/r200_swtcl.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c,v
retrieving revision 1.7
diff -p -u -r1.7 r200_swtcl.c
--- lib/GL/mesa/src/drv/r200/r200_swtcl.c	1 Dec 2002 21:51:49 -0000	1.7
+++ lib/GL/mesa/src/drv/r200/r200_swtcl.c	25 Feb 2003 21:27:49 -0000
@@ -46,6 +46,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DE
 #include "math/m_translate.h"
 #include "tnl/tnl.h"
 #include "tnl/t_context.h"
+#include "tnl/t_imm_exec.h"
 #include "tnl/t_pipeline.h"
 
 #include "r200_context.h"
@@ -1222,6 +1223,14 @@ r200PointsBitmap( GLcontext *ctx, GLint 
       r200ChooseVertexState( ctx );
 }
 
+
+void r200FlushVertices( GLcontext *ctx, GLuint flags )
+{
+   _tnl_flush_vertices( ctx, flags );
+
+   if (flags & FLUSH_STORED_VERTICES) 
+      R200_FIREVERTICES( R200_CONTEXT( ctx ) );
+}
 
 /**********************************************************************/
 /*                            Initialization.                         */
Index: lib/GL/mesa/src/drv/r200/r200_swtcl.h
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/r200/r200_swtcl.h,v
retrieving revision 1.3
diff -p -u -r1.3 r200_swtcl.h
--- lib/GL/mesa/src/drv/r200/r200_swtcl.h	25 Nov 2002 15:46:09 -0000	1.3
+++ lib/GL/mesa/src/drv/r200/r200_swtcl.h	25 Feb 2003 21:27:49 -0000
@@ -42,6 +42,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DE
 extern void r200InitSwtcl( GLcontext *ctx );
 extern void r200DestroySwtcl( GLcontext *ctx );
 
+extern void r200FlushVertices( GLcontext *ctx, GLuint flags );
 extern void r200ChooseRenderState( GLcontext *ctx );
 extern void r200ChooseVertexState( GLcontext *ctx );
 
Index: lib/GL/mesa/src/drv/r200/r200_vtxfmt.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c,v
retrieving revision 1.9
diff -p -u -r1.9 r200_vtxfmt.c
--- lib/GL/mesa/src/drv/r200/r200_vtxfmt.c	16 Dec 2002 21:22:27 -0000	1.9
+++ lib/GL/mesa/src/drv/r200/r200_vtxfmt.c	25 Feb 2003 21:27:49 -0000
@@ -39,6 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DE
 #include "r200_ioctl.h"
 #include "r200_tex.h"
 #include "r200_tcl.h"
+#include "r200_swtcl.h"
 #include "r200_vtxfmt.h"
 
 #include "api_noop.h"
@@ -59,7 +60,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DE
 
 struct r200_vb vb;
 
-static void r200FlushVertices( GLcontext *, GLuint );
+static void r200VtxFmtFlushVertices( GLcontext *, GLuint );
 
 static void count_func( const char *name,  struct dynfn *l )
 {
@@ -357,12 +358,13 @@ static void VFMT_FALLBACK_OUTSIDE_BEGIN_
       fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
 
    if (ctx->Driver.NeedFlush) 
-      r200FlushVertices( ctx, ctx->Driver.NeedFlush );
+      r200VtxFmtFlushVertices( ctx, ctx->Driver.NeedFlush );
 
    if (ctx->NewState)
       _mesa_update_state( ctx ); /* clear state so fell_back sticks */
 
    _tnl_wakeup_exec( ctx );
+   ctx->Driver.FlushVertices = r200FlushVertices;
 
    assert( rmesa->dma.flush == 0 );
    rmesa->vb.fell_back = GL_TRUE;
@@ -404,6 +406,7 @@ static void VFMT_FALLBACK( const char *c
    prim = rmesa->vb.prim[0];
    ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
    _tnl_wakeup_exec( ctx );
+   ctx->Driver.FlushVertices = r200FlushVertices;
 
    assert(rmesa->dma.flush == 0);
    rmesa->vb.fell_back = GL_TRUE;
@@ -759,7 +762,7 @@ static void r200VtxfmtValidate( GLcontex
 	    fprintf(stderr, "reinstall (new install)\n");
 
 	 _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
-	 ctx->Driver.FlushVertices = r200FlushVertices;
+	 ctx->Driver.FlushVertices = r200VtxFmtFlushVertices;
 	 ctx->Driver.NewList = r200NewList;
 	 rmesa->vb.installed = GL_TRUE;
 	 vb.context = ctx;
@@ -775,6 +778,7 @@ static void r200VtxfmtValidate( GLcontex
 	 if (rmesa->dma.flush)
 	    rmesa->dma.flush( rmesa );
 	 _tnl_wakeup_exec( ctx );
+	 ctx->Driver.FlushVertices = r200FlushVertices;
 	 rmesa->vb.installed = GL_FALSE;
 	 vb.context = 0;
       }
@@ -934,7 +938,7 @@ static GLboolean r200NotifyBegin( GLcont
    return GL_TRUE;
 }
 
-static void r200FlushVertices( GLcontext *ctx, GLuint flags )
+static void r200VtxFmtFlushVertices( GLcontext *ctx, GLuint flags )
 {
    r200ContextPtr rmesa = R200_CONTEXT( ctx );
 

Reply via email to