From 4ccee80190532fc70631331eab66b9e5712adbe9 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 14 Jan 2005 15:03:00 +0000 Subject: [PATCH] Fix previously un-noticed issue with flat-shaded points. --- src/mesa/drivers/dri/unichrome/via_context.c | 1 + src/mesa/drivers/dri/unichrome/via_context.h | 1 - src/mesa/drivers/dri/unichrome/via_state.c | 16 ----------- src/mesa/drivers/dri/unichrome/via_tris.c | 30 +++++++++++--------- 4 files changed, 18 insertions(+), 30 deletions(-) diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index f2dd2cfea57..b82ffb669a9 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -469,6 +469,7 @@ viaCreateContext(const __GLcontextModes *mesaVis, vmesa->texHeap = mmInit(0, viaScreen->textureSize); vmesa->renderIndex = ~0; vmesa->setupIndex = ~0; + vmesa->hwPrimitive = GL_POLYGON+1; /* KW: Hardwire this. Was previously set bogusly in * viaCreateBuffer. Needs work before PBUFFER can be used: diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h index a1a86c9139f..09494cd3adf 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.h +++ b/src/mesa/drivers/dri/unichrome/via_context.h @@ -168,7 +168,6 @@ struct via_context_t { /* Hardware register */ - GLuint regCmdA; GLuint regCmdA_End; GLuint regCmdB; diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c index 23a9a8d719a..717c210a788 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.c +++ b/src/mesa/drivers/dri/unichrome/via_state.c @@ -780,7 +780,6 @@ void viaInitState(GLcontext *ctx) { viaContextPtr vmesa = VIA_CONTEXT(ctx); - vmesa->regCmdA = HC_ACMD_HCmdA; vmesa->regCmdB = HC_ACMD_HCmdB; vmesa->regEnable = HC_HenCW_MASK; @@ -1355,18 +1354,6 @@ static void viaChooseDepthState(GLcontext *ctx) } } -static void viaChooseLightState(GLcontext *ctx) -{ - viaContextPtr vmesa = VIA_CONTEXT(ctx); - - if (ctx->Light.ShadeModel == GL_SMOOTH) { - vmesa->regCmdA |= HC_HShading_Gouraud; - } - else { - vmesa->regCmdA &= ~HC_HShading_Gouraud; - } -} - static void viaChooseLineState(GLcontext *ctx) { viaContextPtr vmesa = VIA_CONTEXT(ctx); @@ -1559,9 +1546,6 @@ void viaValidateState( GLcontext *ctx ) if (vmesa->newState & _NEW_FOG) viaChooseFogState(ctx); - if (vmesa->newState & _NEW_LIGHT) - viaChooseLightState(ctx); - if (vmesa->newState & _NEW_LINE) viaChooseLineState(ctx); diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c index b28732d80dc..8dbbc1e1c34 100644 --- a/src/mesa/drivers/dri/unichrome/via_tris.c +++ b/src/mesa/drivers/dri/unichrome/via_tris.c @@ -837,10 +837,7 @@ static void viaRenderStart(GLcontext *ctx) static void viaRenderFinish(GLcontext *ctx) { - if (VIA_CONTEXT(ctx)->renderIndex & VIA_FALLBACK_BIT) - _swrast_flush(ctx); - else - VIA_FINISH_PRIM(VIA_CONTEXT(ctx)); + VIA_FINISH_PRIM(VIA_CONTEXT(ctx)); } @@ -870,42 +867,46 @@ void viaRasterPrimitive(GLcontext *ctx, viaEmitState(vmesa); } + vmesa->regCmdA_End = HC_ACMD_HCmdA; + + if (ctx->Light.ShadeModel == GL_SMOOTH) { + vmesa->regCmdA_End |= HC_HShading_Gouraud; + } regCmdB = vmesa->regCmdB; switch (hwprim) { case GL_POINTS: - vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Point | HC_HVCycle_Full; - if (ctx->Light.ShadeModel == GL_FLAT) - vmesa->regCmdA_End |= HC_HShading_FlatA; + vmesa->regCmdA_End |= HC_HPMType_Point | HC_HVCycle_Full; + vmesa->regCmdA_End |= HC_HShading_Gouraud; /* always Gouraud shade points?!? */ break; case GL_LINES: - vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Line | HC_HVCycle_Full; + vmesa->regCmdA_End |= HC_HPMType_Line | HC_HVCycle_Full; if (ctx->Light.ShadeModel == GL_FLAT) vmesa->regCmdA_End |= HC_HShading_FlatB; break; case GL_LINE_LOOP: case GL_LINE_STRIP: - vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Line | HC_HVCycle_AFP | + vmesa->regCmdA_End |= HC_HPMType_Line | HC_HVCycle_AFP | HC_HVCycle_AB | HC_HVCycle_NewB; regCmdB |= HC_HVCycle_AB | HC_HVCycle_NewB | HC_HLPrst_MASK; if (ctx->Light.ShadeModel == GL_FLAT) vmesa->regCmdA_End |= HC_HShading_FlatB; break; case GL_TRIANGLES: - vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Tri | HC_HVCycle_Full; + vmesa->regCmdA_End |= HC_HPMType_Tri | HC_HVCycle_Full; if (ctx->Light.ShadeModel == GL_FLAT) vmesa->regCmdA_End |= HC_HShading_FlatC; break; case GL_TRIANGLE_STRIP: - vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Tri | HC_HVCycle_AFP | + vmesa->regCmdA_End |= HC_HPMType_Tri | HC_HVCycle_AFP | HC_HVCycle_AC | HC_HVCycle_BB | HC_HVCycle_NewC; regCmdB |= HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; if (ctx->Light.ShadeModel == GL_FLAT) vmesa->regCmdA_End |= HC_HShading_FlatB; break; case GL_TRIANGLE_FAN: - vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Tri | HC_HVCycle_AFP | + vmesa->regCmdA_End |= HC_HPMType_Tri | HC_HVCycle_AFP | HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; regCmdB |= HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; if (ctx->Light.ShadeModel == GL_FLAT) @@ -918,7 +919,7 @@ void viaRasterPrimitive(GLcontext *ctx, abort(); return; case GL_POLYGON: - vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Tri | HC_HVCycle_AFP | + vmesa->regCmdA_End |= HC_HPMType_Tri | HC_HVCycle_AFP | HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; regCmdB |= HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; if (ctx->Light.ShadeModel == GL_FLAT) @@ -963,6 +964,9 @@ void viaRasterPrimitive(GLcontext *ctx, vmesa->hwPrimitive = hwprim; vmesa->dmaLastPrim = vmesa->dmaLow; } + else { + assert(!vmesa->newEmitState); + } } /* Callback for mesa: -- 2.30.2