diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2003-12-11 16:25:36 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2003-12-11 16:25:36 +0000 |
commit | 2dc621f3fdb585f23013aa3e220f2148f9405538 (patch) | |
tree | d4eb6b4a76b427143e88953bbec0284bf15e3ffc /src/mesa/drivers/dri/mga | |
parent | 5bcf52b4d6951f9058b5ef00cf2438b3bdfbeea0 (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/dri/mga')
-rw-r--r-- | src/mesa/drivers/dri/mga/mgacontext.h | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mga/mgarender.c | 23 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mga/mgatris.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mga/mgavb.c | 36 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mga/mgavb.h | 5 |
5 files changed, 24 insertions, 53 deletions
diff --git a/src/mesa/drivers/dri/mga/mgacontext.h b/src/mesa/drivers/dri/mga/mgacontext.h index 245cb5eb73..7bb8ff3bef 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 5fb7af908c..5852009852 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 739619edf0..bf415a15a6 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 63de3563c4..e8c6b26c23 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 88cc3108df..5f6454aca9 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, |