From: Felix Kuehling Date: Wed, 24 Mar 2004 22:05:25 +0000 (+0000) Subject: Make sure hardware culling is disabled for unfilled primitives, X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=adf33a1c6f087075b65f0fbc756839481a38e10d;p=mesa.git Make sure hardware culling is disabled for unfilled primitives, points and lines. --- diff --git a/src/mesa/drivers/dri/savage/savageioctl.c b/src/mesa/drivers/dri/savage/savageioctl.c index 8b946195c3b..1384ce6099a 100644 --- a/src/mesa/drivers/dri/savage/savageioctl.c +++ b/src/mesa/drivers/dri/savage/savageioctl.c @@ -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); } } diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c index 2542b1d29d1..cd6ba7e9ca8 100644 --- a/src/mesa/drivers/dri/savage/savagestate.c +++ b/src/mesa/drivers/dri/savage/savagestate.c @@ -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*/ diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c index c8bd5762ea3..13772df9b3a 100644 --- a/src/mesa/drivers/dri/savage/savagetris.c +++ b/src/mesa/drivers/dri/savage/savagetris.c @@ -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 ); }