Minor r200 vertex program cleanups. Remove disabled leftovers from r300 vertex progra...
[mesa.git] / src / mesa / drivers / dri / i810 / i810render.c
index 8d388d88b3fffbedfc6a0a822fb39341ed58dd74..a31d54236cb9878e0479aa30fe468dda2212f001 100644 (file)
@@ -93,20 +93,6 @@ static const GLenum reduced_prim[GL_POLYGON+1] = {
    GL_TRIANGLES
 };
 
-/* Fallback to normal rendering.
- */
-static void VERT_FALLBACK( GLcontext *ctx,
-                          GLuint start,
-                          GLuint count,
-                          GLuint flags )
-{
-   TNLcontext *tnl = TNL_CONTEXT(ctx);
-   tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
-   tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
-   tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, 
-                                                         count, flags );
-   I810_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_CLIP;
-}
 
 
 
@@ -115,16 +101,17 @@ static void VERT_FALLBACK( GLcontext *ctx,
    I810_STATECHANGE(imesa, 0);                                         \
    i810RasterPrimitive( ctx, reduced_prim[prim], hw_prim[prim] );      \
 } while (0)
-#define NEW_PRIMITIVE()  I810_STATECHANGE( imesa, 0 )
-#define NEW_BUFFER()  I810_FIREVERTICES( imesa )
 #define GET_CURRENT_VB_MAX_VERTS() \
   (((int)imesa->vertex_high - (int)imesa->vertex_low) / (imesa->vertex_size*4))
 #define GET_SUBSEQUENT_VB_MAX_VERTS() \
   (I810_DMA_BUF_SZ-4) / (imesa->vertex_size * 4)
 
+#define ALLOC_VERTS( nr ) \
+  i810AllocDmaLow( imesa, (nr) * imesa->vertex_size * 4)
+#define EMIT_VERTS( ctx, j, nr, buf ) \
+  i810_emit_contiguous_verts(ctx, j, (j)+(nr), buf)
 
-#define EMIT_VERTS( ctx, j, nr ) \
-  i810_emit_contiguous_verts(ctx, j, (j)+(nr))
+#define FLUSH()  I810_FIREVERTICES( imesa )
 
 
 #define TAG(x) i810_##x
@@ -137,30 +124,35 @@ static void VERT_FALLBACK( GLcontext *ctx,
 
 
 static GLboolean i810_run_render( GLcontext *ctx,
-                                 struct gl_pipeline_stage *stage )
+                                 struct tnl_pipeline_stage *stage )
 {
    i810ContextPtr imesa = I810_CONTEXT(ctx);
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    struct vertex_buffer *VB = &tnl->vb;
-   GLuint i, length, flags = 0;
+   GLuint i;
 
    /* Don't handle clipping or indexed vertices.
     */
-   if (VB->ClipOrMask || imesa->RenderIndex != 0 || VB->Elts) {
+   if (imesa->RenderIndex != 0 || 
+       !i810_validate_render( ctx, VB )) {
       return GL_TRUE;
    }
 
-   imesa->SetupNewInputs = VERT_BIT_CLIP;
+   imesa->SetupNewInputs = VERT_BIT_POS;
 
    tnl->Driver.Render.Start( ctx );
 
-   for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
+   for (i = 0 ; i < VB->PrimitiveCount ; i++)
    {
-      flags = VB->Primitive[i];
-      length= VB->PrimitiveLength[i];
-      if (length)
-        i810_render_tab_verts[flags & PRIM_MODE_MASK]( ctx, i, i + length,
-                                                       flags );
+      GLuint prim = VB->Primitive[i].mode;
+      GLuint start = VB->Primitive[i].start;
+      GLuint length = VB->Primitive[i].count;
+
+      if (!length)
+        continue;
+
+      i810_render_tab_verts[prim & PRIM_MODE_MASK]( ctx, start, start + length,
+                                                   prim );
    }
 
    tnl->Driver.Render.Finish( ctx );
@@ -169,46 +161,13 @@ static GLboolean i810_run_render( GLcontext *ctx,
 }
 
 
-static void i810_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
-{
-   GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
-
-   if (ctx->RenderMode == GL_RENDER) {
-      if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
-        inputs |= VERT_BIT_COLOR1;
-
-      if (ctx->Texture.Unit[0]._ReallyEnabled)
-        inputs |= VERT_BIT_TEX0;
-
-      if (ctx->Texture.Unit[1]._ReallyEnabled)
-        inputs |= VERT_BIT_TEX1;
-
-      if (ctx->Fog.Enabled)
-        inputs |= VERT_BIT_FOG;
-   }
-
-   stage->inputs = inputs;
-}
-
-
-static void dtr( struct gl_pipeline_stage *stage )
-{
-   (void)stage;
-}
-
 
-const struct gl_pipeline_stage _i810_render_stage =
+const struct tnl_pipeline_stage _i810_render_stage =
 {
    "i810 render",
-   (_DD_NEW_SEPARATE_SPECULAR |
-    _NEW_TEXTURE|
-    _NEW_FOG|
-    _NEW_RENDERMODE),          /* re-check (new inputs) */
-   0,                          /* re-run (always runs) */
-   GL_TRUE,                    /* active */
-   0, 0,                       /* inputs (set in check_render), outputs */
-   0, 0,                       /* changed_inputs, private */
-   dtr,                                /* destructor */
-   i810_check_render,          /* check - initially set to alloc data */
+   NULL,
+   NULL,
+   NULL,
+   NULL,
    i810_run_render             /* run */
 };