diff options
author | Dave Airlie <airliedfreedesktop.org> | 2004-02-12 11:52:38 +0000 |
---|---|---|
committer | Dave Airlie <airliedfreedesktop.org> | 2004-02-12 11:52:38 +0000 |
commit | 7b6ceb5b124673df2d94c2fe7dd2e779629f0354 (patch) | |
tree | f90794b9a7362d1bf4a1a7922cdc743e820a205d /src | |
parent | da8337ed5e52741321ee5171ce0b0c43f09036c9 (diff) |
remove vertex_stride_shift, fix up code to not need it
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h | 17 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mach64/mach64_tris.c | 17 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mach64/mach64_vb.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mach64/mach64_vbtmp.h | 21 |
4 files changed, 18 insertions, 45 deletions
diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h index b924bcc86d5..623e1eae3b4 100644 --- a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h +++ b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h @@ -355,7 +355,6 @@ static void TAG(interp)( GLcontext *ctx, LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLubyte *ddverts = GET_VERTEX_STORE(); - /* GLuint shift = GET_VERTEX_STRIDE_SHIFT();*/ GLuint size = GET_VERTEX_SIZE(); const GLfloat *dstclip = VB->ClipPtr->data[edst]; GLfloat w; @@ -540,9 +539,9 @@ static void TAG(copy_pv)( GLcontext *ctx, GLuint edst, GLuint esrc ) #if DO_SPEC || DO_FOG || DO_RGBA LOCALVARS GLubyte *verts = GET_VERTEX_STORE(); - GLuint shift = GET_VERTEX_STRIDE_SHIFT(); - GLuint *dst = (GLuint *)(verts + (edst << shift)); - GLuint *src = (GLuint *)(verts + (esrc << shift)); + GLuint size = GET_VERTEX_SIZE(); + GLuint *dst = (GLuint *)(verts + (edst * size)); + GLuint *src = (GLuint *)(verts + (esrc * size)); #endif #if DO_SPEC || DO_FOG @@ -565,30 +564,20 @@ static void TAG(init)( void ) setup_tab[IND].copy_pv = TAG(copy_pv); - /* vertex_stride_shift must be the same because each - * vertex is aligned with the end of the structure and - * not the beginning - */ #if DO_TEX1 setup_tab[IND].vertex_format = TEX1_VERTEX_FORMAT; setup_tab[IND].vertex_size = 10; - setup_tab[IND].vertex_stride_shift = 6; #elif DO_TEX0 setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT; setup_tab[IND].vertex_size = 7; - setup_tab[IND].vertex_stride_shift = 6; #elif DO_SPEC || DO_FOG setup_tab[IND].vertex_format = NOTEX_VERTEX_FORMAT; setup_tab[IND].vertex_size = 4; - setup_tab[IND].vertex_stride_shift = 6; #else setup_tab[IND].vertex_format = TINY_VERTEX_FORMAT; setup_tab[IND].vertex_size = 3; - setup_tab[IND].vertex_stride_shift = 6; #endif - assert(setup_tab[IND].vertex_size * 4 <= - 1 << setup_tab[IND].vertex_stride_shift); } diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.c b/src/mesa/drivers/dri/mach64/mach64_tris.c index 64f69d24776..83ed6e3d445 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tris.c +++ b/src/mesa/drivers/dri/mach64/mach64_tris.c @@ -1314,21 +1314,21 @@ do { \ #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 MACH64_COLOR( dst, src ) \ do { \ - dst[0] = src[2]; \ - dst[1] = src[1]; \ - dst[2] = src[0]; \ - dst[3] = src[3]; \ + UNCLAMPED_FLOAT_TO_UBYTE(dst[0], src[2]); \ + UNCLAMPED_FLOAT_TO_UBYTE(dst[1], src[1]); \ + UNCLAMPED_FLOAT_TO_UBYTE(dst[2], src[0]); \ + UNCLAMPED_FLOAT_TO_UBYTE(dst[3], src[3]); \ } while (0) #define MACH64_SPEC( dst, src ) \ do { \ - dst[0] = src[2]; \ - dst[1] = src[1]; \ - dst[2] = src[0]; \ + UNCLAMPED_FLOAT_TO_UBYTE(dst[0], src[2]); \ + UNCLAMPED_FLOAT_TO_UBYTE(dst[1], src[1]); \ + UNCLAMPED_FLOAT_TO_UBYTE(dst[2], src[0]); \ } while (0) #define VERT_SET_RGBA( v, c ) MACH64_COLOR( v->ub4[coloroffset], c ) @@ -1674,7 +1674,6 @@ static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, { mach64ContextPtr mmesa = MACH64_CONTEXT( ctx ); GLubyte *mach64verts = (GLubyte *)mmesa->verts; - const GLuint shift = mmesa->vertex_stride_shift; const GLuint *start = (const GLuint *)VERT(elts[0]); int i; diff --git a/src/mesa/drivers/dri/mach64/mach64_vb.c b/src/mesa/drivers/dri/mach64/mach64_vb.c index 254dd27e063..7e23006132b 100644 --- a/src/mesa/drivers/dri/mach64/mach64_vb.c +++ b/src/mesa/drivers/dri/mach64/mach64_vb.c @@ -60,7 +60,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[MACH64_MAX_SETUP]; @@ -89,7 +88,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_VERTEX_SIZE() mmesa->vertex_size * sizeof(GLuint) #define HAVE_HW_VIEWPORT 0 #define HAVE_HW_DIVIDE 0 @@ -519,8 +518,8 @@ void mach64BuildVertices( GLcontext *ctx, GLuint newinputs ) { mach64ContextPtr mmesa = MACH64_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; @@ -599,7 +598,6 @@ void mach64ChooseVertexState( GLcontext *ctx ) FLUSH_BATCH(mmesa); 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; } } diff --git a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h index 590af1b5460..b216a2dc2b9 100644 --- a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h +++ b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h @@ -668,14 +668,14 @@ static void TAG(interp)( GLcontext *ctx, LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLubyte *ddverts = GET_VERTEX_STORE(); - GLuint shift = GET_VERTEX_STRIDE_SHIFT(); + GLuint size = GET_VERTEX_SIZE(); const GLfloat *dstclip = VB->ClipPtr->data[edst]; GLfloat w; const GLfloat *s = GET_VIEWPORT_MAT(); - VERTEX *dst = (VERTEX *)(ddverts + (edst << shift)); - VERTEX *in = (VERTEX *)(ddverts + (ein << shift)); - VERTEX *out = (VERTEX *)(ddverts + (eout << shift)); + VERTEX *dst = (VERTEX *)(ddverts + (edst * size)); + VERTEX *in = (VERTEX *)(ddverts + (ein * size)); + VERTEX *out = (VERTEX *)(ddverts + (eout * size)); (void)s; @@ -840,12 +840,10 @@ static void TAG(init)( void ) ASSERT(HAVE_PTEX_VERTICES); setup_tab[IND].vertex_format = PROJ_TEX3_VERTEX_FORMAT; setup_tab[IND].vertex_size = 18; - setup_tab[IND].vertex_stride_shift = 7; } else { setup_tab[IND].vertex_format = TEX3_VERTEX_FORMAT; setup_tab[IND].vertex_size = 14; - setup_tab[IND].vertex_stride_shift = 6; } } else if (DO_TEX2) { @@ -853,12 +851,10 @@ static void TAG(init)( void ) ASSERT(HAVE_PTEX_VERTICES); setup_tab[IND].vertex_format = PROJ_TEX3_VERTEX_FORMAT; setup_tab[IND].vertex_size = 18; - setup_tab[IND].vertex_stride_shift = 7; } else { setup_tab[IND].vertex_format = TEX2_VERTEX_FORMAT; setup_tab[IND].vertex_size = 12; - setup_tab[IND].vertex_stride_shift = 6; } } else if (DO_TEX1) { @@ -866,41 +862,32 @@ static void TAG(init)( void ) ASSERT(HAVE_PTEX_VERTICES); setup_tab[IND].vertex_format = PROJ_TEX1_VERTEX_FORMAT; setup_tab[IND].vertex_size = 12; - setup_tab[IND].vertex_stride_shift = 6; } else { setup_tab[IND].vertex_format = TEX1_VERTEX_FORMAT; setup_tab[IND].vertex_size = 10; - setup_tab[IND].vertex_stride_shift = 6; } } else if (DO_TEX0) { if (DO_PTEX && HAVE_PTEX_VERTICES) { setup_tab[IND].vertex_format = PROJ_TEX1_VERTEX_FORMAT; setup_tab[IND].vertex_size = 12; - setup_tab[IND].vertex_stride_shift = 6; } else { setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT; setup_tab[IND].vertex_size = 8; - setup_tab[IND].vertex_stride_shift = 5; } } else if (!HAVE_HW_DIVIDE && !DO_SPEC && !DO_FOG && HAVE_TINY_VERTICES) { setup_tab[IND].vertex_format = TINY_VERTEX_FORMAT; setup_tab[IND].vertex_size = 4; - setup_tab[IND].vertex_stride_shift = 4; } else if (HAVE_NOTEX_VERTICES) { setup_tab[IND].vertex_format = NOTEX_VERTEX_FORMAT; setup_tab[IND].vertex_size = 6; - setup_tab[IND].vertex_stride_shift = 5; } else { setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT; setup_tab[IND].vertex_size = 8; - setup_tab[IND].vertex_stride_shift = 5; } - assert(setup_tab[IND].vertex_size * 4 <= - 1 << setup_tab[IND].vertex_stride_shift); } |