Enable line stippling.
authorAlan Hourihane <alanh@tungstengraphics.com>
Fri, 14 Jan 2005 16:56:52 +0000 (16:56 +0000)
committerAlan Hourihane <alanh@tungstengraphics.com>
Fri, 14 Jan 2005 16:56:52 +0000 (16:56 +0000)
src/mesa/drivers/dri/unichrome/via_state.c
src/mesa/drivers/dri/unichrome/via_tris.c

index 717c210a788c47b278de9038a1e48d3f61cb761e..2d7a2a3b10964e2b5a088c6f867d33d34d755999 100644 (file)
@@ -162,16 +162,16 @@ void viaEmitState(viaContextPtr vmesa)
       ADVANCE_RING();
    }
     
-   if (0 && ctx->Line.StippleFlag) {
+   if (ctx->Line.StippleFlag) {
       BEGIN_RING(2);
       OUT_RING( ((HC_SubA_HLP << 24) | ctx->Line.StipplePattern) );           
-      OUT_RING( ((HC_SubA_HLPRF << 24) | ctx->Line.StippleFactor) );                  
+      OUT_RING( ((HC_SubA_HLPRF << 24) | ctx->Line.StippleFactor) );
       ADVANCE_RING();
    }
    else {
       BEGIN_RING(2);
       OUT_RING( ((HC_SubA_HLP << 24) | 0xFFFF) );         
-      OUT_RING( ((HC_SubA_HLPRF << 24) | 0x1) );              
+      OUT_RING( ((HC_SubA_HLPRF << 24) | 0xFFFF) );              
       ADVANCE_RING();
    }
 
@@ -1367,7 +1367,7 @@ static void viaChooseLineState(GLcontext *ctx)
         }
     }
 
-    if (0 && ctx->Line.StippleFlag) {
+    if (ctx->Line.StippleFlag) {
         vmesa->regEnable |= HC_HenLP_MASK;
         vmesa->regHLP = ctx->Line.StipplePattern;
         vmesa->regHLPRF = ctx->Line.StippleFactor;
index 8dbbc1e1c34a1c1841c2a1a7f6256e74a650a876..ff46de18c03970c9ccadc7315f12b904002ef0cd 100644 (file)
@@ -490,6 +490,12 @@ via_fallback_point(viaContextPtr vmesa,
     viaSpanRenderFinish( ctx );
 }
 
+static void viaResetLineStipple( GLcontext *ctx )
+{
+   viaContextPtr vmesa = VIA_CONTEXT(ctx);
+   vmesa->regCmdB |= HC_HLPrst_MASK;
+}
+
 /**********************************************************************/
 /*               Render unclipped begin/end objects                   */
 /**********************************************************************/
@@ -507,8 +513,9 @@ via_fallback_point(viaContextPtr vmesa,
     GLubyte *vertptr = (GLubyte *)vmesa->verts;                 \
     const GLuint vertsize = vmesa->vertexSize;          \
     const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts;       \
-    (void)elt;
-#define RESET_STIPPLE
+   const GLboolean stipple = ctx->Line.StippleFlag;            \
+   (void) elt; (void) stipple;
+#define RESET_STIPPLE  if ( stipple ) { printf("RESET\n"); viaResetLineStipple( ctx ); }
 #define RESET_OCCLUSION
 #define PRESERVE_VB_DEFS
 #define ELT(x) x
@@ -599,10 +606,7 @@ static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts,
                               _DD_NEW_TRI_STIPPLE |             \
                               _NEW_POLYGONSTIPPLE)
 
-/* Via does support line stipple in hardware, and it is partially
- * working in the older versions of this driver:
- */
-#define LINE_FALLBACK (DD_LINE_STIPPLE)
+#define LINE_FALLBACK (0)
 #define POINT_FALLBACK (0)
 #define TRI_FALLBACK (0)
 #define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)
@@ -1064,6 +1068,7 @@ void viaFallback(viaContextPtr vmesa, GLuint bit, GLboolean mode)
            tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
            tnl->Driver.Render.CopyPV = _tnl_copy_pv;
            tnl->Driver.Render.Interp = _tnl_interp;
+           tnl->Driver.Render.ResetLineStipple = viaResetLineStipple;
 
            _tnl_invalidate_vertex_state( ctx, ~0 );
            _tnl_invalidate_vertices( ctx, ~0 );
@@ -1098,7 +1103,7 @@ void viaInitTriFuncs(GLcontext *ctx)
     tnl->Driver.Render.Start = viaRenderStart;
     tnl->Driver.Render.Finish = viaRenderFinish;
     tnl->Driver.Render.PrimitiveNotify = viaRenderPrimitive;
-    tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
+    tnl->Driver.Render.ResetLineStipple = viaResetLineStipple;
     tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
     tnl->Driver.Render.CopyPV = _tnl_copy_pv;
     tnl->Driver.Render.Interp = _tnl_interp;