-#define HAVE_QUADS 1
-#define HAVE_QUAD_STRIPS 1
-#define HAVE_POLYGONS 1
-#define HAVE_ELTS 1
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- R200_VF_PRIM_POINTS,
- R200_VF_PRIM_LINES,
- 0,
- R200_VF_PRIM_LINE_STRIP,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLE_STRIP,
- R200_VF_PRIM_TRIANGLE_FAN,
- R200_VF_PRIM_QUADS,
- R200_VF_PRIM_QUAD_STRIP,
- R200_VF_PRIM_POLYGON
-};
-
-static __inline void r200DmaPrimitive( r200ContextPtr rmesa, GLenum prim )
-{
- R200_NEWPRIM( rmesa );
- rmesa->swtcl.hw_primitive = hw_prim[prim];
- assert(rmesa->dma.current.ptr == rmesa->dma.current.start);
-}
-
-static __inline void r200EltPrimitive( r200ContextPtr rmesa, GLenum prim )
-{
- R200_NEWPRIM( rmesa );
- rmesa->swtcl.hw_primitive = hw_prim[prim] | R200_VF_PRIM_WALK_IND;
-}
-
-
-
-
-#define LOCAL_VARS r200ContextPtr rmesa = R200_CONTEXT(ctx)
-#define ELTS_VARS(buf) GLushort *dest = buf
-#define INIT( prim ) r200DmaPrimitive( rmesa, prim )
-#define ELT_INIT(prim) r200EltPrimitive( rmesa, prim )
-#define FLUSH() R200_NEWPRIM( rmesa )
-#define GET_CURRENT_VB_MAX_VERTS() \
- (((int)rmesa->dma.current.end - (int)rmesa->dma.current.ptr) / (rmesa->swtcl.vertex_size*4))
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- ((RADEON_BUFFER_SIZE) / (rmesa->swtcl.vertex_size*4))
-
-#define GET_CURRENT_VB_MAX_ELTS() \
- ((R200_CMD_BUF_SZ - (rmesa->store.cmd_used + 16)) / 2)
-#define GET_SUBSEQUENT_VB_MAX_ELTS() \
- ((R200_CMD_BUF_SZ - 1024) / 2)
-
-static void *r200_alloc_elts( r200ContextPtr rmesa, int nr )
-{
- if (rmesa->dma.flush == r200FlushElts &&
- rmesa->store.cmd_used + nr*2 < R200_CMD_BUF_SZ) {
-
- rmesa->store.cmd_used += nr*2;
-
- return (void *)(rmesa->store.cmd_buf + rmesa->store.cmd_used);
- }
- else {
- if (rmesa->dma.flush) {
- rmesa->dma.flush( rmesa );
- }
-
- r200EmitVertexAOS( rmesa,
- rmesa->swtcl.vertex_size,
- (rmesa->r200Screen->gart_buffer_offset +
- rmesa->swtcl.indexed_verts.buf->buf->idx *
- RADEON_BUFFER_SIZE +
- rmesa->swtcl.indexed_verts.start));
-
- return (void *) r200AllocEltsOpenEnded( rmesa,
- rmesa->swtcl.hw_primitive,
- nr );
- }
-}
-
-#define ALLOC_ELTS(nr) r200_alloc_elts(rmesa, nr)
-
-
-
-#ifdef MESA_BIG_ENDIAN
-/* We could do without (most of) this ugliness if dest was always 32 bit word aligned... */
-#define EMIT_ELT(offset, x) do { \
- int off = offset + ( ( (GLuint)dest & 0x2 ) >> 1 ); \
- GLushort *des = (GLushort *)( (GLuint)dest & ~0x2 ); \
- (des)[ off + 1 - 2 * ( off & 1 ) ] = (GLushort)(x); } while (0)
-#else
-#define EMIT_ELT(offset, x) (dest)[offset] = (GLushort) (x)
-#endif
-#define EMIT_TWO_ELTS(offset, x, y) *(GLuint *)(dest+offset) = ((y)<<16)|(x);
-#define INCR_ELTS( nr ) dest += nr
-#define ELTPTR dest
-#define RELEASE_ELT_VERTS() \
- r200ReleaseDmaRegion( rmesa, &rmesa->swtcl.indexed_verts, __FUNCTION__ )
-
-#define EMIT_INDEXED_VERTS( ctx, start, count ) \
- r200_emit_indexed_verts( ctx, start, count )
-
-
-#define ALLOC_VERTS( nr ) \
- r200AllocDmaLowVerts( rmesa, nr, rmesa->swtcl.vertex_size * 4 )
-#define EMIT_VERTS( ctx, j, nr, buf ) \
- r200_emit_contiguous_verts(ctx, j, (j)+(nr), buf)
-
-
-
-#define TAG(x) r200_dma_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-
-static GLboolean r200_run_render( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
- render_func *tab = TAG(render_tab_verts);
-
- if (rmesa->swtcl.indexed_verts.buf && (!VB->Elts || stage->changed_inputs))
- RELEASE_ELT_VERTS();
-
-
-
- if ((R200_DEBUG & DEBUG_VERTS) ||
- rmesa->swtcl.RenderIndex != 0 ||
- !r200_dma_validate_render( ctx, VB ))
- return GL_TRUE;
-
- if (VB->Elts) {
- tab = TAG(render_tab_elts);
- if (!rmesa->swtcl.indexed_verts.buf) {
- if (VB->Count > GET_SUBSEQUENT_VB_MAX_VERTS())
- return GL_TRUE;
- EMIT_INDEXED_VERTS(ctx, 0, VB->Count);
- }
- }
-
- tnl->Driver.Render.Start( ctx );
-
- 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;
-
- if (R200_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "r200_render.c: prim %s %d..%d\n",
- _mesa_lookup_enum_by_nr(prim & PRIM_MODE_MASK),
- start, start+length);
-
- tab[prim & PRIM_MODE_MASK]( ctx, start, start + length, prim );
- }
-
- tnl->Driver.Render.Finish( ctx );
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-
-static void r200_check_render( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- stage->inputs = TNL_CONTEXT(ctx)->render_inputs;
-}
-
-
-static void dtr( struct tnl_pipeline_stage *stage )
-{
- (void)stage;
-}
-
-
-const struct tnl_pipeline_stage _r200_render_stage =
-{
- "r200 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 */
- r200_check_render, /* check - initially set to alloc data */
- r200_run_render /* run */
-};
-
-
-
-/**************************************************************************/
-
-
-static const GLuint reduced_hw_prim[GL_POLYGON+1] = {
- R200_VF_PRIM_POINTS,
- R200_VF_PRIM_LINES,
- R200_VF_PRIM_LINES,
- R200_VF_PRIM_LINES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES
-};
-
-static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void r200RenderPrimitive( GLcontext *ctx, GLenum prim );
-static void r200ResetLineStipple( GLcontext *ctx );
-
-#undef HAVE_QUADS
-#define HAVE_QUADS 0
-
-#undef HAVE_QUAD_STRIPS