Enabled user-defined point size, enabled zbiases for rest of the primitives and fixed...
authorAapo Tahkola <aet@rasterburn.org>
Wed, 9 Feb 2005 05:53:34 +0000 (05:53 +0000)
committerAapo Tahkola <aet@rasterburn.org>
Wed, 9 Feb 2005 05:53:34 +0000 (05:53 +0000)
src/mesa/drivers/dri/r300/r300_render.c
src/mesa/drivers/dri/r300/r300_state.c

index 1b4f74c..56c8a5a 100644 (file)
@@ -191,11 +191,13 @@ static int r300_get_num_verts(r300ContextPtr rmesa,
                break;          
        case GL_LINE_STRIP:
                name="LS";
-               verts_off = num_verts % 2;
+               if(num_verts < 2)
+                       verts_off = num_verts;
                break;
        case GL_LINE_LOOP:
                name="LL";
-               verts_off = num_verts % 2;
+               if(num_verts < 2)
+                       verts_off = num_verts;
                break;
        case GL_TRIANGLES:
                name="T";
@@ -685,10 +687,10 @@ static GLboolean r300_run_render(GLcontext *ctx,
        if (RADEON_DEBUG == DEBUG_PRIMS)
                fprintf(stderr, "%s\n", __FUNCTION__);
        
-
+       
    #if 1
        
-       #if 0
+       #if 1
         return r300_run_immediate_render(ctx, stage);
        #else 
         return r300_run_vb_render(ctx, stage);
@@ -779,8 +781,8 @@ static void r300_check_render(GLcontext *ctx, struct tnl_pipeline_stage *stage)
        FALLBACK_IF(ctx->Point.SmoothFlag); // GL_POINT_SMOOTH
        if (ctx->Extensions.NV_point_sprite || ctx->Extensions.ARB_point_sprite)
                FALLBACK_IF(ctx->Point.PointSprite); // GL_POINT_SPRITE_NV
-       FALLBACK_IF(ctx->Polygon.OffsetPoint); // GL_POLYGON_OFFSET_POINT
-       FALLBACK_IF(ctx->Polygon.OffsetLine); // GL_POLYGON_OFFSET_LINE
+       //FALLBACK_IF(ctx->Polygon.OffsetPoint); // GL_POLYGON_OFFSET_POINT
+       //FALLBACK_IF(ctx->Polygon.OffsetLine); // GL_POLYGON_OFFSET_LINE
        //FALLBACK_IF(ctx->Polygon.OffsetFill); // GL_POLYGON_OFFSET_FILL
        //if(ctx->Polygon.OffsetFill)WARN_ONCE("Polygon.OffsetFill not implemented, ignoring\n");
        FALLBACK_IF(ctx->Polygon.SmoothFlag); // GL_POLYGON_SMOOTH
index 0abe242..a1ce6a2 100644 (file)
@@ -502,15 +502,23 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state)
        case GL_POLYGON_OFFSET_POINT:
        case GL_POLYGON_OFFSET_LINE:
                WARN_ONCE("Don't know how to enable polygon offset point/line. Help me !\n");
+               
+               /* Something is apparently blocking these from working */
+               R300_STATECHANGE(r300, unk42B4);
+               if(state){
+                       r300->hw.unk42B4.cmd[1] |= ~(3<<0);
+               } else {
+                       r300->hw.unk42B4.cmd[1] &= (3<<0);
+               }
                break;
                
        case GL_POLYGON_OFFSET_FILL:
                R300_STATECHANGE(r300, unk42B4);
                if(state){
-                       r300->hw.unk42B4.cmd[1] |= 3;
-                       } else {
-                       r300->hw.unk42B4.cmd[1] &= ~3;
-                       }
+                       r300->hw.unk42B4.cmd[1] |= (3<<0);
+               } else {
+                       r300->hw.unk42B4.cmd[1] &= ~(3<<0);
+               }
                break;
                
        case GL_VERTEX_PROGRAM_ARB:
@@ -632,10 +640,18 @@ static void r300ColorMask(GLcontext* ctx,
 static void r300PointSize(GLcontext * ctx, GLfloat size)
 {
        r300ContextPtr r300 = R300_CONTEXT(ctx);
-
+       
+       /* TODO: Validate point size */
+       R300_STATECHANGE(r300, ps);
+       r300->hw.ps.cmd[R300_PS_POINTSIZE] =
+               ((int)(size * 6) << R300_POINTSIZE_X_SHIFT) |
+               ((int)(size * 6) << R300_POINTSIZE_Y_SHIFT);
+       
+#if 0 /* r200 reg? */
        /* This might need fixing later */
        R300_STATECHANGE(r300, vps);
        r300->hw.vps.cmd[R300_VPS_POINTSIZE] = r300PackFloat32(1.0);
+#endif 
 }
 /* =============================================================
  * Stencil
@@ -1767,9 +1783,12 @@ void r300ResetHwState(r300ContextPtr r300)
 
        r300->hw.unk4214.cmd[1] = 0x00050005;
 
+       r300PointSize(ctx, ctx->Point.Size);
+#if 0  
        r300->hw.ps.cmd[R300_PS_POINTSIZE] = (6 << R300_POINTSIZE_X_SHIFT) |
                                             (6 << R300_POINTSIZE_Y_SHIFT);
-
+#endif 
+                       
        r300->hw.unk4230.cmd[1] = 0x01800000;
        r300->hw.unk4230.cmd[2] = 0x00020006;
        r300->hw.unk4230.cmd[3] = r300PackFloat32(1.0 / 192.0);