fix up radeon span functions using latest r200 code from Brian,
[mesa.git] / src / mesa / drivers / dri / gamma / gamma_render.c
index 67063c2e525d77eafcec76bfea84ed1ec683a075..4b462f225253adcf623871179559d609322b3d81 100644 (file)
@@ -74,7 +74,7 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
            WRITEF(gmesa->buf, Tr4, tc0[i][2]);
            WRITEF(gmesa->buf, Tt4, tc0[i][0]);
            WRITEF(gmesa->buf, Ts4, tc0[i][1]);
-           WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[i]);
+           WRITE(gmesa->buf, PackedColor4, *(u_int32_t*)col[i]);
            WRITEF(gmesa->buf, Vw, coord[i][3]);
            WRITEF(gmesa->buf, Vz, coord[i][2]);
            WRITEF(gmesa->buf, Vy, coord[i][1]);
@@ -85,7 +85,7 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
            CHECK_DMA_BUFFER(gmesa, 7);
            WRITEF(gmesa->buf, Tt2, tc0[i][0]);
            WRITEF(gmesa->buf, Ts2, tc0[i][1]);
-           WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[i]);
+           WRITE(gmesa->buf, PackedColor4, *(u_int32_t*)col[i]);
            WRITEF(gmesa->buf, Vw, coord[i][3]);
            WRITEF(gmesa->buf, Vz, coord[i][2]);
            WRITEF(gmesa->buf, Vy, coord[i][1]);
@@ -94,7 +94,7 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
    } else {
       for (i=start; i < end; i++) {
            CHECK_DMA_BUFFER(gmesa, 4);
-           WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[i]);
+           WRITE(gmesa->buf, PackedColor4, *(u_int32_t*)col[i]);
            WRITEF(gmesa->buf, Vz, coord[i][2]);
            WRITEF(gmesa->buf, Vy, coord[i][1]);
            WRITEF(gmesa->buf, Vx3, coord[i][0]);
@@ -115,17 +115,6 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
 
 #define HAVE_ELTS        0
 
-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 );
-   GAMMA_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS;
-}
 
 static const GLuint hw_prim[GL_POLYGON+1] = {
    B_PrimType_Points,
@@ -163,14 +152,14 @@ static __inline void gammaEndPrimitive( gammaContextPtr gmesa )
 
 #define LOCAL_VARS gammaContextPtr gmesa = GAMMA_CONTEXT(ctx)
 #define INIT( prim ) gammaStartPrimitive( gmesa, prim )
-#define FINISH gammaEndPrimitive( gmesa )
-#define NEW_PRIMITIVE()  /* GAMMA_STATECHANGE( gmesa, 0 ) */
-#define NEW_BUFFER()  /* GAMMA_FIREVERTICES( gmesa ) */
+#define FLUSH() gammaEndPrimitive( gmesa )
 #define GET_CURRENT_VB_MAX_VERTS() \
   (gmesa->bufSize - gmesa->bufCount) / 2
 #define GET_SUBSEQUENT_VB_MAX_VERTS() \
   GAMMA_DMA_BUFFER_SIZE / 2
-#define EMIT_VERTS( ctx, j, nr ) gamma_emit(ctx, j, (j)+(nr))
+
+#define ALLOC_VERTS( nr ) (void *)0    /* todo: explicit alloc */
+#define EMIT_VERTS( ctx, j, nr, buf ) (gamma_emit(ctx, j, (j)+(nr)), (void *)0)
 
 #define TAG(x) gamma_##x
 #include "tnl_dd/t_dd_dmatmp.h"
@@ -187,15 +176,15 @@ static GLboolean gamma_run_render( GLcontext *ctx,
    gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    struct vertex_buffer *VB = &tnl->vb;
-   GLuint i, length, flags = 0;
-   render_func *tab;
+   GLuint i;
+   tnl_render_func *tab;
 
                                /* GH: THIS IS A HACK!!! */
    if (VB->ClipOrMask || gmesa->RenderIndex != 0)
       return GL_TRUE;          /* don't handle clipping here */
 
    /* We don't do elts */
-   if (VB->Elts)
+   if (VB->Elts || !gamma_validate_render( ctx, VB ))
       return GL_TRUE;
 
    tab = TAG(render_tab_verts);
@@ -220,47 +209,12 @@ static GLboolean gamma_run_render( GLcontext *ctx,
 }
 
 
-static void gamma_check_render( GLcontext *ctx,
-                                struct tnl_pipeline_stage *stage )
-{
-   GLuint inputs = VERT_BIT_POS | 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 tnl_pipeline_stage *stage )
-{
-   (void)stage;
-}
-
-
 const struct tnl_pipeline_stage _gamma_render_stage =
 {
    "gamma 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 */
-   gamma_check_render,         /* check - initially set to alloc data */
+   NULL,
+   NULL,
+   NULL,
+   NULL,
    gamma_run_render            /* run */
 };