Fix previously un-noticed issue with flat-shaded points.
authorKeith Whitwell <keith@tungstengraphics.com>
Fri, 14 Jan 2005 15:03:00 +0000 (15:03 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Fri, 14 Jan 2005 15:03:00 +0000 (15:03 +0000)
src/mesa/drivers/dri/unichrome/via_context.c
src/mesa/drivers/dri/unichrome/via_context.h
src/mesa/drivers/dri/unichrome/via_state.c
src/mesa/drivers/dri/unichrome/via_tris.c

index f2dd2cfea57b60067cff19d3ea244f1167b5e8f5..b82ffb669a9c73c5439d53a3e9acfdc6bcced6e0 100644 (file)
@@ -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:
index a1a86c9139f61ddaf2e3249e833be413d7d86084..09494cd3adfb174f59ed14c589044170cef136a8 100644 (file)
@@ -168,7 +168,6 @@ struct via_context_t {
 
     /* Hardware register
      */
-    GLuint regCmdA;
     GLuint regCmdA_End;
     GLuint regCmdB;
 
index 23a9a8d719ae3af2ee0ef533228c7ec9528ca00f..717c210a788c47b278de9038a1e48d3f61cb761e 100644 (file)
@@ -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);
 
index b28732d80dcdff2ef4a87e79844acb7381bc3e6f..8dbbc1e1c34a1c1841c2a1a7f6256e74a650a876 100644 (file)
@@ -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: