r200: Fix swtnl fallback to flush pending rendering before transition.
authorPauli Nieminen <suokkos@gmail.com>
Sun, 21 Mar 2010 18:16:17 +0000 (20:16 +0200)
committerPauli Nieminen <suokkos@gmail.com>
Sun, 21 Mar 2010 18:27:49 +0000 (20:27 +0200)
Flush after transition would emit wrong state that could cause
wrong state emited for pending rendering operation.

Fixes wan once from extrement tuxracer that is using per vertex
materials.

src/mesa/drivers/dri/r200/r200_tcl.c

index 41b68cc0ca02d5d158e84be18067959b6ef59d77..f52e4fe91770c3d69ae74cd2e75a9b885f570e74 100644 (file)
@@ -691,20 +691,30 @@ void r200TclFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
        GLuint oldfallback = rmesa->radeon.TclFallback;
 
        if (mode) {
-               rmesa->radeon.TclFallback |= bit;
                if (oldfallback == 0) {
+                       /* We have to flush before transition */
+                       if ( rmesa->radeon.dma.flush )
+                               rmesa->radeon.dma.flush( rmesa->radeon.glCtx );
+
                        if (R200_DEBUG & RADEON_FALLBACKS)
                                fprintf(stderr, "R200 begin tcl fallback %s\n",
                                                getFallbackString( bit ));
+                       rmesa->radeon.TclFallback |= bit;
                        transition_to_swtnl( ctx );
-               }
+               } else
+                       rmesa->radeon.TclFallback |= bit;
        } else {
-               rmesa->radeon.TclFallback &= ~bit;
                if (oldfallback == bit) {
+                       /* We have to flush before transition */
+                       if ( rmesa->radeon.dma.flush )
+                               rmesa->radeon.dma.flush( rmesa->radeon.glCtx );
+
                        if (R200_DEBUG & RADEON_FALLBACKS)
                                fprintf(stderr, "R200 end tcl fallback %s\n",
                                                getFallbackString( bit ));
+                       rmesa->radeon.TclFallback &= ~bit;
                        transition_to_hwtnl( ctx );
-               }
+               } else
+                       rmesa->radeon.TclFallback &= ~bit;
        }
 }