diff options
author | Brian Paul <[email protected]> | 2003-03-31 23:08:59 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2003-03-31 23:08:59 +0000 |
commit | d78c57e8b545685e3e239b9259821dda229da5f8 (patch) | |
tree | 6693fdbe5a739d0cf391bfbee3beecd9a16b69df /src/mesa/tnl | |
parent | 6045b0501d8301a42a76962a1e78fd73bf3027b9 (diff) |
clean-ups, const qualifiers
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r-- | src/mesa/tnl/t_imm_elt.c | 116 |
1 files changed, 60 insertions, 56 deletions
diff --git a/src/mesa/tnl/t_imm_elt.c b/src/mesa/tnl/t_imm_elt.c index 7b3972af2a9..6ae30ea45b4 100644 --- a/src/mesa/tnl/t_imm_elt.c +++ b/src/mesa/tnl/t_imm_elt.c @@ -1,5 +1,3 @@ -/* $Id: t_imm_elt.c,v 1.22 2003/03/31 18:19:56 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 5.1 @@ -43,8 +41,8 @@ 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 ); @@ -52,8 +50,8 @@ typedef void (*trans_elt_1f_func)(GLfloat *to, 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 ); @@ -61,8 +59,8 @@ typedef void (*trans_elt_1ui_func)(GLuint *to, 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 ); @@ -70,8 +68,8 @@ typedef void (*trans_elt_1ub_func)(GLubyte *to, 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 ); @@ -79,8 +77,8 @@ typedef void (*trans_elt_4ub_func)(GLubyte (*to)[4], 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 ); @@ -88,8 +86,8 @@ typedef void (*trans_elt_4us_func)(GLushort (*to)[4], 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 ); @@ -97,8 +95,8 @@ typedef void (*trans_elt_4f_func)(GLfloat (*to)[4], 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 ); @@ -134,7 +132,7 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; * 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 @@ -600,8 +598,8 @@ void _tnl_imm_elt_init( void ) #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 ) @@ -620,8 +618,8 @@ static void _tnl_trans_elt_1f(GLfloat *to, 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 ) @@ -640,8 +638,8 @@ static void _tnl_trans_elt_1ui(GLuint *to, 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 ) @@ -661,8 +659,8 @@ static void _tnl_trans_elt_1ub(GLubyte *to, #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 ) @@ -682,8 +680,8 @@ static void _tnl_trans_elt_4ub(GLubyte (*to)[4], #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 ) @@ -702,8 +700,8 @@ static void _tnl_trans_elt_4us(GLushort (*to)[4], 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 ) @@ -724,8 +722,8 @@ static void _tnl_trans_elt_4f(GLfloat (*to)[4], #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 ) @@ -753,26 +751,19 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, 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)); @@ -784,18 +775,24 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, } + 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, @@ -816,12 +813,6 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, 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)) { @@ -837,8 +828,21 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, } } + 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; } |