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;
#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
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);
}
#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 )
{
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;
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];
#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
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;
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;
}
}
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;
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) {
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) {
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);
}