diff options
author | Keith Whitwell <[email protected]> | 2003-12-11 16:25:36 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2003-12-11 16:25:36 +0000 |
commit | 2dc621f3fdb585f23013aa3e220f2148f9405538 (patch) | |
tree | d4eb6b4a76b427143e88953bbec0284bf15e3ffc /src/mesa/drivers/dri/i810 | |
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/i810')
-rw-r--r-- | src/mesa/drivers/dri/i810/i810context.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i810/i810render.c | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i810/i810tris.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i810/i810vb.c | 36 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i810/i810vb.h | 7 |
5 files changed, 24 insertions, 57 deletions
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, |