Make sure hardware culling is disabled for unfilled primitives,
authorFelix Kuehling <fxkuehl@gmx.de>
Wed, 24 Mar 2004 22:05:25 +0000 (22:05 +0000)
committerFelix Kuehling <fxkuehl@gmx.de>
Wed, 24 Mar 2004 22:05:25 +0000 (22:05 +0000)
points and lines.

src/mesa/drivers/dri/savage/savageioctl.c
src/mesa/drivers/dri/savage/savagestate.c
src/mesa/drivers/dri/savage/savagetris.c

index 8b946195c3bd236790a28f32c88322bc7854e966..1384ce6099a3ad4380ad347a47791d770952d059 100644 (file)
@@ -412,6 +412,10 @@ void savageFlushVerticesLocked( savageContextPtr imesa )
      * in savagedma.c that emits drawing commands. Cliprects are not handled
      * yet. */
     if (buffer->used) {
+       /* State must be updated "per primitive" because hardware
+        * culling must be disabled for unfilled primitives, points
+        * and lines. */
+       savageEmitHwStateLocked (imesa);
        savageFakeVertices (imesa, buffer);
     }
 }
index 2542b1d29d1581ad92839e67f5f904d98dcaad42..cd6ba7e9ca8eb9aa9558ee50ad90dda68b53fdec 100644 (file)
@@ -1584,6 +1584,7 @@ void savageEmitHwStateLocked( savageContextPtr imesa )
 
     if (imesa->dirty & ~SAVAGE_UPLOAD_CLIPRECTS)
     {
+        savageUpdateCull(imesa->glCtx);
         if (imesa->dirty & (SAVAGE_UPLOAD_CTX | SAVAGE_UPLOAD_TEX0  | \
                             SAVAGE_UPLOAD_TEX1 | SAVAGE_UPLOAD_BUFFERS))
         {
@@ -1832,7 +1833,6 @@ void savageDDRenderStart(GLcontext *ctx)
         /* set scissor to the first clip box*/
         savageDDScissor(ctx,pbox->x1,pbox->y1,pbox->x2,pbox->y2);
 
-        savageUpdateCull(ctx);
         savageDDUpdateHwState(ctx); /* update to hardware register*/
     }
     else /* need not render at all*/
index c8bd5762ea3b799cc5c1e68a5a8f533cc73f0d0b..13772df9b3a8fc8a84b29d1100ee966fabef175c 100644 (file)
@@ -56,6 +56,21 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 static void savageRasterPrimitive( GLcontext *ctx, GLuint prim );
 static void savageRenderPrimitive( GLcontext *ctx, GLenum prim );
+
+
+static GLenum reduced_prim[GL_POLYGON+1] = {
+   GL_POINTS,
+   GL_LINES,
+   GL_LINES,
+   GL_LINES,
+   GL_TRIANGLES,
+   GL_TRIANGLES,
+   GL_TRIANGLES,
+   GL_TRIANGLES,
+   GL_TRIANGLES,
+   GL_TRIANGLES
+};
+
  
 /***********************************************************************
  *                    Emit primitives                                  *
@@ -311,7 +326,8 @@ do {                                                                \
  *                Helpers for rendering unfilled primitives            *
  ***********************************************************************/
 
-#define RASTERIZE(x)
+#define RASTERIZE(x) if (imesa->raster_primitive != reduced_prim[x]) \
+                        savageRasterPrimitive( ctx, x )
 #define RENDER_PRIMITIVE imesa->render_primitive
 #define IND SAVAGE_FALLBACK_BIT
 #define TAG(x) x
@@ -644,19 +660,6 @@ static void savageRunPipeline( GLcontext *ctx )
 /*                 High level hooks for t_vb_render.c                 */
 /**********************************************************************/
 
-static GLenum reduced_prim[GL_POLYGON+1] = {
-   GL_POINTS,
-   GL_LINES,
-   GL_LINES,
-   GL_LINES,
-   GL_TRIANGLES,
-   GL_TRIANGLES,
-   GL_TRIANGLES,
-   GL_TRIANGLES,
-   GL_TRIANGLES,
-   GL_TRIANGLES
-};
-
 /* This is called when Mesa switches between rendering triangle
  * primitives (such as GL_POLYGON, GL_QUADS, GL_TRIANGLE_STRIP, etc),
  * and lines, points and bitmaps.
@@ -670,6 +673,8 @@ static void savageRasterPrimitive( GLcontext *ctx, GLuint prim )
 {
    savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
 
+   FLUSH_BATCH(imesa);
+
    /* Update culling */
    if (imesa->raster_primitive != prim)
       imesa->dirty |= SAVAGE_UPLOAD_CTX;
@@ -795,6 +800,11 @@ static void savageRenderFinish( GLcontext *ctx )
    /* Release the lock */
    savageDDRenderEnd( ctx );
 
+   /* Flush the last primitive now, before any state is changed.
+    * Alternatively state could be emitted in all state-changing
+    * functions in savagestate.c. */
+   FLUSH_BATCH(SAVAGE_CONTEXT(ctx));
+
    if (SAVAGE_CONTEXT(ctx)->RenderIndex & SAVAGE_FALLBACK_BIT)
       _swrast_flush( ctx );
 }