#include "i830_context.h"
#include "i830_tris.h"
#include "i830_state.h"
-#include "i830_vb.h"
#include "i830_ioctl.h"
/*
3
};
-/* Fallback to normal rendering. Should now never be called.
- */
-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 );
- I830_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_CLIP;
-}
-
#define LOCAL_VARS i830ContextPtr imesa = I830_CONTEXT(ctx)
#define INIT( prim ) do { \
i830RasterPrimitive( ctx, reduced_prim[prim], hw_prim[prim] ); \
} while (0)
-#define NEW_PRIMITIVE() I830_STATECHANGE( imesa, 0 )
-#define NEW_BUFFER() I830_FIREVERTICES( imesa )
+#define FLUSH() I830_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() \
(I830_DMA_BUF_SZ-8) / (imesa->vertex_size * 4)
-#define EMIT_VERTS( ctx, j, nr ) \
- i830_emit_contiguous_verts(ctx, j, (j)+(nr))
+
+#define ALLOC_VERTS( nr ) \
+ i830AllocDmaLow( imesa, (nr) * imesa->vertex_size * 4)
+#define EMIT_VERTS( ctx, j, nr, buf ) \
+ _tnl_emit_vertices_to_buffer(ctx, j, (j)+(nr), buf)
#define TAG(x) i830_##x
#include "tnl_dd/t_dd_dmatmp.h"
int nr_rprims = 0;
int nr_rverts = 0;
int rprim = 0;
- int i = 0, length, flags = 0;
+ int i;
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length) {
- flags = VB->Primitive[i];
- length = VB->PrimitiveLength[i];
+ for (i = 0 ; i < VB->PrimitiveCount ; i++)
+ {
+ GLuint prim = VB->Primitive[i].mode;
+ GLuint length = VB->Primitive[i].count;
+
if (!length)
continue;
- if (!hw_prim[flags & PRIM_MODE_MASK])
+ if (!hw_prim[prim & PRIM_MODE_MASK])
return GL_FALSE;
nr_prims++;
- nr_rverts += length * scale_prim[flags & PRIM_MODE_MASK];
+ nr_rverts += length * scale_prim[prim & PRIM_MODE_MASK];
- if (reduced_prim[flags&PRIM_MODE_MASK] != rprim) {
+ if (reduced_prim[prim&PRIM_MODE_MASK] != rprim) {
nr_rprims++;
- rprim = reduced_prim[flags&PRIM_MODE_MASK];
+ rprim = reduced_prim[prim&PRIM_MODE_MASK];
}
}
static GLboolean i830_run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
i830ContextPtr imesa = I830_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 ||
- !choose_render( VB, GET_SUBSEQUENT_VB_MAX_VERTS() )) {
+ if (imesa->RenderIndex != 0 ||
+ !i830_validate_render( ctx, VB ) ||
+ !choose_render( VB, 200 )) { /* 200 is estimate of nr verts/buf */
return GL_TRUE;
}
- imesa->SetupNewInputs = VERT_BIT_CLIP;
-
tnl->Driver.Render.Start( ctx );
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length) {
- flags = VB->Primitive[i];
- length= VB->PrimitiveLength[i];
- if (length)
- i830_render_tab_verts[flags & PRIM_MODE_MASK]( ctx, i, i + length,
- flags );
+ for (i = 0 ; i < VB->PrimitiveCount ; i++)
+ {
+ GLuint prim = VB->Primitive[i].mode;
+ GLuint start = VB->Primitive[i].start;
+ GLuint length = VB->Primitive[i].count;
+
+ if (!length)
+ continue;
+
+ i830_render_tab_verts[prim & PRIM_MODE_MASK]( ctx, start, start + length,
+ prim );
}
tnl->Driver.Render.Finish( ctx );
static void i830_check_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_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;
+ stage->inputs = TNL_CONTEXT(ctx)->render_inputs;
}
-static void dtr( struct gl_pipeline_stage *stage )
+static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
-const struct gl_pipeline_stage _i830_render_stage =
+const struct tnl_pipeline_stage _i830_render_stage =
{
"i830 render",
(_DD_NEW_SEPARATE_SPECULAR |