summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2003-12-11 16:25:36 +0000
committerKeith Whitwell <[email protected]>2003-12-11 16:25:36 +0000
commit2dc621f3fdb585f23013aa3e220f2148f9405538 (patch)
treed4eb6b4a76b427143e88953bbec0284bf15e3ffc /src/mesa/drivers
parent5bcf52b4d6951f9058b5ef00cf2438b3bdfbeea0 (diff)
Updates to tnl_dd_dmatmp.h
- Allocate vertices explicitly, rather than trying to talk about dma buffers. - Clean up the various Flush() operations. - Don't allow fallbacks any longer. Provide a support function to detect them ahead o ftime Updates to tnl_dd_vbtmp.h - Get rid of power-of-two vertex strides. Pack all vertices tightly. - Get texunit 2,3 emit working coorrectly. Other stuff: - Get rid of lingering Ubyte color support. - Fix a few compiler warnings.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_context.h5
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_render.c23
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_tris.c6
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_vb.c26
-rw-r--r--src/mesa/drivers/dri/i810/i810context.h5
-rw-r--r--src/mesa/drivers/dri/i810/i810render.c26
-rw-r--r--src/mesa/drivers/dri/i810/i810tris.c7
-rw-r--r--src/mesa/drivers/dri/i810/i810vb.c36
-rw-r--r--src/mesa/drivers/dri/i810/i810vb.h7
-rw-r--r--src/mesa/drivers/dri/i830/i830_context.h5
-rw-r--r--src/mesa/drivers/dri/i830/i830_render.c31
-rw-r--r--src/mesa/drivers/dri/i830/i830_tris.c7
-rw-r--r--src/mesa/drivers/dri/i830/i830_vb.c36
-rw-r--r--src/mesa/drivers/dri/i830/i830_vb.h7
-rw-r--r--src/mesa/drivers/dri/mga/mgacontext.h6
-rw-r--r--src/mesa/drivers/dri/mga/mgarender.c23
-rw-r--r--src/mesa/drivers/dri/mga/mgatris.c7
-rw-r--r--src/mesa/drivers/dri/mga/mgavb.c36
-rw-r--r--src/mesa/drivers/dri/mga/mgavb.h5
-rw-r--r--src/mesa/drivers/dri/r128/r128_context.h5
-rw-r--r--src/mesa/drivers/dri/r128/r128_tris.c7
-rw-r--r--src/mesa/drivers/dri/r128/r128_vb.c24
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.c8
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.h6
-rw-r--r--src/mesa/drivers/dri/r200/r200_ioctl.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_maos_arrays.c52
-rw-r--r--src/mesa/drivers/dri/r200/r200_maos_verts.c5
-rw-r--r--src/mesa/drivers/dri/r200/r200_swtcl.c158
-rw-r--r--src/mesa/drivers/dri/r200/r200_swtcl.h4
-rw-r--r--src/mesa/drivers/dri/r200/r200_tex.c7
-rw-r--r--src/mesa/drivers/dri/r200/r200_texmem.c8
-rw-r--r--src/mesa/drivers/dri/r200/r200_texstate.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_vtxfmt_c.c10
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_maos_arrays.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_maos_verts.c5
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_swtcl.c146
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_swtcl.h8
-rw-r--r--src/mesa/drivers/dri/sis/sis_context.h5
-rw-r--r--src/mesa/drivers/dri/sis/sis_tris.c7
-rw-r--r--src/mesa/drivers/dri/sis/sis_vb.c24
40 files changed, 266 insertions, 533 deletions
diff --git a/src/mesa/drivers/dri/gamma/gamma_context.h b/src/mesa/drivers/dri/gamma/gamma_context.h
index 84b54e2a63e..5f183ff264c 100644
--- a/src/mesa/drivers/dri/gamma/gamma_context.h
+++ b/src/mesa/drivers/dri/gamma/gamma_context.h
@@ -238,11 +238,6 @@ struct gamma_context {
GLINTSAREADRIPtr sarea;
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
/* Mirrors of some DRI state
*/
drmContext hHWContext;
diff --git a/src/mesa/drivers/dri/gamma/gamma_render.c b/src/mesa/drivers/dri/gamma/gamma_render.c
index 67063c2e525..380c7b7044c 100644
--- a/src/mesa/drivers/dri/gamma/gamma_render.c
+++ b/src/mesa/drivers/dri/gamma/gamma_render.c
@@ -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,7 +176,7 @@ 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;
+ GLuint i;
render_func *tab;
/* GH: THIS IS A HACK!!! */
@@ -195,7 +184,7 @@ static GLboolean gamma_run_render( GLcontext *ctx,
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);
diff --git a/src/mesa/drivers/dri/gamma/gamma_tris.c b/src/mesa/drivers/dri/gamma/gamma_tris.c
index 6457999b4cc..da7ae5e247a 100644
--- a/src/mesa/drivers/dri/gamma/gamma_tris.c
+++ b/src/mesa/drivers/dri/gamma/gamma_tris.c
@@ -307,7 +307,7 @@ static struct {
#define VERT_Y(_v) _v->v.y
#define VERT_Z(_v) _v->v.z
#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (gmesa->verts + (e<<gmesa->vertex_stride_shift))
+#define GET_VERTEX(e) (gmesa->verts + (e * gmesa->vertex_size * sizeof(int)))
#define VERT_SET_RGBA( v, c ) \
do { \
@@ -410,7 +410,7 @@ static void init_render_tab( void )
/* Render unclipped begin/end objects */
/**********************************************************************/
-#define VERT(x) (gammaVertex *)(gammaverts + (x << shift))
+#define VERT(x) (gammaVertex *)(gammaverts + (x * size * sizeof(int)))
#define RENDER_POINTS( start, count ) \
for ( ; start < count ; start++) \
gmesa->draw_point( gmesa, VERT(start) )
@@ -424,7 +424,7 @@ static void init_render_tab( void )
#undef LOCAL_VARS
#define LOCAL_VARS \
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx); \
- const GLuint shift = gmesa->vertex_stride_shift; \
+ const GLuint size = gmesa->vertex_size; \
const char *gammaverts = (char *)gmesa->verts; \
const GLboolean stipple = ctx->Line.StippleFlag; \
(void) stipple;
diff --git a/src/mesa/drivers/dri/gamma/gamma_vb.c b/src/mesa/drivers/dri/gamma/gamma_vb.c
index f4ed08b140f..f2dd0d8de00 100644
--- a/src/mesa/drivers/dri/gamma/gamma_vb.c
+++ b/src/mesa/drivers/dri/gamma/gamma_vb.c
@@ -55,7 +55,6 @@ static struct {
copy_pv_func copy_pv;
GLboolean (*check_tex_sizes)( GLcontext *ctx );
GLuint vertex_size;
- GLuint vertex_stride_shift;
GLuint vertex_format;
} setup_tab[GAMMA_MAX_SETUP];
@@ -84,10 +83,8 @@ static struct {
#define GET_TEXSOURCE(n) n
#define GET_VERTEX_FORMAT() GAMMA_CONTEXT(ctx)->vertex_format
#define GET_VERTEX_STORE() GAMMA_CONTEXT(ctx)->verts
-#define GET_VERTEX_STRIDE_SHIFT() GAMMA_CONTEXT(ctx)->vertex_stride_shift
+#define GET_VERTEX_SIZE() GAMMA_CONTEXT(ctx)->vertex_size * sizeof(GLuint)
#define INVALIDATE_STORED_VERTICES()
-#define GET_UBYTE_COLOR_STORE() &GAMMA_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &GAMMA_CONTEXT(ctx)->UbyteSecondaryColor
#define HAVE_HW_VIEWPORT 1
#define HAVE_HW_DIVIDE 1
@@ -102,10 +99,6 @@ static struct {
#define PTEX_FALLBACK() /* never needed */
-#define IMPORT_QUALIFIER
-#define IMPORT_FLOAT_COLORS gamma_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS gamma_import_float_spec_colors
-
#define INTERP_VERTEX setup_tab[GAMMA_CONTEXT(ctx)->SetupIndex].interp
#define COPY_PV_VERTEX setup_tab[GAMMA_CONTEXT(ctx)->SetupIndex].copy_pv
@@ -269,8 +262,8 @@ void gammaBuildVertices( GLcontext *ctx,
GLuint newinputs )
{
gammaContextPtr gmesa = GAMMA_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)gmesa->verts + (start<<gmesa->vertex_stride_shift));
- GLuint stride = 1<<gmesa->vertex_stride_shift;
+ GLuint stride = gmesa->vertex_size * sizeof(int);
+ GLubyte *v = ((GLubyte *)gmesa->verts + (start * stride));
newinputs |= gmesa->SetupNewInputs;
gmesa->SetupNewInputs = 0;
@@ -329,7 +322,6 @@ void gammaChooseVertexState( GLcontext *ctx )
if (setup_tab[ind].vertex_format != gmesa->vertex_format) {
gmesa->vertex_format = setup_tab[ind].vertex_format;
gmesa->vertex_size = setup_tab[ind].vertex_size;
- gmesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
}
if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
@@ -354,7 +346,7 @@ void gammaInitVB( GLcontext *ctx )
if (firsttime) {
init_setup_tab();
firsttime = 0;
- gmesa->vertex_stride_shift = 6; /* FIXME - only one vertex setup */
+ gmesa->vertex_size = 16; /* FIXME - only one vertex setup */
}
}
}
@@ -367,14 +359,4 @@ void gammaFreeVB( GLcontext *ctx )
ALIGN_FREE(gmesa->verts);
gmesa->verts = 0;
}
-
- if (gmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(gmesa->UbyteSecondaryColor.Ptr);
- gmesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (gmesa->UbyteColor.Ptr) {
- ALIGN_FREE(gmesa->UbyteColor.Ptr);
- gmesa->UbyteColor.Ptr = 0;
- }
}
diff --git a/src/mesa/drivers/dri/i810/i810context.h b/src/mesa/drivers/dri/i810/i810context.h
index b24bd7ca343..3b9aa2ddcdd 100644
--- a/src/mesa/drivers/dri/i810/i810context.h
+++ b/src/mesa/drivers/dri/i810/i810context.h
@@ -94,11 +94,6 @@ struct i810_context_t {
*/
GLuint Fallback;
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
/* State for i810vb.c and i810tris.c.
*/
GLuint new_state; /* _NEW_* flags */
diff --git a/src/mesa/drivers/dri/i810/i810render.c b/src/mesa/drivers/dri/i810/i810render.c
index d1c1adc3b7c..19c5dc07c4a 100644
--- a/src/mesa/drivers/dri/i810/i810render.c
+++ b/src/mesa/drivers/dri/i810/i810render.c
@@ -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_POS;
-}
@@ -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
@@ -146,7 +133,8 @@ static GLboolean i810_run_render( GLcontext *ctx,
/* 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;
}
diff --git a/src/mesa/drivers/dri/i810/i810tris.c b/src/mesa/drivers/dri/i810/i810tris.c
index e3e2afb3f22..b035b9beb02 100644
--- a/src/mesa/drivers/dri/i810/i810tris.c
+++ b/src/mesa/drivers/dri/i810/i810tris.c
@@ -232,7 +232,7 @@ static struct {
#define VERT_Y(_v) _v->v.y
#define VERT_Z(_v) _v->v.z
#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (imesa->verts + (e<<imesa->vertex_stride_shift))
+#define GET_VERTEX(e) (imesa->verts + (e * imesa->vertex_size * sizeof(int)))
#define VERT_SET_RGBA( v, c ) \
do { \
@@ -445,7 +445,7 @@ i810_fallback_point( i810ContextPtr imesa,
/**********************************************************************/
#define IND 0
-#define V(x) (i810Vertex *)(vertptr + ((x)<<vertshift))
+#define V(x) (i810Vertex *)(vertptr + ((x)*vertsize*sizeof(int)))
#define RENDER_POINTS( start, count ) \
for ( ; start < count ; start++) POINT( V(ELT(start)) );
#define RENDER_LINE( v0, v1 ) LINE( V(v0), V(v1) )
@@ -456,7 +456,7 @@ i810_fallback_point( i810ContextPtr imesa,
#define LOCAL_VARS \
i810ContextPtr imesa = I810_CONTEXT(ctx); \
GLubyte *vertptr = (GLubyte *)imesa->verts; \
- const GLuint vertshift = imesa->vertex_stride_shift; \
+ const GLuint vertsize = imesa->vertex_size; \
const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
(void) elt;
#define RESET_STIPPLE
@@ -514,7 +514,6 @@ static void i810FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
GLuint vertsize = imesa->vertex_size;
GLuint *vb = i810AllocDmaLow( imesa, (n-2) * 3 * 4 * vertsize );
GLubyte *vertptr = (GLubyte *)imesa->verts;
- const GLuint vertshift = imesa->vertex_stride_shift;
const GLuint *start = (const GLuint *)V(elts[0]);
int i,j;
diff --git a/src/mesa/drivers/dri/i810/i810vb.c b/src/mesa/drivers/dri/i810/i810vb.c
index 58979ceac23..2cdf0252ce7 100644
--- a/src/mesa/drivers/dri/i810/i810vb.c
+++ b/src/mesa/drivers/dri/i810/i810vb.c
@@ -59,7 +59,6 @@ static struct {
copy_pv_func copy_pv;
GLboolean (*check_tex_sizes)( GLcontext *ctx );
GLuint vertex_size;
- GLuint vertex_stride_shift;
GLuint vertex_format;
} setup_tab[I810_MAX_SETUP];
@@ -107,9 +106,7 @@ static struct {
#define GET_TEXSOURCE(n) n
#define GET_VERTEX_FORMAT() I810_CONTEXT(ctx)->Setup[I810_CTXREG_VF]
#define GET_VERTEX_STORE() I810_CONTEXT(ctx)->verts
-#define GET_VERTEX_STRIDE_SHIFT() I810_CONTEXT(ctx)->vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &I810_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &I810_CONTEXT(ctx)->UbyteSecondaryColor
+#define GET_VERTEX_SIZE() I810_CONTEXT(ctx)->vertex_size * sizeof(GLuint)
#define INVALIDATE_STORED_VERTICES()
#define HAVE_HW_VIEWPORT 0
@@ -130,9 +127,6 @@ static struct {
#define PTEX_FALLBACK() FALLBACK(I810_CONTEXT(ctx), I810_FALLBACK_TEXTURE, 1)
-#define IMPORT_FLOAT_COLORS i810_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS i810_import_float_spec_colors
-
#define INTERP_VERTEX setup_tab[I810_CONTEXT(ctx)->SetupIndex].interp
#define COPY_PV_VERTEX setup_tab[I810_CONTEXT(ctx)->SetupIndex].copy_pv
@@ -372,8 +366,8 @@ void i810BuildVertices( GLcontext *ctx,
GLuint newinputs )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)imesa->verts + (start<<imesa->vertex_stride_shift));
- GLuint stride = 1<<imesa->vertex_stride_shift;
+ GLuint stride = imesa->vertex_size * sizeof(int);
+ GLubyte *v = ((GLubyte *)imesa->verts + (start * stride));
if (0) fprintf(stderr, "%s\n", __FUNCTION__);
@@ -450,20 +444,20 @@ void i810ChooseVertexState( GLcontext *ctx )
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
imesa->Setup[I810_CTXREG_VF] = setup_tab[ind].vertex_format;
imesa->vertex_size = setup_tab[ind].vertex_size;
- imesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
}
}
-void i810_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count )
+void *i810_emit_contiguous_verts( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ void *dest )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint vertex_size = imesa->vertex_size * 4;
- GLuint *dest = i810AllocDmaLow( imesa, (count-start) * vertex_size);
- setup_tab[imesa->SetupIndex].emit( ctx, start, count, dest, vertex_size );
+ GLuint stride = imesa->vertex_size * 4;
+ setup_tab[imesa->SetupIndex].emit( ctx, start, count, dest, stride );
+ return (void *)((char *)dest + stride * (count - start));
}
@@ -492,14 +486,4 @@ void i810FreeVB( GLcontext *ctx )
ALIGN_FREE(imesa->verts);
imesa->verts = 0;
}
-
- if (imesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(imesa->UbyteSecondaryColor.Ptr);
- imesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (imesa->UbyteColor.Ptr) {
- ALIGN_FREE(imesa->UbyteColor.Ptr);
- imesa->UbyteColor.Ptr = 0;
- }
}
diff --git a/src/mesa/drivers/dri/i810/i810vb.h b/src/mesa/drivers/dri/i810/i810vb.h
index 30e58357ea8..2168ec8b983 100644
--- a/src/mesa/drivers/dri/i810/i810vb.h
+++ b/src/mesa/drivers/dri/i810/i810vb.h
@@ -45,9 +45,10 @@ extern void i810BuildVertices( GLcontext *ctx,
GLuint newinputs );
-extern void i810_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
+extern void *i810_emit_contiguous_verts( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ void *dest );
extern void i810_translate_vertex( GLcontext *ctx,
const i810Vertex *src,
diff --git a/src/mesa/drivers/dri/i830/i830_context.h b/src/mesa/drivers/dri/i830/i830_context.h
index 2bb71cb719c..188d90c0c99 100644
--- a/src/mesa/drivers/dri/i830/i830_context.h
+++ b/src/mesa/drivers/dri/i830/i830_context.h
@@ -130,11 +130,6 @@ struct i830_context_t
GLuint Fallback;
GLuint NewGLState;
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
/* State for i830vb.c and i830tris.c.
*/
GLuint SetupNewInputs;
diff --git a/src/mesa/drivers/dri/i830/i830_render.c b/src/mesa/drivers/dri/i830/i830_render.c
index f66acd3b564..caed73ed678 100644
--- a/src/mesa/drivers/dri/i830/i830_render.c
+++ b/src/mesa/drivers/dri/i830/i830_render.c
@@ -110,21 +110,6 @@ static const int scale_prim[GL_POLYGON+1] = {
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_POS;
-}
-
#define LOCAL_VARS i830ContextPtr imesa = I830_CONTEXT(ctx)
#define INIT( prim ) do { \
@@ -132,15 +117,17 @@ static void VERT_FALLBACK( GLcontext *ctx,
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 ) \
+ i830_emit_contiguous_verts(ctx, j, (j)+(nr), buf)
#define TAG(x) i830_##x
#include "tnl_dd/t_dd_dmatmp.h"
@@ -165,7 +152,6 @@ static GLboolean choose_render( struct vertex_buffer *VB, int bufsz )
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)
@@ -200,10 +186,11 @@ static GLboolean i830_run_render( GLcontext *ctx,
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 ||
+ if (imesa->RenderIndex != 0 ||
+ !i830_validate_render( ctx, VB ) ||
!choose_render( VB, GET_SUBSEQUENT_VB_MAX_VERTS() )) {
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/i830/i830_tris.c b/src/mesa/drivers/dri/i830/i830_tris.c
index 285287422ba..e9006615401 100644
--- a/src/mesa/drivers/dri/i830/i830_tris.c
+++ b/src/mesa/drivers/dri/i830/i830_tris.c
@@ -223,7 +223,7 @@ static struct {
#define VERT_Y(_v) _v->v.y
#define VERT_Z(_v) _v->v.z
#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (imesa->verts + (e<<imesa->vertex_stride_shift))
+#define GET_VERTEX(e) (imesa->verts + (e * imesa->vertex_size * sizeof(int)))
#define VERT_SET_RGBA( v, c ) \
do { \
@@ -454,7 +454,7 @@ i830_fallback_point( i830ContextPtr imesa,
/**********************************************************************/
#define IND 0
-#define V(x) (i830Vertex *)(vertptr + ((x)<<vertshift))
+#define V(x) (i830Vertex *)(vertptr + ((x) * vertsize * sizeof(int)))
#define RENDER_POINTS( start, count ) \
for ( ; start < count ; start++) POINT( V(ELT(start)) );
#define RENDER_LINE( v0, v1 ) LINE( V(v0), V(v1) )
@@ -465,7 +465,7 @@ i830_fallback_point( i830ContextPtr imesa,
#define LOCAL_VARS \
i830ContextPtr imesa = I830_CONTEXT(ctx); \
GLubyte *vertptr = (GLubyte *)imesa->verts; \
- const GLuint vertshift = imesa->vertex_stride_shift; \
+ const GLuint vertsize = imesa->vertex_size; \
const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
(void) elt;
#define RESET_STIPPLE
@@ -524,7 +524,6 @@ static void i830FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
GLuint vertsize = imesa->vertex_size;
GLuint *vb = i830AllocDmaLow( imesa, (n-2) * 3 * 4 * vertsize );
GLubyte *vertptr = (GLubyte *)imesa->verts;
- const GLuint vertshift = imesa->vertex_stride_shift;
const GLuint *start = (const GLuint *)V(elts[0]);
int i,j;
diff --git a/src/mesa/drivers/dri/i830/i830_vb.c b/src/mesa/drivers/dri/i830/i830_vb.c
index c9c5408dc99..c83cb47835c 100644
--- a/src/mesa/drivers/dri/i830/i830_vb.c
+++ b/src/mesa/drivers/dri/i830/i830_vb.c
@@ -58,7 +58,6 @@ static struct {
copy_pv_func copy_pv;
GLboolean (*check_tex_sizes)( GLcontext *ctx );
GLuint vertex_size;
- GLuint vertex_stride_shift;
GLuint vertex_format;
} setup_tab[I830_MAX_SETUP];
@@ -119,9 +118,7 @@ static struct {
#define GET_TEXSOURCE(n) n
#define GET_VERTEX_FORMAT() I830_CONTEXT(ctx)->vertex_format
#define GET_VERTEX_STORE() ((GLubyte *)I830_CONTEXT(ctx)->verts)
-#define GET_VERTEX_STRIDE_SHIFT() I830_CONTEXT(ctx)->vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &I830_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &I830_CONTEXT(ctx)->UbyteSecondaryColor
+#define GET_VERTEX_SIZE() I830_CONTEXT(ctx)->vertex_size * sizeof(int)
#define INVALIDATE_STORED_VERTICES()
#define HAVE_HW_VIEWPORT 0
@@ -142,9 +139,6 @@ static struct {
#define PTEX_FALLBACK() FALLBACK(I830_CONTEXT(ctx), I830_FALLBACK_TEXTURE, 1)
-#define IMPORT_FLOAT_COLORS i830_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS i830_import_float_spec_colors
-
#define INTERP_VERTEX setup_tab[I830_CONTEXT(ctx)->SetupIndex].interp
#define COPY_PV_VERTEX setup_tab[I830_CONTEXT(ctx)->SetupIndex].copy_pv
@@ -416,7 +410,6 @@ void i830CheckTexSizes( GLcontext *ctx )
}
imesa->vertex_format = vfmt;
imesa->vertex_size = setup_tab[ind].vertex_size;
- imesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
}
if (!imesa->Fallback &&
@@ -433,9 +426,8 @@ void i830BuildVertices( GLcontext *ctx,
GLuint newinputs )
{
i830ContextPtr imesa = I830_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)
- imesa->verts + (start<<imesa->vertex_stride_shift));
- GLuint stride = 1<<imesa->vertex_stride_shift;
+ GLuint stride = imesa->vertex_size * sizeof(int);
+ GLubyte *v = ((GLubyte *) imesa->verts + (start * stride));
if (0) fprintf(stderr, "%s\n", __FUNCTION__);
@@ -537,20 +529,20 @@ void i830ChooseVertexState( GLcontext *ctx )
}
imesa->vertex_format = vfmt;
imesa->vertex_size = setup_tab[ind].vertex_size;
- imesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
}
}
-void i830_emit_contiguous_verts( GLcontext *ctx,
+void *i830_emit_contiguous_verts( GLcontext *ctx,
GLuint start,
- GLuint count )
+ GLuint count,
+ void *dest)
{
i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLuint vertex_size = imesa->vertex_size * 4;
- GLuint *dest = i830AllocDmaLow( imesa, (count-start) * vertex_size);
- setup_tab[imesa->SetupIndex].emit( ctx, start, count, dest, vertex_size );
+ GLuint stride = imesa->vertex_size * 4;
+ setup_tab[imesa->SetupIndex].emit( ctx, start, count, dest, stride );
+ return (void *)((char *)dest + stride * (count - start));
}
@@ -579,14 +571,4 @@ void i830FreeVB( GLcontext *ctx )
ALIGN_FREE(imesa->verts);
imesa->verts = 0;
}
-
- if (imesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(imesa->UbyteSecondaryColor.Ptr);
- imesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (imesa->UbyteColor.Ptr) {
- ALIGN_FREE(imesa->UbyteColor.Ptr);
- imesa->UbyteColor.Ptr = 0;
- }
}
diff --git a/src/mesa/drivers/dri/i830/i830_vb.h b/src/mesa/drivers/dri/i830/i830_vb.h
index 523354465f7..570778ab6bb 100644
--- a/src/mesa/drivers/dri/i830/i830_vb.h
+++ b/src/mesa/drivers/dri/i830/i830_vb.h
@@ -46,9 +46,10 @@ extern void i830BuildVertices( GLcontext *ctx,
GLuint newinputs );
-extern void i830_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
+extern void *i830_emit_contiguous_verts( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ void *dest );
extern void i830_translate_vertex( GLcontext *ctx,
const i830Vertex *src,
diff --git a/src/mesa/drivers/dri/mga/mgacontext.h b/src/mesa/drivers/dri/mga/mgacontext.h
index 245cb5eb737..7bb8ff3bef0 100644
--- a/src/mesa/drivers/dri/mga/mgacontext.h
+++ b/src/mesa/drivers/dri/mga/mgacontext.h
@@ -205,12 +205,6 @@ struct mga_context_t {
*/
GLuint Fallback;
-
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
/* Texture environment color.
*/
unsigned int envcolor[2];
diff --git a/src/mesa/drivers/dri/mga/mgarender.c b/src/mesa/drivers/dri/mga/mgarender.c
index 5fb7af908c4..58520098521 100644
--- a/src/mesa/drivers/dri/mga/mgarender.c
+++ b/src/mesa/drivers/dri/mga/mgarender.c
@@ -94,15 +94,6 @@ static void mgaDmaPrimitive( GLcontext *ctx, GLenum prim )
mgaRasterPrimitive( ctx, GL_TRIANGLES, hwprim );
}
-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 );
- MGA_CONTEXT(ctx)->SetupNewInputs |= VERT_BIT_POS;
-}
#define LOCAL_VARS mgaContextPtr mmesa = MGA_CONTEXT(ctx)
#define INIT( prim ) do { \
@@ -110,14 +101,17 @@ static void VERT_FALLBACK( GLcontext *ctx, GLuint start, GLuint count,
FLUSH_BATCH(mmesa); \
mgaDmaPrimitive( ctx, prim ); \
} while (0)
-#define NEW_PRIMITIVE() FLUSH_BATCH( mmesa )
-#define NEW_BUFFER() FLUSH_BATCH( mmesa )
+#define FLUSH() FLUSH_BATCH( mmesa )
#define GET_CURRENT_VB_MAX_VERTS() \
0 /* fix me */
#define GET_SUBSEQUENT_VB_MAX_VERTS() \
MGA_BUFFER_SIZE / (mmesa->vertex_size * 4)
-#define EMIT_VERTS( ctx, j, nr ) \
- mga_emit_contiguous_verts(ctx, j, (j)+(nr))
+
+
+#define ALLOC_VERTS( nr ) \
+ mgaAllocDmaLow( mmesa, nr * mmesa->vertex_size * 4)
+#define EMIT_VERTS( ctx, j, nr, buf ) \
+ mga_emit_contiguous_verts(ctx, j, (j)+(nr), buf)
#define TAG(x) mga_##x
@@ -140,7 +134,8 @@ static GLboolean mga_run_render( GLcontext *ctx,
/* Don't handle clipping or indexed vertices or vertex manipulations.
*/
- if (VB->ClipOrMask || mmesa->RenderIndex != 0 || VB->Elts) {
+ if (mmesa->RenderIndex != 0 ||
+ !mga_validate_render( ctx, VB )) {
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/mga/mgatris.c b/src/mesa/drivers/dri/mga/mgatris.c
index 739619edf0f..bf415a15a63 100644
--- a/src/mesa/drivers/dri/mga/mgatris.c
+++ b/src/mesa/drivers/dri/mga/mgatris.c
@@ -360,7 +360,7 @@ static struct {
#define VERT_Y(_v) _v->v.y
#define VERT_Z(_v) _v->v.z
#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (mmesa->verts + (e<<mmesa->vertex_stride_shift))
+#define GET_VERTEX(e) (mmesa->verts + (e * mmesa->vertex_size * sizeof(int)))
#define VERT_SET_RGBA( v, c ) \
do { \
@@ -591,7 +591,7 @@ static void init_rast_tab( void )
/**********************************************************************/
-#define VERT(x) (mgaVertex *)(vertptr + ((x)<<vertshift))
+#define VERT(x) (mgaVertex *)(vertptr + ((x)*vertex_size*sizeof(int)))
#define RENDER_POINTS( start, count ) \
for ( ; start < count ; start++) \
mga_draw_point( mmesa, VERT(ELT(start)) );
@@ -606,7 +606,7 @@ static void init_rast_tab( void )
#define LOCAL_VARS \
mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
GLubyte *vertptr = (GLubyte *)mmesa->verts; \
- const GLuint vertshift = mmesa->vertex_stride_shift; \
+ const GLuint vertex_size = mmesa->vertex_size; \
const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
(void) elt;
#define RESET_STIPPLE
@@ -663,7 +663,6 @@ static void mgaFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
GLuint vertex_size = mmesa->vertex_size;
GLuint *vb = mgaAllocDmaLow( mmesa, (n-2) * 3 * 4 * vertex_size );
GLubyte *vertptr = (GLubyte *)mmesa->verts;
- const GLuint vertshift = mmesa->vertex_stride_shift;
const GLuint *start = (const GLuint *)VERT(elts[0]);
int i,j;
diff --git a/src/mesa/drivers/dri/mga/mgavb.c b/src/mesa/drivers/dri/mga/mgavb.c
index 63de3563c45..e8c6b26c232 100644
--- a/src/mesa/drivers/dri/mga/mgavb.c
+++ b/src/mesa/drivers/dri/mga/mgavb.c
@@ -58,7 +58,6 @@ static struct {
copy_pv_func copy_pv;
GLboolean (*check_tex_sizes)( GLcontext *ctx );
GLuint vertex_size;
- GLuint vertex_stride_shift;
GLuint vertex_format;
} setup_tab[MGA_MAX_SETUP];
@@ -90,9 +89,7 @@ static struct {
#define GET_TEXSOURCE(n) mmesa->tmu_source[n]
#define GET_VERTEX_FORMAT() mmesa->vertex_format
#define GET_VERTEX_STORE() mmesa->verts
-#define GET_VERTEX_STRIDE_SHIFT() mmesa->vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &mmesa->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &mmesa->UbyteSecondaryColor
+#define GET_VERTEX_SIZE() mmesa->vertex_size * sizeof(GLuint)
#define HAVE_HW_VIEWPORT 0
#define HAVE_HW_DIVIDE 0
@@ -117,10 +114,6 @@ static struct {
#define PTEX_FALLBACK() FALLBACK(ctx, MGA_FALLBACK_TEXTURE, 1)
-
-#define IMPORT_FLOAT_COLORS mga_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS mga_import_float_spec_colors
-
#define INTERP_VERTEX setup_tab[MGA_CONTEXT(ctx)->SetupIndex].interp
#define COPY_PV_VERTEX setup_tab[MGA_CONTEXT(ctx)->SetupIndex].copy_pv
@@ -353,8 +346,8 @@ void mgaBuildVertices( GLcontext *ctx,
GLuint newinputs )
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)mmesa->verts + (start<<mmesa->vertex_stride_shift));
- GLuint stride = 1<<mmesa->vertex_stride_shift;
+ GLuint stride = mmesa->vertex_size * sizeof(int);
+ GLubyte *v = ((GLubyte *)mmesa->verts + (start * stride));
newinputs |= mmesa->SetupNewInputs;
mmesa->SetupNewInputs = 0;
@@ -436,20 +429,20 @@ void mgaChooseVertexState( GLcontext *ctx )
mmesa->dirty |= MGA_UPLOAD_PIPE;
mmesa->vertex_format = setup_tab[ind].vertex_format;
mmesa->vertex_size = setup_tab[ind].vertex_size;
- mmesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
}
}
-void mga_emit_contiguous_verts( GLcontext *ctx,
+void *mga_emit_contiguous_verts( GLcontext *ctx,
GLuint start,
- GLuint count )
+ GLuint count,
+ void *dest)
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint vertex_size = mmesa->vertex_size * 4;
- GLuint *dest = mgaAllocDmaLow( mmesa, (count-start) * vertex_size);
- setup_tab[mmesa->SetupIndex].emit( ctx, start, count, dest, vertex_size );
+ GLuint stride = mmesa->vertex_size * 4;
+ setup_tab[mmesa->SetupIndex].emit( ctx, start, count, dest, stride );
+ return (void *)((char *)dest + stride * (count - start));
}
@@ -472,7 +465,6 @@ void mgaInitVB( GLcontext *ctx )
mmesa->dirty |= MGA_UPLOAD_PIPE;
mmesa->vertex_format = setup_tab[0].vertex_format;
mmesa->vertex_size = setup_tab[0].vertex_size;
- mmesa->vertex_stride_shift = setup_tab[0].vertex_stride_shift;
}
@@ -483,15 +475,5 @@ void mgaFreeVB( GLcontext *ctx )
ALIGN_FREE(mmesa->verts);
mmesa->verts = 0;
}
-
- if (mmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(mmesa->UbyteSecondaryColor.Ptr);
- mmesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (mmesa->UbyteColor.Ptr) {
- ALIGN_FREE(mmesa->UbyteColor.Ptr);
- mmesa->UbyteColor.Ptr = 0;
- }
}
diff --git a/src/mesa/drivers/dri/mga/mgavb.h b/src/mesa/drivers/dri/mga/mgavb.h
index 88cc3108dff..5f6454aca96 100644
--- a/src/mesa/drivers/dri/mga/mgavb.h
+++ b/src/mesa/drivers/dri/mga/mgavb.h
@@ -52,9 +52,10 @@ extern void mgaPrintSetupFlags(char *msg, GLuint flags );
extern void mgaInitVB( GLcontext *ctx );
extern void mgaFreeVB( GLcontext *ctx );
-extern void mga_emit_contiguous_verts( GLcontext *ctx,
+extern void *mga_emit_contiguous_verts( GLcontext *ctx,
GLuint start,
- GLuint count );
+ GLuint count,
+ void *dest );
extern void mga_translate_vertex(GLcontext *ctx,
const mgaVertex *src,
diff --git a/src/mesa/drivers/dri/r128/r128_context.h b/src/mesa/drivers/dri/r128/r128_context.h
index 3a908d7a1b3..fba6077b29e 100644
--- a/src/mesa/drivers/dri/r128/r128_context.h
+++ b/src/mesa/drivers/dri/r128/r128_context.h
@@ -123,11 +123,6 @@ struct r128_context {
GLuint dirty; /* Hardware state to be updated */
r128_context_regs_t setup;
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
GLuint NewGLState;
GLuint Fallback;
GLuint SetupIndex;
diff --git a/src/mesa/drivers/dri/r128/r128_tris.c b/src/mesa/drivers/dri/r128/r128_tris.c
index a94edb53a44..b00ea62e28d 100644
--- a/src/mesa/drivers/dri/r128/r128_tris.c
+++ b/src/mesa/drivers/dri/r128/r128_tris.c
@@ -231,7 +231,7 @@ static struct {
#define VERT_Y(_v) _v->v.y
#define VERT_Z(_v) _v->v.z
#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (rmesa->verts + (e<<rmesa->vertex_stride_shift))
+#define GET_VERTEX(e) (rmesa->verts + (e * rmesa->vertex_size * sizeof(int)))
#define VERT_SET_RGBA( v, c ) \
do { \
@@ -436,7 +436,7 @@ r128_fallback_point( r128ContextPtr rmesa,
/* Render unclipped begin/end objects */
/**********************************************************************/
-#define VERT(x) (r128Vertex *)(r128verts + (x << shift))
+#define VERT(x) (r128Vertex *)(r128verts + (x * vertsize * sizeof(int)))
#define RENDER_POINTS( start, count ) \
for ( ; start < count ; start++) \
r128_draw_point( rmesa, VERT(start) )
@@ -453,7 +453,7 @@ r128_fallback_point( r128ContextPtr rmesa,
#undef LOCAL_VARS
#define LOCAL_VARS \
r128ContextPtr rmesa = R128_CONTEXT(ctx); \
- const GLuint shift = rmesa->vertex_stride_shift; \
+ const GLuint vertsize = rmesa->vertex_size; \
const char *r128verts = (char *)rmesa->verts; \
const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
(void) elt;
@@ -503,7 +503,6 @@ static void r128FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
GLuint vertsize = rmesa->vertex_size;
GLuint *vb = r128AllocDmaLow( rmesa, (n-2) * 3 * 4 * vertsize );
GLubyte *r128verts = (GLubyte *)rmesa->verts;
- const GLuint shift = rmesa->vertex_stride_shift;
const GLuint *start = (const GLuint *)VERT(elts[0]);
int i,j;
diff --git a/src/mesa/drivers/dri/r128/r128_vb.c b/src/mesa/drivers/dri/r128/r128_vb.c
index 6c52975286f..e09bedacea2 100644
--- a/src/mesa/drivers/dri/r128/r128_vb.c
+++ b/src/mesa/drivers/dri/r128/r128_vb.c
@@ -64,7 +64,6 @@ static struct {
copy_pv_func copy_pv;
GLboolean (*check_tex_sizes)( GLcontext *ctx );
GLuint vertex_size;
- GLuint vertex_stride_shift;
GLuint vertex_format;
} setup_tab[R128_MAX_SETUP];
@@ -108,10 +107,8 @@ static struct {
#define GET_TEXSOURCE(n) rmesa->tmu_source[n]
#define GET_VERTEX_FORMAT() rmesa->vertex_format
#define GET_VERTEX_STORE() rmesa->verts
-#define GET_VERTEX_STRIDE_SHIFT() rmesa->vertex_stride_shift
+#define GET_VERTEX_SIZE() rmesa->vertex_size * sizeof(GLuint)
#define INVALIDATE_STORED_VERTICES()
-#define GET_UBYTE_COLOR_STORE() &rmesa->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &rmesa->UbyteSecondaryColor
#define HAVE_HW_VIEWPORT 0
#define HAVE_HW_DIVIDE 0
@@ -131,9 +128,6 @@ static struct {
#define PTEX_FALLBACK() FALLBACK(R128_CONTEXT(ctx), R128_FALLBACK_TEXTURE, 1)
-#define IMPORT_FLOAT_COLORS r128_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS r128_import_float_spec_colors
-
#define INTERP_VERTEX setup_tab[rmesa->SetupIndex].interp
#define COPY_PV_VERTEX setup_tab[rmesa->SetupIndex].copy_pv
@@ -373,8 +367,8 @@ void r128BuildVertices( GLcontext *ctx,
GLuint newinputs )
{
r128ContextPtr rmesa = R128_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)rmesa->verts + (start<<rmesa->vertex_stride_shift));
- GLuint stride = 1<<rmesa->vertex_stride_shift;
+ GLuint stride = rmesa->vertex_size * sizeof(int);
+ GLubyte *v = ((GLubyte *)rmesa->verts + (start * stride));
newinputs |= rmesa->SetupNewInputs;
rmesa->SetupNewInputs = 0;
@@ -446,7 +440,6 @@ void r128ChooseVertexState( GLcontext *ctx )
FLUSH_BATCH(rmesa);
rmesa->vertex_format = setup_tab[ind].vertex_format;
rmesa->vertex_size = setup_tab[ind].vertex_size;
- rmesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
}
}
@@ -511,15 +504,4 @@ void r128FreeVB( GLcontext *ctx )
ALIGN_FREE(rmesa->verts);
rmesa->verts = 0;
}
-
-
- if (rmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(rmesa->UbyteSecondaryColor.Ptr);
- rmesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (rmesa->UbyteColor.Ptr) {
- ALIGN_FREE(rmesa->UbyteColor.Ptr);
- rmesa->UbyteColor.Ptr = 0;
- }
}
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 2da6ef3abb1..109e3d7d41a 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -459,12 +459,12 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
fprintf(stderr, "disabling 3D acceleration\n");
FALLBACK(rmesa, R200_FALLBACK_DISABLE, 1);
}
- else if (tcl_mode == DRI_CONF_TCL_SW) {
+ else if (tcl_mode == DRI_CONF_TCL_SW || getenv("R200_NO_TCL")) {
fprintf(stderr, "disabling TCL support\n");
TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_TCL_DISABLE, 1);
}
else {
- if (tcl_mode >= DRI_CONF_TCL_VTXFMT) {
+ if (tcl_mode >= DRI_CONF_TCL_VTXFMT && !getenv("R200_NO_VTXFMT")) {
r200VtxfmtInit( ctx, tcl_mode >= DRI_CONF_TCL_CODEGEN );
}
_tnl_need_dlist_norm_lengths( ctx, GL_FALSE );
@@ -586,7 +586,7 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
(r200ContextPtr) driContextPriv->driverPrivate;
if (R200_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__, newCtx->glCtx);
+ fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)newCtx->glCtx);
if ( newCtx->dri.drawable != driDrawPriv ) {
driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags );
@@ -629,7 +629,7 @@ r200UnbindContext( __DRIcontextPrivate *driContextPriv )
r200ContextPtr rmesa = (r200ContextPtr) driContextPriv->driverPrivate;
if (R200_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__, rmesa->glCtx);
+ fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)rmesa->glCtx);
r200VtxfmtUnbindContext( rmesa->glCtx );
return GL_TRUE;
diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h
index 0b2ce111f26..5d3d408dbb4 100644
--- a/src/mesa/drivers/dri/r200/r200_context.h
+++ b/src/mesa/drivers/dri/r200/r200_context.h
@@ -788,12 +788,6 @@ struct r200_context {
GLuint Fallback;
GLuint NewGLState;
-
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
/* Vertex buffers
*/
struct r200_ioctl ioctl;
diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c
index fbfdd6374dd..8cc08e994ce 100644
--- a/src/mesa/drivers/dri/r200/r200_ioctl.c
+++ b/src/mesa/drivers/dri/r200/r200_ioctl.c
@@ -412,7 +412,7 @@ void r200CopyBuffer( const __DRIdrawablePrivate *dPriv )
rmesa = (r200ContextPtr) dPriv->driContextPriv->driverPrivate;
if ( R200_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "\n%s( %p )\n\n", __FUNCTION__, rmesa->glCtx );
+ fprintf( stderr, "\n%s( %p )\n\n", __FUNCTION__, (void *)rmesa->glCtx );
}
R200_FIREVERTICES( rmesa );
diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c
index 6c6013054ab..9d1724db7e7 100644
--- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c
+++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c
@@ -50,6 +50,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_swtcl.h"
#include "r200_maos.h"
+
+#if 0
/* Usage:
* - from r200_tcl_render
* - call r200EmitArrays to ensure uptodate arrays in dma
@@ -81,29 +83,6 @@ static void emit_ubyte_rgba3( GLcontext *ctx,
}
}
-
-#if defined(USE_X86_ASM)
-#define COPY_DWORDS( dst, src, nr ) \
-do { \
- int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (__tmp), "=D" (dst), "=S" (__tmp) \
- : "0" (nr), \
- "D" ((long)dst), \
- "S" ((long)src) ); \
-} while (0)
-#else
-#define COPY_DWORDS( dst, src, nr ) \
-do { \
- int j; \
- for ( j = 0 ; j < nr ; j++ ) \
- dst[j] = ((int *)src)[j]; \
- dst += nr; \
-} while (0)
-#endif
-
-
-
static void emit_ubyte_rgba4( GLcontext *ctx,
struct r200_dma_region *rvb,
char *data,
@@ -129,7 +108,6 @@ static void emit_ubyte_rgba4( GLcontext *ctx,
}
-#if 0
static void emit_ubyte_rgba( GLcontext *ctx,
struct r200_dma_region *rvb,
char *data,
@@ -176,6 +154,30 @@ static void emit_ubyte_rgba( GLcontext *ctx,
#endif
+#if defined(USE_X86_ASM)
+#define COPY_DWORDS( dst, src, nr ) \
+do { \
+ int __tmp; \
+ __asm__ __volatile__( "rep ; movsl" \
+ : "=%c" (__tmp), "=D" (dst), "=S" (__tmp) \
+ : "0" (nr), \
+ "D" ((long)dst), \
+ "S" ((long)src) ); \
+} while (0)
+#else
+#define COPY_DWORDS( dst, src, nr ) \
+do { \
+ int j; \
+ for ( j = 0 ; j < nr ; j++ ) \
+ dst[j] = ((int *)src)[j]; \
+ dst += nr; \
+} while (0)
+#endif
+
+
+
+
+
static void emit_vec4( GLcontext *ctx,
struct r200_dma_region *rvb,
char *data,
@@ -235,7 +237,7 @@ static void emit_vec12( GLcontext *ctx,
if (R200_DEBUG & DEBUG_VERTS)
fprintf(stderr, "%s count %d stride %d out %p data %p\n",
- __FUNCTION__, count, stride, out, (void *)data);
+ __FUNCTION__, count, stride, (void *)out, (void *)data);
if (stride == 12)
COPY_DWORDS( out, data, count*3 );
diff --git a/src/mesa/drivers/dri/r200/r200_maos_verts.c b/src/mesa/drivers/dri/r200/r200_maos_verts.c
index f9faa17dcf6..d7429ca76eb 100644
--- a/src/mesa/drivers/dri/r200/r200_maos_verts.c
+++ b/src/mesa/drivers/dri/r200/r200_maos_verts.c
@@ -78,11 +78,6 @@ static struct {
#define DO_TEX3 0
#define GET_TEXSOURCE(n) n
-#define GET_UBYTE_COLOR_STORE() &R200_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &R200_CONTEXT(ctx)->UbyteSecondaryColor
-
-#define IMPORT_FLOAT_COLORS r200_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS r200_import_float_spec_colors
/***********************************************************************
* Generate vertex emit functions *
diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c
index c10b0ebcc25..edf00afcae1 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -48,6 +48,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tnl/tnl.h"
#include "tnl/t_context.h"
#include "tnl/t_pipeline.h"
+#include "tnl/t_vtx_api.h"
#include "r200_context.h"
#include "r200_ioctl.h"
@@ -76,7 +77,6 @@ static struct {
copy_pv_func copy_pv;
GLboolean (*check_tex_sizes)( GLcontext *ctx );
GLuint vertex_size;
- GLuint vertex_stride_shift;
GLuint vertex_format;
} setup_tab[R200_MAX_SETUP];
@@ -149,9 +149,7 @@ static int se_vtx_fmt_1[] = {
#define GET_TEXSOURCE(n) n
#define GET_VERTEX_FORMAT() R200_CONTEXT(ctx)->swtcl.vertex_format
#define GET_VERTEX_STORE() R200_CONTEXT(ctx)->swtcl.verts
-#define GET_VERTEX_STRIDE_SHIFT() R200_CONTEXT(ctx)->swtcl.vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &R200_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &R200_CONTEXT(ctx)->UbyteSecondaryColor
+#define GET_VERTEX_SIZE() R200_CONTEXT(ctx)->swtcl.vertex_size * sizeof(GLuint)
#define HAVE_HW_VIEWPORT 1
#define HAVE_HW_DIVIDE (IND & ~(R200_XYZW_BIT|R200_RGBA_BIT))
@@ -167,10 +165,6 @@ static int se_vtx_fmt_1[] = {
#define CHECK_HW_DIVIDE (!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE| \
DD_TRI_UNFILLED)))
-#define IMPORT_QUALIFIER
-#define IMPORT_FLOAT_COLORS r200_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS r200_import_float_spec_colors
-
#define INTERP_VERTEX setup_tab[R200_CONTEXT(ctx)->swtcl.SetupIndex].interp
#define COPY_PV_VERTEX setup_tab[R200_CONTEXT(ctx)->swtcl.SetupIndex].copy_pv
@@ -291,7 +285,6 @@ static void r200SetVertexFormat( GLcontext *ctx, GLuint ind )
R200_NEWPRIM(rmesa);
i = rmesa->swtcl.vertex_format = setup_tab[ind].vertex_format;
rmesa->swtcl.vertex_size = setup_tab[ind].vertex_size;
- rmesa->swtcl.vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
R200_STATECHANGE( rmesa, vtx );
rmesa->hw.vtx.cmd[VTX_VTXFMT_0] = se_vtx_fmt_0[i];
@@ -350,9 +343,8 @@ void r200BuildVertices( GLcontext *ctx, GLuint start, GLuint count,
GLuint newinputs )
{
r200ContextPtr rmesa = R200_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)rmesa->swtcl.verts +
- (start << rmesa->swtcl.vertex_stride_shift));
- GLuint stride = 1 << rmesa->swtcl.vertex_stride_shift;
+ GLuint stride = rmesa->swtcl.vertex_size * sizeof(int);
+ GLubyte *v = ((GLubyte *)rmesa->swtcl.verts + (start * stride));
newinputs |= rmesa->swtcl.SetupNewInputs;
rmesa->swtcl.SetupNewInputs = 0;
@@ -455,13 +447,15 @@ static __inline void *r200AllocDmaLowVerts( r200ContextPtr rmesa,
-void r200_emit_contiguous_verts( GLcontext *ctx, GLuint start, GLuint count )
+static void *r200_emit_contiguous_verts( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ void *dest)
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint vertex_size = rmesa->swtcl.vertex_size * 4;
- CARD32 *dest = r200AllocDmaLowVerts( rmesa, count-start, vertex_size );
- setup_tab[rmesa->swtcl.SetupIndex].emit( ctx, start, count, dest,
- vertex_size );
+ GLuint stride = rmesa->swtcl.vertex_size * 4;
+ setup_tab[rmesa->swtcl.SetupIndex].emit( ctx, start, count, dest, stride );
+ return (void *)((char *)dest + stride * (count - start));
}
@@ -527,37 +521,13 @@ static __inline void r200EltPrimitive( r200ContextPtr rmesa, GLenum prim )
}
-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 );
- R200_CONTEXT(ctx)->swtcl.SetupNewInputs = _TNL_BIT_POS;
-}
-
-static void ELT_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.PrimTabElts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- R200_CONTEXT(ctx)->swtcl.SetupNewInputs = _TNL_BIT_POS;
-}
#define LOCAL_VARS r200ContextPtr rmesa = R200_CONTEXT(ctx)
-#define ELTS_VARS GLushort *dest
+#define ELTS_VARS(buf) GLushort *dest = buf
#define INIT( prim ) r200DmaPrimitive( rmesa, prim )
#define ELT_INIT(prim) r200EltPrimitive( rmesa, prim )
-#define NEW_PRIMITIVE() R200_NEWPRIM( rmesa )
-#define NEW_BUFFER() r200RefillCurrentDmaRegion( rmesa )
+#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() \
@@ -568,38 +538,36 @@ static void ELT_FALLBACK( GLcontext *ctx,
#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)
-/* How do you extend an existing primitive?
- */
-#define ALLOC_ELTS(nr) \
-do { \
- if (rmesa->dma.flush == r200FlushElts && \
- rmesa->store.cmd_used + nr*2 < R200_CMD_BUF_SZ) { \
- \
- dest = (GLushort *)(rmesa->store.cmd_buf + \
- rmesa->store.cmd_used); \
- rmesa->store.cmd_used += nr*2; \
- } \
- 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)); \
- \
- dest = r200AllocEltsOpenEnded( rmesa, \
- rmesa->swtcl.hw_primitive, \
- nr ); \
- } \
-} while (0)
-#define ALLOC_ELTS_NEW_PRIMITIVE(nr) ALLOC_ELTS( nr )
#ifdef MESA_BIG_ENDIAN
/* We could do without (most of) this ugliness if dest was always 32 bit word aligned... */
@@ -612,14 +580,21 @@ do { \
#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_VERTS( ctx, j, nr ) \
- r200_emit_contiguous_verts(ctx, j, (j)+(nr))
+
#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"
@@ -629,6 +604,7 @@ do { \
/**********************************************************************/
+
static GLboolean r200_run_render( GLcontext *ctx,
struct tnl_pipeline_stage *stage )
{
@@ -643,17 +619,18 @@ static GLboolean r200_run_render( GLcontext *ctx,
- if ((R200_DEBUG & DEBUG_VERTS) || /* No debug */
- VB->ClipOrMask || /* No clipping */
- rmesa->swtcl.RenderIndex != 0 || /* No per-vertex manipulations */
- ctx->Line.StippleFlag) /* No stipple -- fix me? */
+ 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 (!TAG(emit_elt_verts)(ctx, 0, VB->Count))
- return GL_TRUE; /* too many vertices */
+ 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 );
@@ -760,15 +737,15 @@ static void r200ResetLineStipple( GLcontext *ctx );
***********************************************************************/
#undef LOCAL_VARS
+#undef ALLOC_VERTS
#define CTX_ARG r200ContextPtr rmesa
#define CTX_ARG2 rmesa
#define GET_VERTEX_DWORDS() rmesa->swtcl.vertex_size
#define ALLOC_VERTS( n, size ) r200AllocDmaLowVerts( rmesa, n, size * 4 )
#define LOCAL_VARS \
r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- const GLuint shift = rmesa->swtcl.vertex_stride_shift; \
const char *r200verts = (char *)rmesa->swtcl.verts;
-#define VERT(x) (r200Vertex *)(r200verts + (x << shift))
+#define VERT(x) (r200Vertex *)(r200verts + ((x) * vertsize * sizeof(int)))
#define VERTEX r200Vertex
#define DO_DEBUG_VERTS (1 && (R200_DEBUG & DEBUG_VERTS))
#define PRINT_VERTEX(v) r200_print_vertex(rmesa->glCtx, v)
@@ -828,7 +805,7 @@ static struct {
#define VERT_Y(_v) _v->v.y
#define VERT_Z(_v) _v->v.z
#define AREA_IS_CCW( a ) (a < 0)
-#define GET_VERTEX(e) (rmesa->swtcl.verts + (e<<rmesa->swtcl.vertex_stride_shift))
+#define GET_VERTEX(e) (rmesa->swtcl.verts + (e*rmesa->swtcl.vertex_size*sizeof(int)))
#define VERT_SET_RGBA( v, c ) \
do { \
@@ -923,7 +900,6 @@ static void init_rast_tab( void )
/* Render unclipped begin/end objects */
/**********************************************************************/
-#define VERT(x) (r200Vertex *)(r200verts + (x << shift))
#define RENDER_POINTS( start, count ) \
for ( ; start < count ; start++) \
r200_point( rmesa, VERT(start) )
@@ -939,7 +915,7 @@ static void init_rast_tab( void )
#undef LOCAL_VARS
#define LOCAL_VARS \
r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- const GLuint shift = rmesa->swtcl.vertex_stride_shift; \
+ const GLuint vertsize = rmesa->swtcl.vertex_size; \
const char *r200verts = (char *)rmesa->swtcl.verts; \
const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
const GLboolean stipple = ctx->Line.StippleFlag; \
@@ -1299,14 +1275,4 @@ void r200DestroySwtcl( GLcontext *ctx )
ALIGN_FREE(rmesa->swtcl.verts);
rmesa->swtcl.verts = 0;
}
-
- if (rmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(rmesa->UbyteSecondaryColor.Ptr);
- rmesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (rmesa->UbyteColor.Ptr) {
- ALIGN_FREE(rmesa->UbyteColor.Ptr);
- rmesa->UbyteColor.Ptr = 0;
- }
}
diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.h b/src/mesa/drivers/dri/r200/r200_swtcl.h
index f183b931c45..ce2b6b5f06b 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.h
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.h
@@ -54,10 +54,6 @@ extern void r200BuildVertices( GLcontext *ctx, GLuint start, GLuint count,
extern void r200PrintSetupFlags(char *msg, GLuint flags );
-extern void r200_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-
extern void r200_emit_indexed_verts( GLcontext *ctx,
GLuint start,
GLuint count );
diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c
index 256fc8dac80..6059bf5805b 100644
--- a/src/mesa/drivers/dri/r200/r200_tex.c
+++ b/src/mesa/drivers/dri/r200/r200_tex.c
@@ -273,7 +273,8 @@ static r200TexObjPtr r200AllocTexObj( struct gl_texture_object *texObj )
texObj->DriverData = t;
if ( t != NULL ) {
if ( R200_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, texObj, t );
+ fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, (void *)texObj,
+ (void *)t );
}
/* Initialize non-image-dependent parts of the state:
@@ -922,7 +923,7 @@ static void r200BindTexture( GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj )
{
if ( R200_DEBUG & (DEBUG_STATE|DEBUG_TEXTURE) ) {
- fprintf( stderr, "%s( %p ) unit=%d\n", __FUNCTION__, texObj,
+ fprintf( stderr, "%s( %p ) unit=%d\n", __FUNCTION__, (void *)texObj,
ctx->Texture.CurrentUnit );
}
@@ -940,7 +941,7 @@ static void r200DeleteTexture( GLcontext *ctx,
driTextureObject * t = (driTextureObject *) texObj->DriverData;
if ( R200_DEBUG & (DEBUG_STATE|DEBUG_TEXTURE) ) {
- fprintf( stderr, "%s( %p (target = %s) )\n", __FUNCTION__, texObj,
+ fprintf( stderr, "%s( %p (target = %s) )\n", __FUNCTION__, (void *)texObj,
_mesa_lookup_enum_by_nr( texObj->Target ) );
}
diff --git a/src/mesa/drivers/dri/r200/r200_texmem.c b/src/mesa/drivers/dri/r200/r200_texmem.c
index 34db1f4421e..1929397bfb6 100644
--- a/src/mesa/drivers/dri/r200/r200_texmem.c
+++ b/src/mesa/drivers/dri/r200/r200_texmem.c
@@ -62,7 +62,8 @@ void
r200DestroyTexObj( r200ContextPtr rmesa, r200TexObjPtr t )
{
if ( R200_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, t, t->base.tObj );
+ fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__,
+ (void *)t, (void *)t->base.tObj );
}
if ( rmesa != NULL ) {
@@ -291,7 +292,8 @@ static void uploadSubImage( r200ContextPtr rmesa, r200TexObjPtr t,
if ( R200_DEBUG & DEBUG_TEXTURE ) {
fprintf( stderr, "%s( %p, %p ) level/width/height/face = %d/%d/%d/%u\n",
- __FUNCTION__, t, t->base.tObj, level, width, height, face );
+ __FUNCTION__, (void *)t, (void *)t->base.tObj,
+ level, width, height, face );
}
ASSERT(face < 6);
@@ -444,7 +446,7 @@ int r200UploadTexImages( r200ContextPtr rmesa, r200TexObjPtr t, GLuint face )
if ( R200_DEBUG & (DEBUG_TEXTURE|DEBUG_IOCTL) ) {
fprintf( stderr, "%s( %p, %p ) sz=%d lvls=%d-%d\n", __FUNCTION__,
- rmesa->glCtx, t->base.tObj, t->base.totalSize,
+ (void *)rmesa->glCtx, (void *)t->base.tObj, t->base.totalSize,
t->base.firstLevel, t->base.lastLevel );
}
diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c
index 3d82aac3234..b57657c32b4 100644
--- a/src/mesa/drivers/dri/r200/r200_texstate.c
+++ b/src/mesa/drivers/dri/r200/r200_texstate.c
@@ -717,7 +717,7 @@ static GLboolean r200UpdateTextureEnv( GLcontext *ctx, int unit )
|| (texUnit->_Current != NULL) );
if ( R200_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %d )\n", __FUNCTION__, ctx, unit );
+ fprintf( stderr, "%s( %p, %d )\n", __FUNCTION__, (void *)ctx, unit );
}
/* Set the texture environment state. Isn't this nice and clean?
diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c b/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c
index 6f38fffc276..776cb9a5276 100644
--- a/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c
+++ b/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c
@@ -763,6 +763,7 @@ CHOOSE(Normal3f, p3f, MASK_NORM, 0,
CHOOSE(Normal3fv, pfv, MASK_NORM, 0,
(const GLfloat *v), (v))
+#if 0
CHOOSE_COLOR(Color4ub, p4ub, 4, MASK_COLOR, 0,
(GLubyte a,GLubyte b, GLubyte c, GLubyte d), (a,b,c,d))
CHOOSE_COLOR(Color4ubv, pubv, 4, MASK_COLOR, 0,
@@ -771,6 +772,11 @@ CHOOSE_COLOR(Color3ub, p3ub, 3, MASK_COLOR, 0,
(GLubyte a,GLubyte b, GLubyte c), (a,b,c))
CHOOSE_COLOR(Color3ubv, pubv, 3, MASK_COLOR, 0,
(const GLubyte *v), (v))
+CHOOSE_SECONDARY_COLOR(SecondaryColor3ubEXT, p3ub, MASK_SPEC, 0,
+ (GLubyte a,GLubyte b, GLubyte c), (a,b,c))
+CHOOSE_SECONDARY_COLOR(SecondaryColor3ubvEXT, pubv, MASK_SPEC, 0,
+ (const GLubyte *v), (v))
+#endif
CHOOSE_COLOR(Color4f, p4f, 4, MASK_COLOR, 0,
(GLfloat a,GLfloat b, GLfloat c, GLfloat d), (a,b,c,d))
@@ -782,10 +788,6 @@ CHOOSE_COLOR(Color3fv, pfv, 3, MASK_COLOR, 0,
(const GLfloat *v), (v))
-CHOOSE_SECONDARY_COLOR(SecondaryColor3ubEXT, p3ub, MASK_SPEC, 0,
- (GLubyte a,GLubyte b, GLubyte c), (a,b,c))
-CHOOSE_SECONDARY_COLOR(SecondaryColor3ubvEXT, pubv, MASK_SPEC, 0,
- (const GLubyte *v), (v))
CHOOSE_SECONDARY_COLOR(SecondaryColor3fEXT, p3f, MASK_SPEC, 0,
(GLfloat a,GLfloat b, GLfloat c), (a,b,c))
CHOOSE_SECONDARY_COLOR(SecondaryColor3fvEXT, pfv, MASK_SPEC, 0,
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
index 654d24cc4ec..07958b7d139 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
@@ -499,8 +499,6 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
if (inputs & VERT_BIT_COLOR1) {
if (!rmesa->tcl.spec.buf) {
- if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE)
- radeon_import_float_spec_colors( ctx );
emit_ubyte_rgba( ctx,
&rmesa->tcl.spec,
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
index a3d9cc7d2f3..d3d0d04c03d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
@@ -73,11 +73,6 @@ static struct {
#define DO_TEX3 0
#define GET_TEXSOURCE(n) n
-#define GET_UBYTE_COLOR_STORE() &RADEON_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &RADEON_CONTEXT(ctx)->UbyteSecondaryColor
-
-#define IMPORT_FLOAT_COLORS radeon_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS radeon_import_float_spec_colors
/***********************************************************************
* Generate vertex emit functions *
diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
index 46ace70c896..61d80c9ac28 100644
--- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c
+++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
@@ -74,7 +74,6 @@ static struct {
copy_pv_func copy_pv;
GLboolean (*check_tex_sizes)( GLcontext *ctx );
GLuint vertex_size;
- GLuint vertex_stride_shift;
GLuint vertex_format;
} setup_tab[RADEON_MAX_SETUP];
@@ -134,9 +133,7 @@ static struct {
#define GET_TEXSOURCE(n) n
#define GET_VERTEX_FORMAT() RADEON_CONTEXT(ctx)->swtcl.vertex_format
#define GET_VERTEX_STORE() RADEON_CONTEXT(ctx)->swtcl.verts
-#define GET_VERTEX_STRIDE_SHIFT() RADEON_CONTEXT(ctx)->swtcl.vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &RADEON_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &RADEON_CONTEXT(ctx)->UbyteSecondaryColor
+#define GET_VERTEX_SIZE() RADEON_CONTEXT(ctx)->swtcl.vertex_size * sizeof(GLuint)
#define HAVE_HW_VIEWPORT 1
/* Tiny vertices don't seem to work atm - haven't looked into why.
@@ -154,10 +151,6 @@ static struct {
#define CHECK_HW_DIVIDE (!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE| \
DD_TRI_UNFILLED)))
-#define IMPORT_QUALIFIER
-#define IMPORT_FLOAT_COLORS radeon_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS radeon_import_float_spec_colors
-
#define INTERP_VERTEX setup_tab[RADEON_CONTEXT(ctx)->swtcl.SetupIndex].interp
#define COPY_PV_VERTEX setup_tab[RADEON_CONTEXT(ctx)->swtcl.SetupIndex].copy_pv
@@ -271,7 +264,6 @@ static void radeonRenderStart( GLcontext *ctx )
RADEON_NEWPRIM(rmesa);
rmesa->swtcl.vertex_format = setup_tab[ind].vertex_format;
rmesa->swtcl.vertex_size = setup_tab[ind].vertex_size;
- rmesa->swtcl.vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
}
if (!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
@@ -290,9 +282,8 @@ void radeonBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
GLuint newinputs )
{
radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)rmesa->swtcl.verts +
- (start << rmesa->swtcl.vertex_stride_shift));
- GLuint stride = 1 << rmesa->swtcl.vertex_stride_shift;
+ GLuint stride = rmesa->swtcl.vertex_size * sizeof(int);
+ GLubyte *v = ((GLubyte *)rmesa->swtcl.verts + (start * stride));
newinputs |= rmesa->swtcl.SetupNewInputs;
rmesa->swtcl.SetupNewInputs = 0;
@@ -337,7 +328,6 @@ void radeonChooseVertexState( GLcontext *ctx )
RADEON_NEWPRIM(rmesa);
rmesa->swtcl.vertex_format = setup_tab[ind].vertex_format;
rmesa->swtcl.vertex_size = setup_tab[ind].vertex_size;
- rmesa->swtcl.vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
}
{
@@ -440,13 +430,15 @@ static __inline void *radeonAllocDmaLowVerts( radeonContextPtr rmesa,
-void radeon_emit_contiguous_verts( GLcontext *ctx, GLuint start, GLuint count )
+static void *radeon_emit_contiguous_verts( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ void *dest)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint vertex_size = rmesa->swtcl.vertex_size * 4;
- CARD32 *dest = radeonAllocDmaLowVerts( rmesa, count-start, vertex_size );
- setup_tab[rmesa->swtcl.SetupIndex].emit( ctx, start, count, dest,
- vertex_size );
+ GLuint stride = rmesa->swtcl.vertex_size * 4;
+ setup_tab[rmesa->swtcl.SetupIndex].emit( ctx, start, count, dest, stride );
+ return (void *)((char *)dest + stride * (count - start));
}
@@ -512,37 +504,13 @@ static __inline void radeonEltPrimitive( radeonContextPtr rmesa, GLenum prim )
}
-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 );
- RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_POS;
-}
-
-static void ELT_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.PrimTabElts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_POS;
-}
#define LOCAL_VARS radeonContextPtr rmesa = RADEON_CONTEXT(ctx)
-#define ELTS_VARS GLushort *dest
+#define ELTS_VARS( buf ) GLushort *dest = buf
#define INIT( prim ) radeonDmaPrimitive( rmesa, prim )
#define ELT_INIT(prim) radeonEltPrimitive( rmesa, prim )
-#define NEW_PRIMITIVE() RADEON_NEWPRIM( rmesa )
-#define NEW_BUFFER() radeonRefillCurrentDmaRegion( rmesa )
+#define FLUSH() RADEON_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() \
@@ -559,38 +527,35 @@ static void ELT_FALLBACK( GLcontext *ctx,
((RADEON_CMD_BUF_SZ - 1024) / 2)
+static void *radeon_alloc_elts( radeonContextPtr rmesa, int nr )
+{
+ if (rmesa->dma.flush == radeonFlushElts &&
+ rmesa->store.cmd_used + nr*2 < RADEON_CMD_BUF_SZ) {
-/* How do you extend an existing primitive?
- */
-#define ALLOC_ELTS(nr) \
-do { \
- if (rmesa->dma.flush == radeonFlushElts && \
- rmesa->store.cmd_used + nr*2 < RADEON_CMD_BUF_SZ) { \
- \
- dest = (GLushort *)(rmesa->store.cmd_buf + \
- rmesa->store.cmd_used); \
- rmesa->store.cmd_used += nr*2; \
- } \
- else { \
- if (rmesa->dma.flush) { \
- rmesa->dma.flush( rmesa ); \
- } \
- \
- radeonEmitVertexAOS( rmesa, \
- rmesa->swtcl.vertex_size, \
- (rmesa->radeonScreen->gart_buffer_offset + \
- rmesa->swtcl.indexed_verts.buf->buf->idx * \
- RADEON_BUFFER_SIZE + \
- rmesa->swtcl.indexed_verts.start)); \
- \
- dest = radeonAllocEltsOpenEnded( rmesa, \
- rmesa->swtcl.vertex_format, \
- rmesa->swtcl.hw_primitive, \
- nr ); \
- } \
-} while (0)
+ 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 );
+ }
-#define ALLOC_ELTS_NEW_PRIMITIVE(nr) ALLOC_ELTS( nr )
+ radeonEmitVertexAOS( rmesa,
+ rmesa->swtcl.vertex_size,
+ (rmesa->radeonScreen->gart_buffer_offset +
+ rmesa->swtcl.indexed_verts.buf->buf->idx *
+ RADEON_BUFFER_SIZE +
+ rmesa->swtcl.indexed_verts.start));
+
+ return (void *) radeonAllocEltsOpenEnded( rmesa,
+ rmesa->swtcl.vertex_format,
+ rmesa->swtcl.hw_primitive,
+ nr );
+ }
+}
+
+#define ALLOC_ELTS(nr) radeon_alloc_elts(rmesa, nr)
#ifdef MESA_BIG_ENDIAN
/* We could do without (most of) this ugliness if dest was always 32 bit word aligned... */
@@ -603,14 +568,18 @@ do { \
#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() \
radeonReleaseDmaRegion( rmesa, &rmesa->swtcl.indexed_verts, __FUNCTION__ )
-#define EMIT_VERTS( ctx, j, nr ) \
- radeon_emit_contiguous_verts(ctx, j, (j)+(nr))
#define EMIT_INDEXED_VERTS( ctx, start, count ) \
radeon_emit_indexed_verts( ctx, start, count )
+#define ALLOC_VERTS( nr ) \
+ radeonAllocDmaLowVerts( rmesa, nr, rmesa->swtcl.vertex_size * 4 )
+#define EMIT_VERTS( ctx, j, nr, buf ) \
+ radeon_emit_contiguous_verts(ctx, j, (j)+(nr), buf)
+
#define TAG(x) radeon_dma_##x
#include "tnl_dd/t_dd_dmatmp.h"
@@ -632,18 +601,19 @@ static GLboolean radeon_run_render( GLcontext *ctx,
if (rmesa->swtcl.indexed_verts.buf && (!VB->Elts || stage->changed_inputs))
RELEASE_ELT_VERTS();
- if (VB->ClipOrMask || /* No clipping */
- rmesa->swtcl.RenderIndex != 0 || /* No per-vertex manipulations */
- ctx->Line.StippleFlag) /* GH: THIS IS A HACK!!! */
+ if (rmesa->swtcl.RenderIndex != 0 ||
+ !radeon_dma_validate_render( ctx, VB ))
return GL_TRUE;
tnl->Driver.Render.Start( ctx );
if (VB->Elts) {
tab = TAG(render_tab_elts);
- if (!rmesa->swtcl.indexed_verts.buf)
- if (!TAG(emit_elt_verts)(ctx, 0, VB->Count))
- return GL_TRUE; /* too many vertices */
+ if (!rmesa->swtcl.indexed_verts.buf) {
+ if (VB->Count > GET_SUBSEQUENT_VB_MAX_VERTS())
+ return GL_TRUE;
+ EMIT_INDEXED_VERTS(ctx, 0, VB->Count);
+ }
}
for (i = 0 ; i < VB->PrimitiveCount ; i++)
@@ -656,7 +626,7 @@ static GLboolean radeon_run_render( GLcontext *ctx,
continue;
if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "r200_render.c: prim %s %d..%d\n",
+ fprintf(stderr, "radeon_render.c: prim %s %d..%d\n",
_mesa_lookup_enum_by_nr(prim & PRIM_MODE_MASK),
start, start+length);
@@ -870,6 +840,7 @@ static void radeonResetLineStipple( GLcontext *ctx );
***********************************************************************/
#undef LOCAL_VARS
+#undef ALLOC_VERTS
#define CTX_ARG radeonContextPtr rmesa
#define CTX_ARG2 rmesa
#define GET_VERTEX_DWORDS() rmesa->swtcl.vertex_size
@@ -877,9 +848,8 @@ static void radeonResetLineStipple( GLcontext *ctx );
#undef LOCAL_VARS
#define LOCAL_VARS \
radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- const GLuint shift = rmesa->swtcl.vertex_stride_shift; \
const char *radeonverts = (char *)rmesa->swtcl.verts;
-#define VERT(x) (radeonVertex *)(radeonverts + (x << shift))
+#define VERT(x) (radeonVertex *)(radeonverts + (x * vertsize * sizeof(int)))
#define VERTEX radeonVertex
#undef TAG
#define TAG(x) radeon_##x
@@ -937,7 +907,7 @@ static struct {
#define VERT_Y(_v) _v->v.y
#define VERT_Z(_v) _v->v.z
#define AREA_IS_CCW( a ) (a < 0)
-#define GET_VERTEX(e) (rmesa->swtcl.verts + (e<<rmesa->swtcl.vertex_stride_shift))
+#define GET_VERTEX(e) (rmesa->swtcl.verts + (e * rmesa->swtcl.vertex_size * sizeof(int)))
#define VERT_SET_RGBA( v, c ) \
do { \
@@ -1032,7 +1002,7 @@ static void init_rast_tab( void )
/* Render unclipped begin/end objects */
/**********************************************************************/
-#define VERT(x) (radeonVertex *)(radeonverts + (x << shift))
+#define VERT(x) (radeonVertex *)(radeonverts + (x * vertsize * sizeof(int)))
#define RENDER_POINTS( start, count ) \
for ( ; start < count ; start++) \
radeon_point( rmesa, VERT(start) )
@@ -1049,7 +1019,7 @@ static void init_rast_tab( void )
#undef LOCAL_VARS
#define LOCAL_VARS \
radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- const GLuint shift = rmesa->swtcl.vertex_stride_shift; \
+ const GLuint vertsize = rmesa->swtcl.vertex_size; \
const char *radeonverts = (char *)rmesa->swtcl.verts; \
const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
const GLboolean stipple = ctx->Line.StippleFlag; \
diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.h b/src/mesa/drivers/dri/radeon/radeon_swtcl.h
index c45e711c0b1..f95a52c0b8e 100644
--- a/src/mesa/drivers/dri/radeon/radeon_swtcl.h
+++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.h
@@ -55,10 +55,6 @@ extern void radeonBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
extern void radeonPrintSetupFlags(char *msg, GLuint flags );
-extern void radeon_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-
extern void radeon_emit_indexed_verts( GLcontext *ctx,
GLuint start,
GLuint count );
@@ -69,9 +65,5 @@ extern void radeon_translate_vertex( GLcontext *ctx,
extern void radeon_print_vertex( GLcontext *ctx, const radeonVertex *v );
-extern void radeon_import_float_colors( GLcontext *ctx );
-extern void radeon_import_float_spec_colors( GLcontext *ctx );
-
-
#endif
diff --git a/src/mesa/drivers/dri/sis/sis_context.h b/src/mesa/drivers/dri/sis/sis_context.h
index fb4191a6ef2..49b73c4fa28 100644
--- a/src/mesa/drivers/dri/sis/sis_context.h
+++ b/src/mesa/drivers/dri/sis/sis_context.h
@@ -235,11 +235,6 @@ struct sis_context
/* This must be first in this structure */
GLcontext *glCtx;
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
GLuint NewGLState;
GLuint Fallback;
GLuint SetupIndex;
diff --git a/src/mesa/drivers/dri/sis/sis_tris.c b/src/mesa/drivers/dri/sis/sis_tris.c
index 6c7865f6c4b..e49c49e72d2 100644
--- a/src/mesa/drivers/dri/sis/sis_tris.c
+++ b/src/mesa/drivers/dri/sis/sis_tris.c
@@ -265,7 +265,7 @@ static struct {
#define VERT_Y(_v) _v->v.y
#define VERT_Z(_v) _v->v.z
#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (smesa->verts + (e << smesa->vertex_stride_shift))
+#define GET_VERTEX(e) (smesa->verts + (e * smesa->vertex_size * sizeof(int)))
#define VERT_SET_RGBA( v, c ) \
do { \
@@ -483,7 +483,7 @@ sis_fallback_point( sisContextPtr smesa,
/* Render unclipped begin/end objects */
/**********************************************************************/
-#define VERT(x) (sisVertex *)(sisverts + (x << shift))
+#define VERT(x) (sisVertex *)(sisverts + (x * vertsize * sizeof(int)))
#define RENDER_POINTS( start, count ) \
for ( ; start < count ; start++) \
smesa->draw_point( smesa, VERT(start) )
@@ -496,7 +496,7 @@ sis_fallback_point( sisContextPtr smesa,
#undef LOCAL_VARS
#define LOCAL_VARS \
sisContextPtr smesa = SIS_CONTEXT(ctx); \
- const GLuint shift = smesa->vertex_stride_shift; \
+ const GLuint vertsize = smesa->vertex_size; \
const char *sisverts = (char *)smesa->verts; \
const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
(void) elt;
@@ -546,7 +546,6 @@ static void sisFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
GLuint vertsize = smesa->vertex_size;
GLuint *vb = r128AllocDmaLow( rmesa, (n-2) * 3 * 4 * vertsize );
GLubyte *sisverts = (GLubyte *)smesa->verts;
- const GLuint shift = smesa->vertex_stride_shift;
const GLuint *start = (const GLuint *)VERT(elts[0]);
int i,j;
diff --git a/src/mesa/drivers/dri/sis/sis_vb.c b/src/mesa/drivers/dri/sis/sis_vb.c
index 620c1d6f105..acff4601e96 100644
--- a/src/mesa/drivers/dri/sis/sis_vb.c
+++ b/src/mesa/drivers/dri/sis/sis_vb.c
@@ -59,7 +59,6 @@ static struct {
copy_pv_func copy_pv;
GLboolean (*check_tex_sizes)( GLcontext *ctx );
GLuint vertex_size;
- GLuint vertex_stride_shift;
GLuint vertex_format;
} setup_tab[SIS_MAX_SETUP];
@@ -90,9 +89,7 @@ static struct {
#define GET_TEXSOURCE(n) n
#define GET_VERTEX_FORMAT() smesa->vertex_format
#define GET_VERTEX_STORE() smesa->verts
-#define GET_VERTEX_STRIDE_SHIFT() smesa->vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &smesa->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &smesa->UbyteSecondaryColor
+#define GET_VERTEX_SIZE() smesa->vertex_size * sizeof(GLuint)
#define HAVE_HW_VIEWPORT 0
#define HAVE_HW_DIVIDE 0
@@ -112,9 +109,6 @@ static struct {
#define PTEX_FALLBACK() FALLBACK(smesa, SIS_FALLBACK_TEXTURE, 1)
-#define IMPORT_FLOAT_COLORS sis_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS sis_import_float_spec_colors
-
#define INTERP_VERTEX setup_tab[smesa->SetupIndex].interp
#define COPY_PV_VERTEX setup_tab[smesa->SetupIndex].copy_pv
@@ -351,8 +345,8 @@ void sisBuildVertices( GLcontext *ctx,
GLuint newinputs )
{
sisContextPtr smesa = SIS_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)smesa->verts + (start<<smesa->vertex_stride_shift));
- GLuint stride = 1 << smesa->vertex_stride_shift;
+ GLuint stride = smesa->vertex_size * sizeof(int);
+ GLubyte *v = ((GLubyte *)smesa->verts + (start * stride));
newinputs |= smesa->SetupNewInputs;
smesa->SetupNewInputs = 0;
@@ -423,7 +417,6 @@ void sisChooseVertexState( GLcontext *ctx )
if (setup_tab[ind].vertex_format != smesa->vertex_format) {
smesa->vertex_format = setup_tab[ind].vertex_format;
smesa->vertex_size = setup_tab[ind].vertex_size;
- smesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
}
}
@@ -449,15 +442,4 @@ void sisFreeVB( GLcontext *ctx )
ALIGN_FREE(smesa->verts);
smesa->verts = NULL;
}
-
-
- if (smesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(smesa->UbyteSecondaryColor.Ptr);
- smesa->UbyteSecondaryColor.Ptr = NULL;
- }
-
- if (smesa->UbyteColor.Ptr) {
- ALIGN_FREE(smesa->UbyteColor.Ptr);
- smesa->UbyteColor.Ptr = NULL;
- }
}