* 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);
}
}
if (imesa->dirty & ~SAVAGE_UPLOAD_CLIPRECTS)
{
+ savageUpdateCull(imesa->glCtx);
if (imesa->dirty & (SAVAGE_UPLOAD_CTX | SAVAGE_UPLOAD_TEX0 | \
SAVAGE_UPLOAD_TEX1 | SAVAGE_UPLOAD_BUFFERS))
{
/* 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*/
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 *
* 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
/* 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.
{
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
+ FLUSH_BATCH(imesa);
+
/* Update culling */
if (imesa->raster_primitive != prim)
imesa->dirty |= SAVAGE_UPLOAD_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 );
}