-/* $Id: t_imm_elt.c,v 1.22 2003/03/31 18:19:56 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* Version: 5.1
typedef void (*trans_elt_1f_func)(GLfloat *to,
CONST void *ptr,
GLuint stride,
- GLuint *flags,
- GLuint *elts,
+ const GLuint *flags,
+ const GLuint *elts,
GLuint match,
GLuint start,
GLuint n );
typedef void (*trans_elt_1ui_func)(GLuint *to,
CONST void *ptr,
GLuint stride,
- GLuint *flags,
- GLuint *elts,
+ const GLuint *flags,
+ const GLuint *elts,
GLuint match,
GLuint start,
GLuint n );
typedef void (*trans_elt_1ub_func)(GLubyte *to,
CONST void *ptr,
GLuint stride,
- GLuint *flags,
- GLuint *elts,
+ const GLuint *flags,
+ const GLuint *elts,
GLuint match,
GLuint start,
GLuint n );
typedef void (*trans_elt_4ub_func)(GLubyte (*to)[4],
CONST void *ptr,
GLuint stride,
- GLuint *flags,
- GLuint *elts,
+ const GLuint *flags,
+ const GLuint *elts,
GLuint match,
GLuint start,
GLuint n );
typedef void (*trans_elt_4us_func)(GLushort (*to)[4],
CONST void *ptr,
GLuint stride,
- GLuint *flags,
- GLuint *elts,
+ const GLuint *flags,
+ const GLuint *elts,
GLuint match,
GLuint start,
GLuint n );
typedef void (*trans_elt_4f_func)(GLfloat (*to)[4],
CONST void *ptr,
GLuint stride,
- GLuint *flags,
- GLuint *elts,
+ const GLuint *flags,
+ const GLuint *elts,
GLuint match,
GLuint start,
GLuint n );
typedef void (*trans_elt_3f_func)(GLfloat (*to)[3],
CONST void *ptr,
GLuint stride,
- GLuint *flags,
- GLuint *elts,
+ const GLuint *flags,
+ const GLuint *elts,
GLuint match,
GLuint start,
GLuint n );
* That the correct value for normal is used.
*/
#define TAB(x) _tnl_trans_elt##x##_tab
-#define ARGS GLuint *flags, GLuint *elts, GLuint match, \
+#define ARGS const GLuint *flags, const GLuint *elts, GLuint match, \
GLuint start, GLuint n
#define SRC_START 0
#define DST_START start
#if 00
static void _tnl_trans_elt_1f(GLfloat *to,
const struct gl_client_array *from,
- GLuint *flags,
- GLuint *elts,
+ const GLuint *flags,
+ const GLuint *elts,
GLuint match,
GLuint start,
GLuint n )
static void _tnl_trans_elt_1ui(GLuint *to,
const struct gl_client_array *from,
- GLuint *flags,
- GLuint *elts,
+ const GLuint *flags,
+ const GLuint *elts,
GLuint match,
GLuint start,
GLuint n )
static void _tnl_trans_elt_1ub(GLubyte *to,
const struct gl_client_array *from,
- GLuint *flags,
- GLuint *elts,
+ const GLuint *flags,
+ const GLuint *elts,
GLuint match,
GLuint start,
GLuint n )
#if 0
static void _tnl_trans_elt_4ub(GLubyte (*to)[4],
const struct gl_client_array *from,
- GLuint *flags,
- GLuint *elts,
+ const GLuint *flags,
+ const GLuint *elts,
GLuint match,
GLuint start,
GLuint n )
#if 0
static void _tnl_trans_elt_4us(GLushort (*to)[4],
const struct gl_client_array *from,
- GLuint *flags,
- GLuint *elts,
+ const GLuint *flags,
+ const GLuint *elts,
GLuint match,
GLuint start,
GLuint n )
static void _tnl_trans_elt_4f(GLfloat (*to)[4],
const struct gl_client_array *from,
- GLuint *flags,
- GLuint *elts,
+ const GLuint *flags,
+ const GLuint *elts,
GLuint match,
GLuint start,
GLuint n )
#if 0
static void _tnl_trans_elt_3f(GLfloat (*to)[3],
const struct gl_client_array *from,
- GLuint *flags,
- GLuint *elts,
+ const GLuint *flags,
+ const GLuint *elts,
GLuint match,
GLuint start,
GLuint n )
GLuint start, GLuint count )
{
GLuint *flags = IM->Flag;
- GLuint *elts = IM->Elt;
+ const GLuint *elts = IM->Elt;
GLuint translate = ctx->Array._Enabled;
GLuint i, attr;
if (MESA_VERBOSE & VERBOSE_IMMEDIATE)
_mesa_debug(ctx, "exec_array_elements %d .. %d\n", start, count);
- if (translate & VERT_BIT_POS) {
- _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_POS],
- &ctx->Array.Vertex,
- flags, elts, (VERT_BIT_ELT|VERT_BIT_POS),
- start, count);
-
- if (ctx->Array.Vertex.Size == 4)
- translate |= VERT_BITS_OBJ_234;
- else if (ctx->Array.Vertex.Size == 3)
- translate |= VERT_BITS_OBJ_23;
- }
+ /* XXX It would be nice to replace this code with a loop over the vertex
+ * attributes but there's a fair number of special cases.
+ */
/* Allocate destination attribute arrays if needed */
+ ASSERT(IM->Attrib[VERT_ATTRIB_POS]);
for (attr = 1; attr < VERT_ATTRIB_MAX; attr++) {
if ((translate & (1 << attr)) && !IM->Attrib[attr]) {
IM->Attrib[attr] = _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
}
+ if (translate & VERT_BIT_POS) {
+ _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_POS],
+ &ctx->Array.Vertex,
+ flags, elts, (VERT_BIT_ELT|VERT_BIT_POS),
+ start, count);
+
+ if (ctx->Array.Vertex.Size == 4)
+ translate |= VERT_BITS_OBJ_234;
+ else if (ctx->Array.Vertex.Size == 3)
+ translate |= VERT_BITS_OBJ_23;
+ }
+
if (translate & VERT_BIT_NORMAL)
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_NORMAL],
&ctx->Array.Normal,
flags, elts, (VERT_BIT_ELT|VERT_BIT_NORMAL),
start, count);
- if (translate & VERT_BIT_EDGEFLAG)
- _tnl_trans_elt_1ub( IM->EdgeFlag,
- &ctx->Array.EdgeFlag,
- flags, elts, (VERT_BIT_ELT|VERT_BIT_EDGEFLAG),
- start, count);
-
if (translate & VERT_BIT_COLOR0) {
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR0],
&ctx->Array.Color,
flags, elts, (VERT_BIT_ELT|VERT_BIT_FOG),
start, count);
- if (translate & VERT_BIT_INDEX)
- _tnl_trans_elt_1ui( IM->Index,
- &ctx->Array.Index,
- flags, elts, (VERT_BIT_ELT|VERT_BIT_INDEX),
- start, count);
-
if (translate & VERT_BITS_TEX_ANY) {
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
if (translate & VERT_BIT_TEX(i)) {
}
}
+ if (translate & VERT_BIT_INDEX)
+ _tnl_trans_elt_1ui( IM->Index,
+ &ctx->Array.Index,
+ flags, elts, (VERT_BIT_ELT|VERT_BIT_INDEX),
+ start, count);
+
+ if (translate & VERT_BIT_EDGEFLAG)
+ _tnl_trans_elt_1ub( IM->EdgeFlag,
+ &ctx->Array.EdgeFlag,
+ flags, elts, (VERT_BIT_ELT|VERT_BIT_EDGEFLAG),
+ start, count);
+
for (i = start ; i < count ; i++)
- if (flags[i] & VERT_BIT_ELT) flags[i] |= translate;
+ if (flags[i] & VERT_BIT_ELT)
+ flags[i] |= translate;
IM->FlushElt = 0;
}