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/gamma | |
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/gamma')
-rw-r--r-- | src/mesa/drivers/dri/gamma/gamma_context.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/gamma/gamma_render.c | 23 | ||||
-rw-r--r-- | src/mesa/drivers/dri/gamma/gamma_tris.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/gamma/gamma_vb.c | 26 |
4 files changed, 13 insertions, 47 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; - } } |