diff options
author | Keith Whitwell <[email protected]> | 2003-11-24 15:21:14 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2003-11-24 15:21:14 +0000 |
commit | 57c9814b9e87924696df4c741861c29d4236d1eb (patch) | |
tree | 63c9139693032c681fad3e7b50d743b762e0a64d /src/mesa | |
parent | 5b5cf9cb8b3f540365e3da8e4a70f6a5040a1c6c (diff) |
Import vtx-0-2-branch
Diffstat (limited to 'src/mesa')
44 files changed, 411 insertions, 473 deletions
diff --git a/src/mesa/drivers/dri/fb/Makefile.X11 b/src/mesa/drivers/dri/fb/Makefile.X11 index 671de313c08..c1eb713bda9 100644 --- a/src/mesa/drivers/dri/fb/Makefile.X11 +++ b/src/mesa/drivers/dri/fb/Makefile.X11 @@ -1,4 +1,3 @@ -# $Id: Makefile.X11,v 1.3 2003/10/20 02:17:32 jonsmirl Exp $ # Mesa 3-D graphics library # Version: 5.0 diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c index 794e3d1fc8c..7068b94f688 100644 --- a/src/mesa/drivers/dri/fb/fb_dri.c +++ b/src/mesa/drivers/dri/fb/fb_dri.c @@ -1,4 +1,3 @@ -/* $Id: fb_dri.c,v 1.2 2003/10/08 01:53:30 kendallb Exp $ */ /* * Mesa 3-D graphics library diff --git a/src/mesa/drivers/dri/gamma/Makefile.X11 b/src/mesa/drivers/dri/gamma/Makefile.X11 index f779bf336cc..8364ebaecf0 100644 --- a/src/mesa/drivers/dri/gamma/Makefile.X11 +++ b/src/mesa/drivers/dri/gamma/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.2 2003/10/20 02:17:32 jonsmirl Exp $ +# $Id: Makefile.X11,v 1.3 2003/11/24 15:21:14 keithw Exp $ # Mesa 3-D graphics library # Version: 5.0 diff --git a/src/mesa/drivers/dri/gamma/gamma_context.c b/src/mesa/drivers/dri/gamma/gamma_context.c index f7db2adea37..b27851be8f8 100644 --- a/src/mesa/drivers/dri/gamma/gamma_context.c +++ b/src/mesa/drivers/dri/gamma/gamma_context.c @@ -48,9 +48,9 @@ #include "gamma_vb.h" #include "gamma_tris.h" -extern const struct gl_pipeline_stage _gamma_render_stage; +extern const struct tnl_pipeline_stage _gamma_render_stage; -static const struct gl_pipeline_stage *gamma_pipeline[] = { +static const struct tnl_pipeline_stage *gamma_pipeline[] = { &_tnl_vertex_transform_stage, &_tnl_normal_transform_stage, &_tnl_lighting_stage, diff --git a/src/mesa/drivers/dri/gamma/gamma_render.c b/src/mesa/drivers/dri/gamma/gamma_render.c index b8bf6171564..67063c2e525 100644 --- a/src/mesa/drivers/dri/gamma/gamma_render.c +++ b/src/mesa/drivers/dri/gamma/gamma_render.c @@ -46,18 +46,15 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end) struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLfloat (*coord)[4]; GLuint coord_stride; - GLubyte (*col)[4]; + GLfloat (*col)[4]; GLuint col_stride; int i; GLuint tc0_stride = 0; GLfloat (*tc0)[4] = 0; GLuint tc0_size = 0; - if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE) - gamma_import_float_colors( ctx ); - - col = VB->ColorPtr[0]->Ptr; - col_stride = VB->ColorPtr[0]->StrideB; + col = VB->ColorPtr[0]->data; + col_stride = VB->ColorPtr[0]->stride; if (ctx->Texture.Unit[0]._ReallyEnabled) { tc0_stride = VB->TexCoordPtr[0]->stride; @@ -70,58 +67,8 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end) coord_stride = VB->NdcPtr->stride; } - if (VB->importable_data) { - if (start) { - coord = (GLfloat (*)[4])((GLubyte *)coord + start * coord_stride); - STRIDE_4UB(col, start * col_stride); - if (ctx->Texture.Unit[0]._ReallyEnabled) - tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + start * tc0_stride); - } - - if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 4) { - for (i=start; i < end; i++) { - CHECK_DMA_BUFFER(gmesa, 9); - WRITEF(gmesa->buf, Tq4, tc0[0][3]); - WRITEF(gmesa->buf, Tr4, tc0[0][2]); - WRITEF(gmesa->buf, Tt4, tc0[0][0]); - WRITEF(gmesa->buf, Ts4, tc0[0][1]); - WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[0]); - WRITEF(gmesa->buf, Vw, coord[0][3]); - WRITEF(gmesa->buf, Vz, coord[0][2]); - WRITEF(gmesa->buf, Vy, coord[0][1]); - WRITEF(gmesa->buf, Vx4, coord[0][0]); - STRIDE_4UB(col, col_stride); - tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + tc0_stride); - coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride); - } - } else if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 2) { - for (i=start; i < end; i++) { - CHECK_DMA_BUFFER(gmesa, 7); - WRITEF(gmesa->buf, Tt2, tc0[0][0]); - WRITEF(gmesa->buf, Ts2, tc0[0][1]); - WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[0]); - WRITEF(gmesa->buf, Vw, coord[0][3]); - WRITEF(gmesa->buf, Vz, coord[0][2]); - WRITEF(gmesa->buf, Vy, coord[0][1]); - WRITEF(gmesa->buf, Vx4, coord[0][0]); - STRIDE_4UB(col, col_stride); - tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + tc0_stride); - coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride); - } - } else { - for (i=start; i < end; i++) { - CHECK_DMA_BUFFER(gmesa, 4); - WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[0]); - WRITEF(gmesa->buf, Vz, coord[0][2]); - WRITEF(gmesa->buf, Vy, coord[0][1]); - WRITEF(gmesa->buf, Vx3, coord[0][0]); - STRIDE_4UB(col, col_stride); - coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride); - } - } - } else { - if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 4) { - for (i=start; i < end; i++) { + if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 4) { + for (i=start; i < end; i++) { CHECK_DMA_BUFFER(gmesa, 9); WRITEF(gmesa->buf, Tq4, tc0[i][3]); WRITEF(gmesa->buf, Tr4, tc0[i][2]); @@ -132,9 +79,9 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end) WRITEF(gmesa->buf, Vz, coord[i][2]); WRITEF(gmesa->buf, Vy, coord[i][1]); WRITEF(gmesa->buf, Vx4, coord[i][0]); - } - } else if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 2) { - for (i=start; i < end; i++) { + } + } else if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 2) { + for (i=start; i < end; i++) { CHECK_DMA_BUFFER(gmesa, 7); WRITEF(gmesa->buf, Tt2, tc0[i][0]); WRITEF(gmesa->buf, Ts2, tc0[i][1]); @@ -143,15 +90,14 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end) WRITEF(gmesa->buf, Vz, coord[i][2]); WRITEF(gmesa->buf, Vy, coord[i][1]); WRITEF(gmesa->buf, Vx4, coord[i][0]); - } - } else { - for (i=start; i < end; i++) { + } + } else { + for (i=start; i < end; i++) { CHECK_DMA_BUFFER(gmesa, 4); WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[i]); WRITEF(gmesa->buf, Vz, coord[i][2]); WRITEF(gmesa->buf, Vy, coord[i][1]); WRITEF(gmesa->buf, Vx3, coord[i][0]); - } } } } @@ -178,7 +124,7 @@ static void VERT_FALLBACK( GLcontext *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_CLIP; + GAMMA_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS; } static const GLuint hw_prim[GL_POLYGON+1] = { @@ -236,7 +182,7 @@ static __inline void gammaEndPrimitive( gammaContextPtr gmesa ) static GLboolean gamma_run_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { gammaContextPtr gmesa = GAMMA_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -256,12 +202,16 @@ static GLboolean gamma_run_render( GLcontext *ctx, 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) - tab[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; + + tab[prim & PRIM_MODE_MASK]( ctx, start, start + length, prim); } tnl->Driver.Render.Finish( ctx ); @@ -271,9 +221,9 @@ static GLboolean gamma_run_render( GLcontext *ctx, static void gamma_check_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { - GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0; + GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0; if (ctx->RenderMode == GL_RENDER) { if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) @@ -293,13 +243,13 @@ static void gamma_check_render( GLcontext *ctx, } -static void dtr( struct gl_pipeline_stage *stage ) +static void dtr( struct tnl_pipeline_stage *stage ) { (void)stage; } -const struct gl_pipeline_stage _gamma_render_stage = +const struct tnl_pipeline_stage _gamma_render_stage = { "gamma render", (_DD_NEW_SEPARATE_SPECULAR | diff --git a/src/mesa/drivers/dri/gamma/gamma_vb.c b/src/mesa/drivers/dri/gamma/gamma_vb.c index 2e2f9ede457..f4ed08b140f 100644 --- a/src/mesa/drivers/dri/gamma/gamma_vb.c +++ b/src/mesa/drivers/dri/gamma/gamma_vb.c @@ -278,7 +278,7 @@ void gammaBuildVertices( GLcontext *ctx, if (!newinputs) return; - if (newinputs & VERT_BIT_CLIP) { + if (newinputs & VERT_BIT_POS) { setup_tab[gmesa->SetupIndex].emit( ctx, start, count, v, stride ); } else { GLuint ind = 0; diff --git a/src/mesa/drivers/dri/i810/Makefile.X11 b/src/mesa/drivers/dri/i810/Makefile.X11 index 9fd5a5a3e59..8f9c7958ba2 100644 --- a/src/mesa/drivers/dri/i810/Makefile.X11 +++ b/src/mesa/drivers/dri/i810/Makefile.X11 @@ -1,4 +1,3 @@ -# $Id: Makefile.X11,v 1.2 2003/10/20 02:17:32 jonsmirl Exp $ # Mesa 3-D graphics library # Version: 5.0 diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c index da1764cefad..d678aabc824 100644 --- a/src/mesa/drivers/dri/i810/i810context.c +++ b/src/mesa/drivers/dri/i810/i810context.c @@ -107,9 +107,9 @@ static const char * const card_extensions[] = NULL }; -extern const struct gl_pipeline_stage _i810_render_stage; +extern const struct tnl_pipeline_stage _i810_render_stage; -static const struct gl_pipeline_stage *i810_pipeline[] = { +static const struct tnl_pipeline_stage *i810_pipeline[] = { &_tnl_vertex_transform_stage, &_tnl_normal_transform_stage, &_tnl_lighting_stage, diff --git a/src/mesa/drivers/dri/i810/i810render.c b/src/mesa/drivers/dri/i810/i810render.c index 8d388d88b3f..d1c1adc3b7c 100644 --- a/src/mesa/drivers/dri/i810/i810render.c +++ b/src/mesa/drivers/dri/i810/i810render.c @@ -105,7 +105,7 @@ static void VERT_FALLBACK( GLcontext *ctx, 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; + I810_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS; } @@ -137,12 +137,12 @@ 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. */ @@ -150,17 +150,21 @@ static GLboolean i810_run_render( GLcontext *ctx, 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,9 +173,9 @@ static GLboolean i810_run_render( GLcontext *ctx, } -static void i810_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage ) +static void i810_check_render( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { - GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0; + GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0; if (ctx->RenderMode == GL_RENDER) { if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) @@ -191,13 +195,13 @@ static void i810_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage ) } -static void dtr( struct gl_pipeline_stage *stage ) +static void dtr( struct tnl_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 | diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 604d56e2c27..53f1251fa9d 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -74,7 +74,7 @@ static drmBufMapPtr i810_create_empty_buffers(void) memset(retval, 0, sizeof(drmBufMap)); retval->list = (drmBufPtr)ALIGN_MALLOC(sizeof(drmBuf) * I810_DMA_BUF_NR, 32); if(retval->list == NULL) { - FREE(retval); + ALIGN_FREE(retval); return NULL; } memset(retval->list, 0, sizeof(drmBuf) * I810_DMA_BUF_NR); diff --git a/src/mesa/drivers/dri/i810/i810vb.c b/src/mesa/drivers/dri/i810/i810vb.c index ada7f6db853..58979ceac23 100644 --- a/src/mesa/drivers/dri/i810/i810vb.c +++ b/src/mesa/drivers/dri/i810/i810vb.c @@ -383,7 +383,7 @@ void i810BuildVertices( GLcontext *ctx, if (!newinputs) return; - if (newinputs & VERT_BIT_CLIP) { + if (newinputs & VERT_BIT_POS) { setup_tab[imesa->SetupIndex].emit( ctx, start, count, v, stride ); } else { GLuint ind = 0; diff --git a/src/mesa/drivers/dri/i830/Makefile.X11 b/src/mesa/drivers/dri/i830/Makefile.X11 index 3c6a4036822..cfc513690db 100644 --- a/src/mesa/drivers/dri/i830/Makefile.X11 +++ b/src/mesa/drivers/dri/i830/Makefile.X11 @@ -1,4 +1,3 @@ -# $Id: Makefile.X11,v 1.3 2003/10/20 02:17:33 jonsmirl Exp $ # Mesa 3-D graphics library # Version: 5.0 diff --git a/src/mesa/drivers/dri/i830/i830_context.c b/src/mesa/drivers/dri/i830/i830_context.c index 254fa284626..36abd2fdbc4 100644 --- a/src/mesa/drivers/dri/i830/i830_context.c +++ b/src/mesa/drivers/dri/i830/i830_context.c @@ -167,9 +167,9 @@ static const char * const card_extensions[] = }; -extern const struct gl_pipeline_stage _i830_render_stage; +extern const struct tnl_pipeline_stage _i830_render_stage; -static const struct gl_pipeline_stage *i830_pipeline[] = { +static const struct tnl_pipeline_stage *i830_pipeline[] = { &_tnl_vertex_transform_stage, &_tnl_normal_transform_stage, &_tnl_lighting_stage, diff --git a/src/mesa/drivers/dri/i830/i830_render.c b/src/mesa/drivers/dri/i830/i830_render.c index 5df05dfde87..f66acd3b564 100644 --- a/src/mesa/drivers/dri/i830/i830_render.c +++ b/src/mesa/drivers/dri/i830/i830_render.c @@ -122,7 +122,7 @@ static void VERT_FALLBACK( GLcontext *ctx, 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; + I830_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS; } @@ -159,24 +159,27 @@ static GLboolean choose_render( struct vertex_buffer *VB, int bufsz ) 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 start = VB->Primitive[i].start; + 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]; } } @@ -192,7 +195,7 @@ static GLboolean choose_render( struct vertex_buffer *VB, int bufsz ) 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); @@ -205,16 +208,21 @@ static GLboolean i830_run_render( GLcontext *ctx, 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) { - 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 ); @@ -224,9 +232,9 @@ static GLboolean i830_run_render( GLcontext *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; + GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0; if (ctx->RenderMode == GL_RENDER) { if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) inputs |= VERT_BIT_COLOR1; @@ -244,13 +252,13 @@ static void i830_check_render( GLcontext *ctx, stage->inputs = 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 | diff --git a/src/mesa/drivers/dri/i830/i830_vb.c b/src/mesa/drivers/dri/i830/i830_vb.c index a7ac054c230..c9c5408dc99 100644 --- a/src/mesa/drivers/dri/i830/i830_vb.c +++ b/src/mesa/drivers/dri/i830/i830_vb.c @@ -445,7 +445,7 @@ void i830BuildVertices( GLcontext *ctx, if (!newinputs) return; - if (newinputs & VERT_BIT_CLIP) { + if (newinputs & VERT_BIT_POS) { setup_tab[imesa->SetupIndex].emit( ctx, start, count, v, stride ); } else { GLuint ind = 0; diff --git a/src/mesa/drivers/dri/mga/Makefile.X11 b/src/mesa/drivers/dri/mga/Makefile.X11 index cb769838227..246a7451840 100644 --- a/src/mesa/drivers/dri/mga/Makefile.X11 +++ b/src/mesa/drivers/dri/mga/Makefile.X11 @@ -1,4 +1,3 @@ -# $Id: Makefile.X11,v 1.5 2003/10/21 06:05:41 jonsmirl Exp $ # Mesa 3-D graphics library # Version: 5.0 diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index d95c0197ebb..11daf9aaf4f 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -261,9 +261,9 @@ mgaDestroyScreen(__DRIscreenPrivate *sPriv) } -extern const struct gl_pipeline_stage _mga_render_stage; +extern const struct tnl_pipeline_stage _mga_render_stage; -static const struct gl_pipeline_stage *mga_pipeline[] = { +static const struct tnl_pipeline_stage *mga_pipeline[] = { &_tnl_vertex_transform_stage, &_tnl_normal_transform_stage, &_tnl_lighting_stage, @@ -683,7 +683,7 @@ void mgaGetLock( mgaContextPtr mmesa, GLuint flags ) if (*(dPriv->pStamp) != mmesa->lastStamp) { mmesa->lastStamp = *(dPriv->pStamp); - mmesa->SetupNewInputs |= VERT_BIT_CLIP; + mmesa->SetupNewInputs |= VERT_BIT_POS; mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK); mgaUpdateRects( mmesa, (MGA_FRONT|MGA_BACK) ); } diff --git a/src/mesa/drivers/dri/mga/mgarender.c b/src/mesa/drivers/dri/mga/mgarender.c index 516a99099fd..5fb7af908c4 100644 --- a/src/mesa/drivers/dri/mga/mgarender.c +++ b/src/mesa/drivers/dri/mga/mgarender.c @@ -101,7 +101,7 @@ static void VERT_FALLBACK( GLcontext *ctx, GLuint start, GLuint count, 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_CLIP; + MGA_CONTEXT(ctx)->SetupNewInputs |= VERT_BIT_POS; } #define LOCAL_VARS mgaContextPtr mmesa = MGA_CONTEXT(ctx) @@ -131,12 +131,12 @@ static void VERT_FALLBACK( GLcontext *ctx, GLuint start, GLuint count, static GLboolean mga_run_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { mgaContextPtr mmesa = MGA_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 or vertex manipulations. */ @@ -147,13 +147,17 @@ static GLboolean mga_run_render( GLcontext *ctx, tnl->Driver.Render.Start( ctx ); mmesa->SetupNewInputs = ~0; - 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) - mga_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; + + mga_render_tab_verts[prim & PRIM_MODE_MASK]( ctx, start, start + length, + prim); } tnl->Driver.Render.Finish( ctx ); @@ -162,9 +166,9 @@ static GLboolean mga_run_render( GLcontext *ctx, } -static void mga_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage ) +static void mga_check_render( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { - GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0; + GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0; if (ctx->RenderMode == GL_RENDER) { if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) @@ -184,13 +188,13 @@ static void mga_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage ) } -static void dtr( struct gl_pipeline_stage *stage ) +static void dtr( struct tnl_pipeline_stage *stage ) { (void)stage; } -const struct gl_pipeline_stage _mga_render_stage = +const struct tnl_pipeline_stage _mga_render_stage = { "mga render", (_DD_NEW_SEPARATE_SPECULAR | diff --git a/src/mesa/drivers/dri/mga/mgavb.c b/src/mesa/drivers/dri/mga/mgavb.c index 17dde2bba60..63de3563c45 100644 --- a/src/mesa/drivers/dri/mga/mgavb.c +++ b/src/mesa/drivers/dri/mga/mgavb.c @@ -362,7 +362,7 @@ void mgaBuildVertices( GLcontext *ctx, if (!newinputs) return; - if (newinputs & VERT_BIT_CLIP) { + if (newinputs & VERT_BIT_POS) { setup_tab[mmesa->SetupIndex].emit( ctx, start, count, v, stride ); } else { GLuint ind = 0; diff --git a/src/mesa/drivers/dri/r128/Makefile.X11 b/src/mesa/drivers/dri/r128/Makefile.X11 index e8f07a5e3b1..c77b0e44459 100644 --- a/src/mesa/drivers/dri/r128/Makefile.X11 +++ b/src/mesa/drivers/dri/r128/Makefile.X11 @@ -1,4 +1,3 @@ -# $Id: Makefile.X11,v 1.3 2003/10/21 06:05:43 jonsmirl Exp $ # Mesa 3-D graphics library # Version: 5.0 diff --git a/src/mesa/drivers/dri/r128/r128_vb.c b/src/mesa/drivers/dri/r128/r128_vb.c index 0387e5dc977..6c52975286f 100644 --- a/src/mesa/drivers/dri/r128/r128_vb.c +++ b/src/mesa/drivers/dri/r128/r128_vb.c @@ -382,7 +382,7 @@ void r128BuildVertices( GLcontext *ctx, if (!newinputs) return; - if (newinputs & VERT_BIT_CLIP) { + if (newinputs & VERT_BIT_POS) { setup_tab[rmesa->SetupIndex].emit( ctx, start, count, v, stride ); } else { GLuint ind = 0; diff --git a/src/mesa/drivers/dri/r200/Makefile.X11 b/src/mesa/drivers/dri/r200/Makefile.X11 index aad26a70acc..bfa332af25e 100644 --- a/src/mesa/drivers/dri/r200/Makefile.X11 +++ b/src/mesa/drivers/dri/r200/Makefile.X11 @@ -1,4 +1,3 @@ -# $Id: Makefile.X11,v 1.6 2003/10/21 06:05:46 jonsmirl Exp $ # Mesa 3-D graphics library # Version: 5.0 diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index b64ee2b1f29..53aa711cc1e 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -169,10 +169,10 @@ static const char * const card_extensions[] = NULL }; -extern const struct gl_pipeline_stage _r200_render_stage; -extern const struct gl_pipeline_stage _r200_tcl_stage; +extern const struct tnl_pipeline_stage _r200_render_stage; +extern const struct tnl_pipeline_stage _r200_tcl_stage; -static const struct gl_pipeline_stage *r200_pipeline[] = { +static const struct tnl_pipeline_stage *r200_pipeline[] = { /* Try and go straight to t&l */ diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c index 7842c0c594f..b442dce207a 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c +++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c @@ -43,7 +43,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "math/m_translate.h" #include "tnl/tnl.h" #include "tnl/t_context.h" -#include "tnl/t_imm_debug.h" #include "r200_context.h" #include "r200_ioctl.h" @@ -341,9 +340,6 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs ) GLuint vfmt0 = 0, vfmt1 = 0; GLuint count = VB->Count; - if (R200_DEBUG & DEBUG_VERTS) - _tnl_print_vert_flags( __FUNCTION__, inputs ); - if (1) { if (!rmesa->tcl.obj.buf) emit_vector( ctx, @@ -358,7 +354,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs ) case 3: vfmt0 |= R200_VTX_Z0; case 2: default: - break; + break; } component[nr++] = &rmesa->tcl.obj; } @@ -378,60 +374,44 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs ) } if (inputs & VERT_BIT_COLOR0) { - if (VB->ColorPtr[0]->Type == GL_UNSIGNED_BYTE) { - if (!rmesa->tcl.rgba.buf) - emit_ubyte_rgba( ctx, - &rmesa->tcl.rgba, - (char *)VB->ColorPtr[0]->Ptr, - VB->ColorPtr[0]->Size, - VB->ColorPtr[0]->StrideB, - count); - - vfmt0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT; + int emitsize; + + if (VB->ColorPtr[0]->size == 4 && + (VB->ColorPtr[0]->stride != 0 || + VB->ColorPtr[0]->data[0][3] != 1.0)) { + vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT; + emitsize = 4; } - else { - int emitsize; - - if (VB->ColorPtr[0]->Size == 4 && - (VB->ColorPtr[0]->StrideB != 0 || - ((GLfloat *)VB->ColorPtr[0]->Ptr)[3] != 1.0)) { - vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT; - emitsize = 4; - } - else { - vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_0_SHIFT; - emitsize = 3; - } - - if (!rmesa->tcl.rgba.buf) - emit_vector( ctx, - &(rmesa->tcl.rgba), - (char *)VB->ColorPtr[0]->Ptr, - emitsize, - VB->ColorPtr[0]->StrideB, - count); + else { + vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_0_SHIFT; + emitsize = 3; } + if (!rmesa->tcl.rgba.buf) + emit_vector( ctx, + &(rmesa->tcl.rgba), + (char *)VB->ColorPtr[0]->data, + emitsize, + VB->ColorPtr[0]->stride, + count); + component[nr++] = &rmesa->tcl.rgba; } if (inputs & VERT_BIT_COLOR1) { if (!rmesa->tcl.spec.buf) { - if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE) - r200_import_float_spec_colors( ctx ); - - emit_ubyte_rgba( ctx, - &rmesa->tcl.spec, - (char *)VB->SecondaryColorPtr[0]->Ptr, - 3, - VB->SecondaryColorPtr[0]->StrideB, - count); + emit_vector( ctx, + &rmesa->tcl.spec, + (char *)VB->SecondaryColorPtr[0]->data, + 3, + VB->SecondaryColorPtr[0]->stride, + count); } /* How does this work? */ - vfmt0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT; + vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_1_SHIFT; component[nr++] = &rmesa->tcl.spec; } @@ -480,8 +460,8 @@ void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs ) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); - if (R200_DEBUG & DEBUG_VERTS) - _tnl_print_vert_flags( __FUNCTION__, newinputs ); +/* if (R200_DEBUG & DEBUG_VERTS) */ +/* _tnl_print_vert_flags( __FUNCTION__, newinputs ); */ if (newinputs & VERT_BIT_POS) r200ReleaseDmaRegion( rmesa, &rmesa->tcl.obj, __FUNCTION__ ); diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 55a00cd4de7..27dc6fd1f2b 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -2089,10 +2089,30 @@ static void r200InvalidateState( GLcontext *ctx, GLuint new_state ) r200VtxfmtInvalidate( ctx ); } +/* A hack. The r200 can actually cope just fine with materials + * between begin/ends, so fix this. + */ +static GLboolean check_material( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLint i; + + for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT; + i < _TNL_ATTRIB_MAT_BACK_INDEXES; + i++) + if (tnl->vb.AttribPtr[i] && + tnl->vb.AttribPtr[i]->stride) + return GL_TRUE; + + return GL_FALSE; +} + + static void r200WrapRunPipeline( GLcontext *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); + GLboolean has_material; if (0) fprintf(stderr, "%s, newstate: %x\n", __FUNCTION__, rmesa->NewGLState); @@ -2102,7 +2122,9 @@ static void r200WrapRunPipeline( GLcontext *ctx ) if (rmesa->NewGLState) r200ValidateState( ctx ); - if (tnl->vb.Material) { + has_material = (ctx->Light.Enabled && check_material( ctx )); + + if (has_material) { TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_TRUE ); } @@ -2110,7 +2132,7 @@ static void r200WrapRunPipeline( GLcontext *ctx ) */ _tnl_run_pipeline( ctx ); - if (tnl->vb.Material) { + if (has_material) { TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_FALSE ); r200UpdateMaterial( ctx ); /* not needed any more? */ } diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index 9d98358d45e..ca5c456889d 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -47,7 +47,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "math/m_translate.h" #include "tnl/tnl.h" #include "tnl/t_context.h" -#include "tnl/t_imm_exec.h" #include "tnl/t_pipeline.h" #include "r200_context.h" @@ -537,7 +536,7 @@ static void VERT_FALLBACK( GLcontext *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 = VERT_BIT_CLIP; + R200_CONTEXT(ctx)->swtcl.SetupNewInputs = _TNL_BIT_POS; } static void ELT_FALLBACK( GLcontext *ctx, @@ -549,7 +548,7 @@ static void ELT_FALLBACK( GLcontext *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 = VERT_BIT_CLIP; + R200_CONTEXT(ctx)->swtcl.SetupNewInputs = _TNL_BIT_POS; } @@ -631,7 +630,7 @@ do { \ static GLboolean r200_run_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -659,18 +658,21 @@ static GLboolean r200_run_render( GLcontext *ctx, tnl->Driver.Render.Start( ctx ); - for (i = 0 ; !(flags & PRIM_LAST) ; i += length) + for (i = 0 ; i < VB->PrimitiveCount ; i++) { - flags = VB->Primitive[i]; - length = VB->PrimitiveLength[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(flags & PRIM_MODE_MASK), - i, i+length); + _mesa_lookup_enum_by_nr(prim & PRIM_MODE_MASK), + start, start+length); - if (length) - tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags ); + tab[prim & PRIM_MODE_MASK]( ctx, start, start + length, flags ); } tnl->Driver.Render.Finish( ctx ); @@ -681,35 +683,35 @@ static GLboolean r200_run_render( GLcontext *ctx, static void r200_check_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { - GLuint inputs = VERT_BIT_POS | VERT_BIT_CLIP | VERT_BIT_COLOR0; + GLuint inputs = _TNL_BIT_POS | _TNL_BIT_COLOR0; if (ctx->RenderMode == GL_RENDER) { if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) - inputs |= VERT_BIT_COLOR1; + inputs |= _TNL_BIT_COLOR1; if (ctx->Texture.Unit[0]._ReallyEnabled) - inputs |= VERT_BIT_TEX0; + inputs |= _TNL_BIT_TEX0; if (ctx->Texture.Unit[1]._ReallyEnabled) - inputs |= VERT_BIT_TEX1; + inputs |= _TNL_BIT_TEX1; if (ctx->Fog.Enabled) - inputs |= VERT_BIT_FOG; + inputs |= _TNL_BIT_FOG; } stage->inputs = inputs; } -static void dtr( struct gl_pipeline_stage *stage ) +static void dtr( struct tnl_pipeline_stage *stage ) { (void)stage; } -const struct gl_pipeline_stage _r200_render_stage = +const struct tnl_pipeline_stage _r200_render_stage = { "r200 render", (_DD_NEW_SEPARATE_SPECULAR | @@ -1230,7 +1232,7 @@ r200PointsBitmap( GLcontext *ctx, GLint px, GLint py, void r200FlushVertices( GLcontext *ctx, GLuint flags ) { - _tnl_flush_vertices( ctx, flags ); + _tnl_FlushVertices( ctx, flags ); if (flags & FLUSH_STORED_VERTICES) R200_NEWPRIM( R200_CONTEXT( ctx ) ); diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c index b02a7cc559b..60e281ffaf3 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/src/mesa/drivers/dri/r200/r200_tcl.c @@ -254,7 +254,7 @@ void r200TclPrimitive( GLcontext *ctx, /* TCL render. */ static GLboolean r200_run_tcl_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -277,24 +277,19 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx, rmesa->tcl.Elts = VB->Elts; - 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 (R200_DEBUG & DEBUG_PRIMS) - fprintf(stderr, "%s: prim %s %d..%d\n", - __FUNCTION__, - _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK), - i, i+length); + GLuint prim = VB->Primitive[i].mode; + GLuint start = VB->Primitive[i].start; + GLuint length = VB->Primitive[i].count; if (!length) continue; if (rmesa->tcl.Elts) - r200EmitEltPrimitive( ctx, i, i+length, flags ); + r200EmitEltPrimitive( ctx, start, start+length, prim ); else - r200EmitPrimitive( ctx, i, i+length, flags ); + r200EmitPrimitive( ctx, start, start+length, prim ); } return GL_FALSE; /* finished the pipe */ @@ -303,7 +298,7 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx, static void r200_check_tcl_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint inputs = VERT_BIT_POS; @@ -359,13 +354,13 @@ static void r200_check_tcl_render( GLcontext *ctx, } static void r200_init_tcl_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { stage->check = r200_check_tcl_render; stage->check( ctx, stage ); } -static void dtr( struct gl_pipeline_stage *stage ) +static void dtr( struct tnl_pipeline_stage *stage ) { (void)stage; } @@ -373,7 +368,7 @@ static void dtr( struct gl_pipeline_stage *stage ) /* Initial state for tcl stage. */ -const struct gl_pipeline_stage _r200_tcl_stage = +const struct tnl_pipeline_stage _r200_tcl_stage = { "r200 render", (_DD_NEW_SEPARATE_SPECULAR | diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt.c b/src/mesa/drivers/dri/r200/r200_vtxfmt.c index a617d3f0290..2e742d4d04f 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt.c @@ -74,10 +74,10 @@ static void count_funcs( r200ContextPtr rmesa ) count_func( "Vertex2fv", &rmesa->vb.dfn_cache.Vertex2fv ); count_func( "Vertex3f", &rmesa->vb.dfn_cache.Vertex3f ); count_func( "Vertex3fv", &rmesa->vb.dfn_cache.Vertex3fv ); - count_func( "Color4ub", &rmesa->vb.dfn_cache.Color4ub ); - count_func( "Color4ubv", &rmesa->vb.dfn_cache.Color4ubv ); - count_func( "Color3ub", &rmesa->vb.dfn_cache.Color3ub ); - count_func( "Color3ubv", &rmesa->vb.dfn_cache.Color3ubv ); + count_func( "Color4ub", &rmesa->vb.dfn_cache.Color4ub ); + count_func( "Color4ubv", &rmesa->vb.dfn_cache.Color4ubv ); + count_func( "Color3ub", &rmesa->vb.dfn_cache.Color3ub ); + count_func( "Color3ubv", &rmesa->vb.dfn_cache.Color3ubv ); count_func( "Color4f", &rmesa->vb.dfn_cache.Color4f ); count_func( "Color4fv", &rmesa->vb.dfn_cache.Color4fv ); count_func( "Color3f", &rmesa->vb.dfn_cache.Color3f ); @@ -467,7 +467,10 @@ static void VFMT_FALLBACK( const char *caller ) glNormal3fv( rmesa->vb.normalptr ); if (VTX_COLOR(ind0, 0) == R200_VTX_PK_RGBA) - glColor4ub( rmesa->vb.colorptr->red, rmesa->vb.colorptr->green, rmesa->vb.colorptr->blue, rmesa->vb.colorptr->alpha ); + glColor4ub( rmesa->vb.colorptr->red, + rmesa->vb.colorptr->green, + rmesa->vb.colorptr->blue, + rmesa->vb.colorptr->alpha ); else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGBA) glColor4fv( rmesa->vb.floatcolorptr ); else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGB) { @@ -481,7 +484,9 @@ static void VFMT_FALLBACK( const char *caller ) } if (VTX_COLOR(ind0, 1) == R200_VTX_PK_RGBA) - _glapi_Dispatch->SecondaryColor3ubEXT( rmesa->vb.specptr->red, rmesa->vb.specptr->green, rmesa->vb.specptr->blue ); + _glapi_Dispatch->SecondaryColor3ubEXT( rmesa->vb.specptr->red, + rmesa->vb.specptr->green, + rmesa->vb.specptr->blue ); if (ind1 & (7 << R200_VTX_TEX0_COMP_CNT_SHIFT)) glTexCoord2fv( rmesa->vb.texcoordptr[0] ); @@ -1005,13 +1010,14 @@ void r200VtxfmtInit( GLcontext *ctx, GLboolean useCodegen ) vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT; vfmt->EdgeFlag = _mesa_noop_EdgeFlag; vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv; - vfmt->Indexi = _mesa_noop_Indexi; - vfmt->Indexiv = _mesa_noop_Indexiv; + vfmt->Indexf = _mesa_noop_Indexf; + vfmt->Indexfv = _mesa_noop_Indexfv; /* Active but unsupported -- fallback if we receive these: */ vfmt->CallList = r200_fallback_CallList; + vfmt->CallLists = r200_fallback_CallLists; vfmt->EvalCoord1f = r200_fallback_EvalCoord1f; vfmt->EvalCoord1fv = r200_fallback_EvalCoord1fv; vfmt->EvalCoord2f = r200_fallback_EvalCoord2f; diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c b/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c index efef751a616..6f38fffc276 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c @@ -826,16 +826,10 @@ void r200VtxfmtInitChoosers( GLvertexformat *vfmt ) { vfmt->Color3f = choose_Color3f; vfmt->Color3fv = choose_Color3fv; - vfmt->Color3ub = choose_Color3ub; - vfmt->Color3ubv = choose_Color3ubv; vfmt->Color4f = choose_Color4f; vfmt->Color4fv = choose_Color4fv; - vfmt->Color4ub = choose_Color4ub; - vfmt->Color4ubv = choose_Color4ubv; vfmt->SecondaryColor3fEXT = choose_SecondaryColor3fEXT; vfmt->SecondaryColor3fvEXT = choose_SecondaryColor3fvEXT; - vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT; - vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT; vfmt->MultiTexCoord1fARB = choose_MultiTexCoord1fARB; vfmt->MultiTexCoord1fvARB = choose_MultiTexCoord1fvARB; vfmt->MultiTexCoord2fARB = choose_MultiTexCoord2fARB; @@ -850,6 +844,17 @@ void r200VtxfmtInitChoosers( GLvertexformat *vfmt ) vfmt->Vertex2fv = choose_Vertex2fv; vfmt->Vertex3f = choose_Vertex3f; vfmt->Vertex3fv = choose_Vertex3fv; + + /* TODO: restore ubyte colors to vtxfmt. + */ +#if 0 + vfmt->Color3ub = choose_Color3ub; + vfmt->Color3ubv = choose_Color3ubv; + vfmt->Color4ub = choose_Color4ub; + vfmt->Color4ubv = choose_Color4ubv; + vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT; + vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT; +#endif } diff --git a/src/mesa/drivers/dri/radeon/Makefile.X11 b/src/mesa/drivers/dri/radeon/Makefile.X11 index 19dabce262c..fd379e9a0d6 100644 --- a/src/mesa/drivers/dri/radeon/Makefile.X11 +++ b/src/mesa/drivers/dri/radeon/Makefile.X11 @@ -1,4 +1,3 @@ -# $Id: Makefile.X11,v 1.3 2003/10/21 06:05:49 jonsmirl Exp $ # Mesa 3-D graphics library # Version: 5.0 diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 5604d9c8c21..02bfb23ca59 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -165,11 +165,11 @@ static const char * const card_extensions[] = NULL }; -extern const struct gl_pipeline_stage _radeon_texrect_stage; -extern const struct gl_pipeline_stage _radeon_render_stage; -extern const struct gl_pipeline_stage _radeon_tcl_stage; +extern const struct tnl_pipeline_stage _radeon_texrect_stage; +extern const struct tnl_pipeline_stage _radeon_render_stage; +extern const struct tnl_pipeline_stage _radeon_tcl_stage; -static const struct gl_pipeline_stage *radeon_pipeline[] = { +static const struct tnl_pipeline_stage *radeon_pipeline[] = { /* Try and go straight to t&l */ @@ -412,6 +412,9 @@ radeonCreateContext( const __GLcontextModes *glVisual, radeonInitState( rmesa ); radeonInitSwtcl( ctx ); + _mesa_vector4f_alloc( &rmesa->tcl.ObjClean, 0, + ctx->Const.MaxArrayLockSize, 32 ); + fthrottle_mode = driQueryOptioni(&rmesa->optionCache, "fthrottle_mode"); rmesa->iw.irq_seq = -1; rmesa->irqsEmitted = 0; @@ -505,6 +508,8 @@ void radeonDestroyContext( __DRIcontextPrivate *driContextPriv ) rmesa->glCtx->DriverCtx = NULL; _mesa_destroy_context( rmesa->glCtx ); + _mesa_vector4f_free( &rmesa->tcl.ObjClean ); + if (rmesa->state.scissor.pClipRects) { FREE(rmesa->state.scissor.pClipRects); rmesa->state.scissor.pClipRects = 0; diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h index 69808837ea4..b0c3c1919e1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_context.h @@ -57,6 +57,8 @@ typedef struct radeon_context *radeonContextPtr; #include "radeon_screen.h" #include "mm.h" +#include "math/m_vector.h" + /* Flags for software fallback cases */ /* See correponding strings in radeon_swtcl.c */ #define RADEON_FALLBACK_TEXTURE 0x0001 @@ -503,6 +505,11 @@ struct radeon_tcl_info { GLint last_offset; GLuint hw_primitive; + /* Temporary for cases where incoming vertex data is incompatible + * with maos code. + */ + GLvector4f ObjClean; + struct radeon_dma_region *aos_components[8]; GLuint nr_aos_components; @@ -699,12 +706,6 @@ struct radeon_context { GLuint Fallback; GLuint NewGLState; - - /* Temporaries for translating away float colors: - */ - struct gl_client_array UbyteColor; - struct gl_client_array UbyteSecondaryColor; - /* Vertex buffers */ struct radeon_ioctl ioctl; diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h index b379bad985f..c16234a9437 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h +++ b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h @@ -39,13 +39,14 @@ static void TAG(emit)( GLcontext *ctx, void *dest ) { LOCALVARS - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLuint (*tc0)[4], (*tc1)[4], (*tc2)[4]; + GLfloat (*col)[4], (*spec)[4]; GLfloat (*fog)[4]; GLuint (*norm)[4]; - GLubyte (*col)[4], (*spec)[4]; GLuint tc0_stride, tc1_stride, col_stride, spec_stride, fog_stride; GLuint tc2_stride, norm_stride; + GLuint fill_tex = 0; GLuint (*coord)[4]; GLuint coord_stride; /* object coordinates */ GLubyte dummy[4]; @@ -56,36 +57,20 @@ static void TAG(emit)( GLcontext *ctx, if (RADEON_DEBUG & DEBUG_VERTS) fprintf(stderr, "%s\n", __FUNCTION__); - /* The vertex code expects Obj to be clean to element 3. To fix - * this, add more vertex code (for obj-2, obj-3) or preferably move - * to maos. - */ - if (VB->ObjPtr->size < 3) { - if (VB->ObjPtr->flags & VEC_NOT_WRITEABLE) { - VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE ); - } - _mesa_vector4f_clean_elem( VB->ObjPtr, VB->Count, 2 ); - } - - if (DO_W && VB->ObjPtr->size < 4) { - if (VB->ObjPtr->flags & VEC_NOT_WRITEABLE) { - VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE ); - } - _mesa_vector4f_clean_elem( VB->ObjPtr, VB->Count, 3 ); - } - coord = (GLuint (*)[4])VB->ObjPtr->data; coord_stride = VB->ObjPtr->stride; if (DO_TEX2) { - const GLuint t2 = GET_TEXSOURCE(2); - tc2 = (GLuint (*)[4])VB->TexCoordPtr[t2]->data; - tc2_stride = VB->TexCoordPtr[t2]->stride; - if (DO_PTEX && VB->TexCoordPtr[t2]->size < 4) { - if (VB->TexCoordPtr[t2]->flags & VEC_NOT_WRITEABLE) { - VB->import_data( ctx, VERT_BIT_TEX2, VEC_NOT_WRITEABLE ); + if (VB->TexCoordPtr[2]) { + const GLuint t2 = GET_TEXSOURCE(2); + tc2 = (GLuint (*)[4])VB->TexCoordPtr[t2]->data; + tc2_stride = VB->TexCoordPtr[t2]->stride; + if (DO_PTEX && VB->TexCoordPtr[t2]->size < 4) { + fill_tex |= (1<<2); } - _mesa_vector4f_clean_elem( VB->TexCoordPtr[t2], VB->Count, 3 ); + } else { + tc2 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX2]; + tc2_stride = 0; } } @@ -95,13 +80,10 @@ static void TAG(emit)( GLcontext *ctx, tc1 = (GLuint (*)[4])VB->TexCoordPtr[t1]->data; tc1_stride = VB->TexCoordPtr[t1]->stride; if (DO_PTEX && VB->TexCoordPtr[t1]->size < 4) { - if (VB->TexCoordPtr[t1]->flags & VEC_NOT_WRITEABLE) { - VB->import_data( ctx, VERT_BIT_TEX1, VEC_NOT_WRITEABLE ); - } - _mesa_vector4f_clean_elem( VB->TexCoordPtr[t1], VB->Count, 3 ); + fill_tex |= (1<<1); } } else { - tc1 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX1]; /* could be anything, really */ + tc1 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX1]; tc1_stride = 0; } } @@ -112,13 +94,10 @@ static void TAG(emit)( GLcontext *ctx, tc0_stride = VB->TexCoordPtr[t0]->stride; tc0 = (GLuint (*)[4])VB->TexCoordPtr[t0]->data; if (DO_PTEX && VB->TexCoordPtr[t0]->size < 4) { - if (VB->TexCoordPtr[t0]->flags & VEC_NOT_WRITEABLE) { - VB->import_data( ctx, VERT_BIT_TEX0, VEC_NOT_WRITEABLE ); - } - _mesa_vector4f_clean_elem( VB->TexCoordPtr[t0], VB->Count, 3 ); + fill_tex |= (1<<0); } } else { - tc0 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX0]; /* could be anything, really */ + tc0 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX0]; tc0_stride = 0; } @@ -136,28 +115,20 @@ static void TAG(emit)( GLcontext *ctx, if (DO_RGBA) { if (VB->ColorPtr[0]) { - /* This is incorrect when colormaterial is enabled: - */ - if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE) { - if (0) fprintf(stderr, "IMPORTING FLOAT COLORS\n"); - IMPORT_FLOAT_COLORS( ctx ); - } - col = (GLubyte (*)[4])VB->ColorPtr[0]->Ptr; - col_stride = VB->ColorPtr[0]->StrideB; + col = VB->ColorPtr[0]->data; + col_stride = VB->ColorPtr[0]->stride; } else { - col = &dummy; /* any old memory is fine */ + col = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; col_stride = 0; } } if (DO_SPEC) { if (VB->SecondaryColorPtr[0]) { - if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE) - IMPORT_FLOAT_SPEC_COLORS( ctx ); - spec = (GLubyte (*)[4])VB->SecondaryColorPtr[0]->Ptr; - spec_stride = VB->SecondaryColorPtr[0]->StrideB; + spec = VB->SecondaryColorPtr[0]->data; + spec_stride = VB->SecondaryColorPtr[0]->stride; } else { - spec = &dummy; + spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; spec_stride = 0; } } @@ -173,33 +144,33 @@ static void TAG(emit)( GLcontext *ctx, } - if (VB->importable_data) { - if (start) { - coord = (GLuint (*)[4])((GLubyte *)coord + start * coord_stride); - if (DO_TEX0) - tc0 = (GLuint (*)[4])((GLubyte *)tc0 + start * tc0_stride); - if (DO_TEX1) - tc1 = (GLuint (*)[4])((GLubyte *)tc1 + start * tc1_stride); - if (DO_TEX2) - tc2 = (GLuint (*)[4])((GLubyte *)tc2 + start * tc2_stride); - if (DO_NORM) - norm = (GLuint (*)[4])((GLubyte *)norm + start * norm_stride); - if (DO_RGBA) - STRIDE_4UB(col, start * col_stride); - if (DO_SPEC) - STRIDE_4UB(spec, start * spec_stride); - if (DO_FOG) - fog = (GLfloat (*)[4])((GLubyte *)fog + start * fog_stride); - } + if (start) { + coord = (GLuint (*)[4])((GLubyte *)coord + start * coord_stride); + if (DO_TEX0) + tc0 = (GLuint (*)[4])((GLubyte *)tc0 + start * tc0_stride); + if (DO_TEX1) + tc1 = (GLuint (*)[4])((GLubyte *)tc1 + start * tc1_stride); + if (DO_TEX2) + tc2 = (GLuint (*)[4])((GLubyte *)tc2 + start * tc2_stride); + if (DO_NORM) + norm = (GLuint (*)[4])((GLubyte *)norm + start * norm_stride); + if (DO_RGBA) + STRIDE_4F(col, start * col_stride); + if (DO_SPEC) + STRIDE_4F(spec, start * spec_stride); + if (DO_FOG) + STRIDE_4F(fog, start * fog_stride); + } + + { for (i=start; i < end; i++) { + v[0].ui = coord[0][0]; v[1].ui = coord[0][1]; v[2].ui = coord[0][2]; - if (TCL_DEBUG) fprintf(stderr, "%d: %.2f %.2f %.2f ", i, v[0].f, v[1].f, v[2].f); if (DO_W) { v[3].ui = coord[0][3]; - if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[3].f); v += 4; } else @@ -210,26 +181,27 @@ static void TAG(emit)( GLcontext *ctx, v[0].ui = norm[0][0]; v[1].ui = norm[0][1]; v[2].ui = norm[0][2]; - if (TCL_DEBUG) fprintf(stderr, "norm: %.2f %.2f %.2f ", v[0].f, v[1].f, v[2].f); v += 3; norm = (GLuint (*)[4])((GLubyte *)norm + norm_stride); } if (DO_RGBA) { - v[0].ui = LE32_TO_CPU(*(GLuint *)&col[0]); - STRIDE_4UB(col, col_stride); - if (TCL_DEBUG) fprintf(stderr, "%x ", v[0].ui); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.red, col[0][0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.green, col[0][1]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.blue, col[0][2]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.alpha, col[0][3]); + STRIDE_4F(col, col_stride); v++; } if (DO_SPEC || DO_FOG) { if (DO_SPEC) { - v[0].specular.red = spec[0][0]; - v[0].specular.green = spec[0][1]; - v[0].specular.blue = spec[0][2]; - STRIDE_4UB(spec, spec_stride); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.red, spec[0][0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.green, spec[0][1]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.blue, spec[0][2]); + STRIDE_4F(spec, spec_stride); } if (DO_FOG) { - v[0].specular.alpha = fog[0][0] * 255.0; - fog = (GLfloat (*)[4])((GLubyte *)fog + fog_stride); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.alpha, fog[0][0]); + fog = (GLfloat (*)[4])((GLubyte *)fog + fog_stride); } if (TCL_DEBUG) fprintf(stderr, "%x ", v[0].ui); v++; @@ -239,7 +211,10 @@ static void TAG(emit)( GLcontext *ctx, v[1].ui = tc0[0][1]; if (TCL_DEBUG) fprintf(stderr, "t0: %.2f %.2f ", v[0].f, v[1].f); if (DO_PTEX) { - v[2].ui = tc0[0][3]; + if (fill_tex & (1<<0)) + v[2].f = 1.0; + else + v[2].ui = tc0[0][3]; if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[2].f); v += 3; } @@ -252,7 +227,10 @@ static void TAG(emit)( GLcontext *ctx, v[1].ui = tc1[0][1]; if (TCL_DEBUG) fprintf(stderr, "t1: %.2f %.2f ", v[0].f, v[1].f); if (DO_PTEX) { - v[2].ui = tc1[0][3]; + if (fill_tex & (1<<1)) + v[2].f = 1.0; + else + v[2].ui = tc1[0][3]; if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[2].f); v += 3; } @@ -264,7 +242,10 @@ static void TAG(emit)( GLcontext *ctx, v[0].ui = tc2[0][0]; v[1].ui = tc2[0][1]; if (DO_PTEX) { - v[2].ui = tc2[0][3]; + if (fill_tex & (1<<2)) + v[2].f = 1.0; + else + v[2].ui = tc2[0][3]; v += 3; } else @@ -273,71 +254,6 @@ static void TAG(emit)( GLcontext *ctx, } if (TCL_DEBUG) fprintf(stderr, "\n"); } - } else { - for (i=start; i < end; i++) { - v[0].ui = coord[i][0]; - v[1].ui = coord[i][1]; - v[2].ui = coord[i][2]; - if (DO_W) { - v[3].ui = coord[i][3]; - v += 4; - } - else - v += 3; - - if (DO_NORM) { - v[0].ui = norm[i][0]; - v[1].ui = norm[i][1]; - v[2].ui = norm[i][2]; - v += 3; - } - if (DO_RGBA) { - v[0].ui = LE32_TO_CPU(*(GLuint *)&col[i]); - v++; - } - if (DO_SPEC || DO_FOG) { - if (DO_SPEC) { - v[0].specular.red = spec[i][0]; - v[0].specular.green = spec[i][1]; - v[0].specular.blue = spec[i][2]; - } - if (DO_FOG) { - GLfloat *f = (GLfloat *) ((GLubyte *)fog + fog_stride); - v[0].specular.alpha = *f * 255.0; - } - v++; - } - if (DO_TEX0) { - v[0].ui = tc0[i][0]; - v[1].ui = tc0[i][1]; - if (DO_PTEX) { - v[2].ui = tc0[i][3]; - v += 3; - } - else - v += 2; - } - if (DO_TEX1) { - v[0].ui = tc1[i][0]; - v[1].ui = tc1[i][1]; - if (DO_PTEX) { - v[2].ui = tc1[i][3]; - v += 3; - } - else - v += 2; - } - if (DO_TEX2) { - v[0].ui = tc2[i][0]; - v[1].ui = tc2[i][1]; - if (DO_PTEX) { - v[2].ui = tc2[i][3]; - v += 3; - } - else - v += 2; - } - } } } diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c index b32fd624fa3..5e63e6e880f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c @@ -40,7 +40,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "array_cache/acache.h" #include "tnl/tnl.h" #include "tnl/t_pipeline.h" -#include "tnl/t_imm_debug.h" #include "radeon_context.h" #include "radeon_state.h" @@ -53,7 +52,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define RADEON_TCL_MAX_SETUP 13 -union emit_union { float f; GLuint ui; radeon_color_t specular; }; +union emit_union { float f; GLuint ui; radeon_color_t rgba; }; static struct { void (*emit)( GLcontext *, GLuint, GLuint, void * ); @@ -308,6 +307,41 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) setup_tab[i].vertex_size * 4, 4); + /* The vertex code expects Obj to be clean to element 3. To fix + * this, add more vertex code (for obj-2, obj-3) or preferably move + * to maos. + */ + if (VB->ObjPtr->size < 3 || + (VB->ObjPtr->size == 3 && + (setup_tab[i].vertex_format & RADEON_CP_VC_FRMT_W0))) { + + _math_trans_4f( rmesa->tcl.ObjClean.data, + VB->ObjPtr->data, + VB->ObjPtr->stride, + GL_FLOAT, + VB->ObjPtr->size, + 0, + VB->Count ); + + switch (VB->ObjPtr->size) { + case 1: + _mesa_vector4f_clean_elem(&rmesa->tcl.ObjClean, VB->Count, 1); + case 2: + _mesa_vector4f_clean_elem(&rmesa->tcl.ObjClean, VB->Count, 2); + case 3: + if (setup_tab[i].vertex_format & RADEON_CP_VC_FRMT_W0) { + _mesa_vector4f_clean_elem(&rmesa->tcl.ObjClean, VB->Count, 3); + } + case 4: + default: + break; + } + + VB->ObjPtr = &rmesa->tcl.ObjClean; + } + + + setup_tab[i].emit( ctx, 0, VB->Count, rmesa->tcl.indexed_verts.address + rmesa->tcl.indexed_verts.start ); diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 7b1bbe75fd2..c15f3417bb9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -2115,10 +2115,30 @@ static void radeonInvalidateState( GLcontext *ctx, GLuint new_state ) radeonVtxfmtInvalidate( ctx ); } + +/* A hack. Need a faster way to find this out. + */ +static GLboolean check_material( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLint i; + + for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT; + i < _TNL_ATTRIB_MAT_BACK_INDEXES; + i++) + if (tnl->vb.AttribPtr[i] && + tnl->vb.AttribPtr[i]->stride) + return GL_TRUE; + + return GL_FALSE; +} + + static void radeonWrapRunPipeline( GLcontext *ctx ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); + GLboolean has_material; if (0) fprintf(stderr, "%s, newstate: %x\n", __FUNCTION__, rmesa->NewGLState); @@ -2128,7 +2148,9 @@ static void radeonWrapRunPipeline( GLcontext *ctx ) if (rmesa->NewGLState) radeonValidateState( ctx ); - if (tnl->vb.Material) { + has_material = (ctx->Light.Enabled && check_material( ctx )); + + if (has_material) { TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_MATERIAL, GL_TRUE ); } @@ -2136,7 +2158,7 @@ static void radeonWrapRunPipeline( GLcontext *ctx ) */ _tnl_run_pipeline( ctx ); - if (tnl->vb.Material) { + if (has_material) { TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_MATERIAL, GL_FALSE ); radeonUpdateMaterial( ctx ); /* not needed any more? */ } diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c index 89db677392d..157a863e328 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c @@ -44,8 +44,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "math/m_translate.h" #include "tnl/tnl.h" #include "tnl/t_context.h" -#include "tnl/t_imm_exec.h" #include "tnl/t_pipeline.h" +#include "tnl/t_vtx_api.h" /* for _tnl_FlushVertices */ #include "radeon_context.h" #include "radeon_ioctl.h" @@ -521,7 +521,7 @@ static void VERT_FALLBACK( GLcontext *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_CLIP; + RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_POS; } static void ELT_FALLBACK( GLcontext *ctx, @@ -533,7 +533,7 @@ static void ELT_FALLBACK( GLcontext *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_CLIP; + RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_POS; } @@ -621,7 +621,7 @@ do { \ static GLboolean radeon_run_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -646,18 +646,22 @@ static GLboolean radeon_run_render( GLcontext *ctx, return GL_TRUE; /* too many vertices */ } - for (i = 0 ; !(flags & PRIM_LAST) ; i += length) + for (i = 0 ; i < VB->PrimitiveCount ; i++) { - flags = VB->Primitive[i]; - length = VB->PrimitiveLength[i]; + GLuint prim = VB->Primitive[i].mode; + GLuint start = VB->Primitive[i].start; + GLuint length = VB->Primitive[i].count; + + if (!length) + continue; if (RADEON_DEBUG & DEBUG_PRIMS) - fprintf(stderr, "radeon_render.c: prim %s %d..%d\n", - _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK), - i, i+length); + fprintf(stderr, "r200_render.c: prim %s %d..%d\n", + _mesa_lookup_enum_by_nr(prim & PRIM_MODE_MASK), + start, start+length); if (length) - tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags ); + tab[prim & PRIM_MODE_MASK]( ctx, start, start + length, flags ); } tnl->Driver.Render.Finish( ctx ); @@ -668,9 +672,9 @@ static GLboolean radeon_run_render( GLcontext *ctx, static void radeon_check_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { - GLuint inputs = VERT_BIT_POS | VERT_BIT_CLIP | VERT_BIT_COLOR0; + GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0; if (ctx->RenderMode == GL_RENDER) { if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) @@ -690,13 +694,13 @@ static void radeon_check_render( GLcontext *ctx, } -static void dtr( struct gl_pipeline_stage *stage ) +static void dtr( struct tnl_pipeline_stage *stage ) { (void)stage; } -const struct gl_pipeline_stage _radeon_render_stage = +const struct tnl_pipeline_stage _radeon_render_stage = { "radeon render", (_DD_NEW_SEPARATE_SPECULAR | @@ -729,7 +733,7 @@ struct texrect_stage_data { static GLboolean run_texrect_stage( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { struct texrect_stage_data *store = TEXRECT_STAGE_DATA(stage); radeonContextPtr rmesa = RADEON_CONTEXT(ctx); @@ -771,7 +775,7 @@ static GLboolean run_texrect_stage( GLcontext *ctx, /* Called the first time stage->run() is invoked. */ static GLboolean alloc_texrect_data( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct texrect_stage_data *store; @@ -793,7 +797,7 @@ static GLboolean alloc_texrect_data( GLcontext *ctx, static void check_texrect( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { GLuint flags = 0; @@ -809,7 +813,7 @@ static void check_texrect( GLcontext *ctx, } -static void free_texrect_data( struct gl_pipeline_stage *stage ) +static void free_texrect_data( struct tnl_pipeline_stage *stage ) { struct texrect_stage_data *store = TEXRECT_STAGE_DATA(stage); GLuint i; @@ -824,7 +828,7 @@ static void free_texrect_data( struct gl_pipeline_stage *stage ) } -const struct gl_pipeline_stage _radeon_texrect_stage = +const struct tnl_pipeline_stage _radeon_texrect_stage = { "radeon texrect stage", /* name */ _NEW_TEXTURE, /* check_state */ @@ -1193,7 +1197,7 @@ void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) void radeonFlushVertices( GLcontext *ctx, GLuint flags ) { - _tnl_flush_vertices( ctx, flags ); + _tnl_FlushVertices( ctx, flags ); if (flags & FLUSH_STORED_VERTICES) RADEON_NEWPRIM( RADEON_CONTEXT( ctx ) ); @@ -1242,13 +1246,4 @@ void radeonDestroySwtcl( GLcontext *ctx ) 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/radeon/radeon_tcl.c b/src/mesa/drivers/dri/radeon/radeon_tcl.c index 651194a8047..ffa09d15dac 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_tcl.c @@ -277,7 +277,7 @@ void radeonTclPrimitive( GLcontext *ctx, /* TCL render. */ static GLboolean radeon_run_tcl_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -297,24 +297,19 @@ static GLboolean radeon_run_tcl_render( GLcontext *ctx, rmesa->tcl.Elts = VB->Elts; - 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 (RADEON_DEBUG & DEBUG_PRIMS) - fprintf(stderr, "%s: prim %s %d..%d\n", - __FUNCTION__, - _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK), - i, i+length); + GLuint prim = VB->Primitive[i].mode; + GLuint start = VB->Primitive[i].start; + GLuint length = VB->Primitive[i].count; if (!length) continue; if (rmesa->tcl.Elts) - radeonEmitEltPrimitive( ctx, i, i+length, flags ); + radeonEmitEltPrimitive( ctx, start, start+length, prim ); else - radeonEmitPrimitive( ctx, i, i+length, flags ); + radeonEmitPrimitive( ctx, start, start+length, prim ); } return GL_FALSE; /* finished the pipe */ @@ -323,7 +318,7 @@ static GLboolean radeon_run_tcl_render( GLcontext *ctx, static void radeon_check_tcl_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); GLuint inputs = VERT_BIT_POS; @@ -374,13 +369,13 @@ static void radeon_check_tcl_render( GLcontext *ctx, } static void radeon_init_tcl_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { stage->check = radeon_check_tcl_render; stage->check( ctx, stage ); } -static void dtr( struct gl_pipeline_stage *stage ) +static void dtr( struct tnl_pipeline_stage *stage ) { (void)stage; } @@ -388,7 +383,7 @@ static void dtr( struct gl_pipeline_stage *stage ) /* Initial state for tcl stage. */ -const struct gl_pipeline_stage _radeon_tcl_stage = +const struct tnl_pipeline_stage _radeon_tcl_stage = { "radeon render", (_DD_NEW_SEPARATE_SPECULAR | diff --git a/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c b/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c index 9af0942898d..4e27324807f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c +++ b/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c @@ -973,13 +973,14 @@ void radeonVtxfmtInit( GLcontext *ctx, GLboolean useCodegen ) vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT; vfmt->EdgeFlag = _mesa_noop_EdgeFlag; vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv; - vfmt->Indexi = _mesa_noop_Indexi; - vfmt->Indexiv = _mesa_noop_Indexiv; + vfmt->Indexf = _mesa_noop_Indexf; + vfmt->Indexfv = _mesa_noop_Indexfv; /* Active but unsupported -- fallback if we receive these: */ vfmt->CallList = radeon_fallback_CallList; + vfmt->CallLists = radeon_fallback_CallLists; vfmt->EvalCoord1f = radeon_fallback_EvalCoord1f; vfmt->EvalCoord1fv = radeon_fallback_EvalCoord1fv; vfmt->EvalCoord2f = radeon_fallback_EvalCoord2f; diff --git a/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c b/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c index 04cffb77729..0bdb9a8bbd6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c +++ b/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c @@ -831,16 +831,10 @@ void radeonVtxfmtInitChoosers( GLvertexformat *vfmt ) { vfmt->Color3f = choose_Color3f; vfmt->Color3fv = choose_Color3fv; - vfmt->Color3ub = choose_Color3ub; - vfmt->Color3ubv = choose_Color3ubv; vfmt->Color4f = choose_Color4f; vfmt->Color4fv = choose_Color4fv; - vfmt->Color4ub = choose_Color4ub; - vfmt->Color4ubv = choose_Color4ubv; vfmt->SecondaryColor3fEXT = choose_SecondaryColor3fEXT; vfmt->SecondaryColor3fvEXT = choose_SecondaryColor3fvEXT; - vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT; - vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT; vfmt->MultiTexCoord1fARB = choose_MultiTexCoord1fARB; vfmt->MultiTexCoord1fvARB = choose_MultiTexCoord1fvARB; vfmt->MultiTexCoord2fARB = choose_MultiTexCoord2fARB; @@ -855,6 +849,15 @@ void radeonVtxfmtInitChoosers( GLvertexformat *vfmt ) vfmt->Vertex2fv = choose_Vertex2fv; vfmt->Vertex3f = choose_Vertex3f; vfmt->Vertex3fv = choose_Vertex3fv; + +#if 0 + vfmt->Color3ub = choose_Color3ub; + vfmt->Color3ubv = choose_Color3ubv; + vfmt->Color4ub = choose_Color4ub; + vfmt->Color4ubv = choose_Color4ubv; + vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT; + vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT; +#endif } diff --git a/src/mesa/drivers/dri/sis/Makefile.X11 b/src/mesa/drivers/dri/sis/Makefile.X11 index d6cea8fa6d8..8cdf77f1147 100644 --- a/src/mesa/drivers/dri/sis/Makefile.X11 +++ b/src/mesa/drivers/dri/sis/Makefile.X11 @@ -1,4 +1,3 @@ -# $Id: Makefile.X11,v 1.2 2003/10/20 02:17:33 jonsmirl Exp $ # Mesa 3-D graphics library # Version: 5.0 diff --git a/src/mesa/drivers/dri/sis/sis_vb.c b/src/mesa/drivers/dri/sis/sis_vb.c index 6d56451d69e..5c17bd3801a 100644 --- a/src/mesa/drivers/dri/sis/sis_vb.c +++ b/src/mesa/drivers/dri/sis/sis_vb.c @@ -361,7 +361,7 @@ void sisBuildVertices( GLcontext *ctx, if (!newinputs) return; - if (newinputs & VERT_BIT_CLIP) { + if (newinputs & VERT_BIT_POS) { setup_tab[smesa->SetupIndex].emit( ctx, start, count, v, stride ); } else { GLuint ind = 0; diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index 61d530cd785..557c0038647 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -1242,7 +1242,7 @@ fxDDGetString(GLcontext * ctx, GLenum name) } } -static const struct gl_pipeline_stage *fx_pipeline[] = { +static const struct tnl_pipeline_stage *fx_pipeline[] = { &_tnl_vertex_transform_stage, /* TODO: Add the fastpath here */ &_tnl_normal_transform_stage, &_tnl_lighting_stage, diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c index 2d9f73d6a8f..8d3647ad60e 100644 --- a/src/mesa/drivers/glide/fxvb.c +++ b/src/mesa/drivers/glide/fxvb.c @@ -299,7 +299,7 @@ void fxBuildVertices( GLcontext *ctx, GLuint start, GLuint count, if (!newinputs) return; - if (newinputs & VERT_BIT_CLIP) { + if (newinputs & VERT_BIT_POS) { setup_tab[fxMesa->SetupIndex].emit( ctx, start, count, v ); } else { GLuint ind = 0; diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index b923c999416..74c6caab697 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -1,4 +1,3 @@ -/* $Id: wmesa.c,v 1.2 2003/11/04 23:37:53 brianp Exp $ */ /* * Windows (Win32) device driver for Mesa 3.4 |