diff options
author | Keith Whitwell <[email protected]> | 2001-02-20 18:28:52 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2001-02-20 18:28:52 +0000 |
commit | 4eebc90a174722422daea6352d4e980bc81b4bb2 (patch) | |
tree | fd3f4bedaaf568c17d99cd9e028622ffd505a329 /src | |
parent | 8bbc71f2eb6a3d7acce6bc1a66a4caea54d3fc8d (diff) |
Added GLvector4chan type, removed lots of CHAN_TYPE ifdefs.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/array_cache/ac_import.c | 66 | ||||
-rw-r--r-- | src/mesa/math/m_translate.c | 20 | ||||
-rw-r--r-- | src/mesa/math/m_translate.h | 11 | ||||
-rw-r--r-- | src/mesa/math/m_vector.c | 33 | ||||
-rw-r--r-- | src/mesa/math/m_vector.h | 22 | ||||
-rw-r--r-- | src/mesa/tnl/t_array_api.c | 14 | ||||
-rw-r--r-- | src/mesa/tnl/t_array_import.c | 48 | ||||
-rw-r--r-- | src/mesa/tnl/t_context.h | 27 | ||||
-rw-r--r-- | src/mesa/tnl/t_imm_elt.c | 57 | ||||
-rw-r--r-- | src/mesa/tnl/t_imm_eval.c | 20 | ||||
-rw-r--r-- | src/mesa/tnl/t_imm_exec.c | 14 | ||||
-rw-r--r-- | src/mesa/tnl/t_vb_light.c | 54 |
12 files changed, 157 insertions, 229 deletions
diff --git a/src/mesa/array_cache/ac_import.c b/src/mesa/array_cache/ac_import.c index ad39f6b511b..293f475b15a 100644 --- a/src/mesa/array_cache/ac_import.c +++ b/src/mesa/array_cache/ac_import.c @@ -1,4 +1,4 @@ -/* $Id: ac_import.c,v 1.6 2001/02/07 16:00:58 keithw Exp $ */ +/* $Id: ac_import.c,v 1.7 2001/02/20 18:28:52 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -270,31 +270,13 @@ static void import_color( GLcontext *ctx, ASSERT(type == CHAN_TYPE); ASSERT(stride == 4 * sizeof(GLchan) || stride == 0); -#if CHAN_TYPE == GL_UNSIGNED_BYTE - _math_trans_4ub( to->Ptr, - from->Ptr, - from->StrideB, - from->Type, - from->Size, - 0, - ac->count - ac->start); -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - _math_trans_4us( to->Ptr, - from->Ptr, - from->StrideB, - from->Type, - from->Size, - 0, - ac->count - ac->start); -#elif CHAN_TYPE == GL_FLOAT - _math_trans_4f( to->Ptr, - from->Ptr, - from->StrideB, - from->Type, - from->Size, - 0, - ac->count - ac->start); -#endif + _math_trans_4chan( to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + from->Size, + 0, + ac->count - ac->start); to->Size = from->Size; to->StrideB = 4 * sizeof(GLchan); @@ -338,31 +320,13 @@ static void import_secondarycolor( GLcontext *ctx, ASSERT(type == CHAN_TYPE); ASSERT(stride == 4 * sizeof(GLchan) || stride == 0); -#if CHAN_TYPE == GL_UNSIGNED_BYTE - _math_trans_4ub( to->Ptr, - from->Ptr, - from->StrideB, - from->Type, - from->Size, - 0, - ac->count - ac->start); -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - _math_trans_4us( to->Ptr, - from->Ptr, - from->StrideB, - from->Type, - from->Size, - 0, - ac->count - ac->start); -#elif CHAN_TYPE == GL_FLOAT - _math_trans_4f( to->Ptr, - from->Ptr, - from->StrideB, - from->Type, - from->Size, - 0, - ac->count - ac->start); -#endif + _math_trans_4chan( to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + from->Size, + 0, + ac->count - ac->start); to->StrideB = 4 * sizeof(GLchan); to->Type = CHAN_TYPE; diff --git a/src/mesa/math/m_translate.c b/src/mesa/math/m_translate.c index 0eb2ee8281f..967f6a54cf5 100644 --- a/src/mesa/math/m_translate.c +++ b/src/mesa/math/m_translate.c @@ -1,4 +1,4 @@ -/* $Id: m_translate.c,v 1.4 2001/01/24 00:04:59 brianp Exp $ */ +/* $Id: m_translate.c,v 1.5 2001/02/20 18:28:52 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -30,6 +30,7 @@ #include "glheader.h" +#include "mtypes.h" /* GLchan hack */ #include "colormac.h" #include "mem.h" #include "mmath.h" @@ -603,6 +604,23 @@ void _math_trans_4ub(GLubyte (*to)[4], _math_trans_4ub_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); } +void _math_trans_4chan( GLchan (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ) +{ +#if CHAN_TYPE == GL_UNSIGNED_BYTE + _math_trans_4ub( to, ptr, stride, type, size, start, n ); +#elif CHAN_TYPE == GL_UNSIGNED_SHORT + _math_trans_4us( to, ptr, stride, type, size, start, n ); +#elif CHAN_TYPE == GL_FLOAT + _math_trans_4f( to, ptr, stride, type, size, start, n ); +#endif +} + void _math_trans_4us(GLushort (*to)[4], CONST void *ptr, GLuint stride, diff --git a/src/mesa/math/m_translate.h b/src/mesa/math/m_translate.h index 3151e458176..55ac887e241 100644 --- a/src/mesa/math/m_translate.h +++ b/src/mesa/math/m_translate.h @@ -1,4 +1,4 @@ -/* $Id: m_translate.h,v 1.4 2001/01/24 00:04:59 brianp Exp $ */ +/* $Id: m_translate.h,v 1.5 2001/02/20 18:28:52 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -29,6 +29,7 @@ #define _M_TRANSLATE_H_ #include "config.h" +#include "mtypes.h" /* hack for GLchan */ @@ -61,6 +62,14 @@ extern void _math_trans_4ub(GLubyte (*to)[4], GLuint start, GLuint n ); +extern void _math_trans_4chan( GLchan (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ); + extern void _math_trans_4us(GLushort (*to)[4], CONST void *ptr, GLuint stride, diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c index 7fa2b726e4e..02a558ac380 100644 --- a/src/mesa/math/m_vector.c +++ b/src/mesa/math/m_vector.c @@ -1,4 +1,4 @@ -/* $Id: m_vector.c,v 1.3 2001/01/24 00:04:59 brianp Exp $ */ +/* $Id: m_vector.c,v 1.4 2001/02/20 18:28:52 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -115,6 +115,15 @@ void gl_vector4ub_init( GLvector4ub *v, GLuint flags, GLubyte (*storage)[4] ) v->flags = flags ; } +void gl_vector4chan_init( GLvector4chan *v, GLuint flags, GLchan (*storage)[4] ) +{ + v->stride = 4 * sizeof(GLchan); + v->data = storage; + v->start = (GLchan *) storage; + v->count = 0; + v->flags = flags ; +} + void gl_vector4us_init( GLvector4us *v, GLuint flags, GLushort (*storage)[4] ) { v->stride = 4 * sizeof(GLushort); @@ -198,6 +207,17 @@ void gl_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count, v->flags = flags | VEC_MALLOC ; } +void gl_vector4chan_alloc( GLvector4chan *v, GLuint flags, GLuint count, + GLuint alignment ) +{ + v->stride = 4 * sizeof(GLchan); + v->storage = ALIGN_MALLOC( count * 4 * sizeof(GLchan), alignment ); + v->start = (GLchan *) v->storage; + v->data = (GLchan (*)[4]) v->storage; + v->count = 0; + v->flags = flags | VEC_MALLOC ; +} + void gl_vector4us_alloc( GLvector4us *v, GLuint flags, GLuint count, GLuint alignment ) { @@ -284,6 +304,17 @@ void gl_vector4ub_free( GLvector4ub *v ) } } +void gl_vector4chan_free( GLvector4chan *v ) +{ + if (v->flags & VEC_MALLOC) { + ALIGN_FREE( v->storage ); + v->data = NULL; + v->start = NULL; + v->storage = NULL; + v->flags &= ~VEC_MALLOC; + } +} + void gl_vector4us_free( GLvector4us *v ) { if (v->flags & VEC_MALLOC) { diff --git a/src/mesa/math/m_vector.h b/src/mesa/math/m_vector.h index 12200f960c4..fc51b2006c9 100644 --- a/src/mesa/math/m_vector.h +++ b/src/mesa/math/m_vector.h @@ -1,4 +1,4 @@ -/* $Id: m_vector.h,v 1.3 2001/01/24 00:04:59 brianp Exp $ */ +/* $Id: m_vector.h,v 1.4 2001/02/20 18:28:52 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -33,6 +33,7 @@ #define _M_VECTOR_H_ #include "glheader.h" +#include "mtypes.h" /* hack for GLchan */ #define VEC_DIRTY_0 0x1 @@ -132,6 +133,25 @@ extern void gl_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count, extern void gl_vector4ub_free( GLvector4ub * ); +/* For 4 * GLchan values. + */ +typedef struct { + GLchan (*data)[4]; + GLchan *start; + GLuint count; + GLuint stride; + GLuint flags; + void *storage; +} GLvector4chan; + +extern void gl_vector4chan_init( GLvector4chan *v, GLuint flags, + GLchan (*storage)[4] ); +extern void gl_vector4chan_alloc( GLvector4chan *v, GLuint flags, GLuint count, + GLuint alignment ); +extern void gl_vector4chan_free( GLvector4chan * ); + + + /* For 4 * GLushort rgba values. */ diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c index 900467c98d0..9a90a2e6965 100644 --- a/src/mesa/tnl/t_array_api.c +++ b/src/mesa/tnl/t_array_api.c @@ -1,4 +1,4 @@ -/* $Id: t_array_api.c,v 1.6 2001/02/15 01:33:52 keithw Exp $ */ +/* $Id: t_array_api.c,v 1.7 2001/02/20 18:28:52 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -354,16 +354,8 @@ void _tnl_array_init( GLcontext *ctx ) */ gl_vector4f_init( &tmp->Obj, 0, 0 ); gl_vector3f_init( &tmp->Normal, 0, 0 ); -#if CHAN_TYPE == GL_UNSIGNED_BYTE - gl_vector4ub_init( &tmp->Color, 0, 0 ); - gl_vector4ub_init( &tmp->SecondaryColor, 0, 0 ); -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - gl_vector4us_init( &tmp->Color, 0, 0 ); - gl_vector4us_init( &tmp->SecondaryColor, 0, 0 ); -#elif CHAN_TYPE == GL_FLOAT - gl_vector4f_init( &tmp->Color, 0, 0 ); - gl_vector4f_init( &tmp->SecondaryColor, 0, 0 ); -#endif + gl_vector4chan_init( &tmp->Color, 0, 0 ); + gl_vector4chan_init( &tmp->SecondaryColor, 0, 0 ); gl_vector1f_init( &tmp->FogCoord, 0, 0 ); gl_vector1ui_init( &tmp->Index, 0, 0 ); gl_vector1ub_init( &tmp->EdgeFlag, 0, 0 ); diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c index 6aec1b0be6a..e3d2b3c94ac 100644 --- a/src/mesa/tnl/t_array_import.c +++ b/src/mesa/tnl/t_array_import.c @@ -1,4 +1,4 @@ -/* $Id: t_array_import.c,v 1.8 2001/02/15 01:33:52 keithw Exp $ */ +/* $Id: t_array_import.c,v 1.9 2001/02/20 18:28:52 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -467,53 +467,21 @@ void _tnl_fill_immediate_drawarrays( GLcontext *ctx, struct immediate *IM, } if (required & VERT_RGBA) { -#if CHAN_TYPE == GL_UNSIGNED_BYTE - _math_trans_4ub( IM->Color + IM->Start, + _math_trans_4chan( IM->Color + IM->Start, ctx->Array.Color.Ptr, ctx->Array.Color.StrideB, ctx->Array.Color.Type, ctx->Array.Color.Size, start, n ); -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - _math_trans_4us( IM->Color + IM->Start, - ctx->Array.Color.Ptr, - ctx->Array.Color.StrideB, - ctx->Array.Color.Type, - ctx->Array.Color.Size, - start, n ); -#elif CHAN_TYPE == GL_FLOAT - _math_trans_4f( IM->Color + IM->Start, - ctx->Array.Color.Ptr, - ctx->Array.Color.StrideB, - ctx->Array.Color.Type, - ctx->Array.Color.Size, - start, n ); -#endif } if (required & VERT_SPEC_RGB) { -#if CHAN_TYPE == GL_UNSIGNED_BYTE - _math_trans_4ub( IM->SecondaryColor + IM->Start, - ctx->Array.SecondaryColor.Ptr, - ctx->Array.SecondaryColor.StrideB, - ctx->Array.SecondaryColor.Type, - ctx->Array.SecondaryColor.Size, - start, n ); -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - _math_trans_4us( IM->SecondaryColor + IM->Start, - ctx->Array.SecondaryColor.Ptr, - ctx->Array.SecondaryColor.StrideB, - ctx->Array.SecondaryColor.Type, - ctx->Array.SecondaryColor.Size, - start, n ); -#elif CHAN_TYPE == GL_FLOAT - _math_trans_4f( IM->SecondaryColor + IM->Start, - ctx->Array.SecondaryColor.Ptr, - ctx->Array.SecondaryColor.StrideB, - ctx->Array.SecondaryColor.Type, - ctx->Array.SecondaryColor.Size, - start, n ); -#endif + _math_trans_4chan( IM->SecondaryColor + IM->Start, + ctx->Array.SecondaryColor.Ptr, + ctx->Array.SecondaryColor.StrideB, + ctx->Array.SecondaryColor.Type, + ctx->Array.SecondaryColor.Size, + start, n ); } if (required & VERT_FOG_COORD) { diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index a1707673422..e15cef3e28b 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -1,4 +1,4 @@ -/* $Id: t_context.h,v 1.14 2001/02/15 01:33:52 keithw Exp $ */ +/* $Id: t_context.h,v 1.15 2001/02/20 18:28:52 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -216,16 +216,8 @@ struct vertex_arrays { GLvector4f Obj; GLvector3f Normal; -#if CHAN_TYPE == GL_UNSIGNED_BYTE - GLvector4ub Color; - GLvector4ub SecondaryColor; -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - GLvector4us Color; - GLvector4us SecondaryColor; -#elif CHAN_TYPE == GL_FLOAT - GLvector4f Color; - GLvector4f SecondaryColor; -#endif + GLvector4chan Color; + GLvector4chan SecondaryColor; GLvector1ui Index; GLvector1ub EdgeFlag; GLvector4f TexCoord[MAX_TEXTURE_UNITS]; @@ -263,17 +255,8 @@ typedef struct vertex_buffer GLboolean *EdgeFlag; /* VERT_EDGE */ GLvector4f *TexCoordPtr[MAX_TEXTURE_UNITS]; /* VERT_TEX_0..n */ GLvector1ui *IndexPtr[2]; /* VERT_INDEX */ - -#if CHAN_TYPE == GL_UNSIGNED_BYTE - GLvector4ub *ColorPtr[2]; /* VERT_RGBA */ - GLvector4ub *SecondaryColorPtr[2]; /* VERT_SPEC_RGB */ -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - GLvector4us *ColorPtr[2]; /* VERT_RGBA */ - GLvector4us *SecondaryColorPtr[2]; /* VERT_SPEC_RGB */ -#elif CHAN_TYPE == GL_FLOAT - GLvector4f *ColorPtr[2]; /* VERT_RGBA */ - GLvector4f *SecondaryColorPtr[2]; /* VERT_SPEC_RGB */ -#endif + GLvector4chan *ColorPtr[2]; /* VERT_RGBA */ + GLvector4chan *SecondaryColorPtr[2]; /* VERT_SPEC_RGB */ GLvector1f *FogCoordPtr; /* VERT_FOG_COORD */ GLvector1f *PointSizePtr; /* VERT_POINT_SIZE */ GLmaterial (*Material)[2]; /* VERT_MATERIAL, optional */ diff --git a/src/mesa/tnl/t_imm_elt.c b/src/mesa/tnl/t_imm_elt.c index 83a76294b6c..497790d8887 100644 --- a/src/mesa/tnl/t_imm_elt.c +++ b/src/mesa/tnl/t_imm_elt.c @@ -1,4 +1,4 @@ -/* $Id: t_imm_elt.c,v 1.3 2001/01/24 00:04:59 brianp Exp $ */ +/* $Id: t_imm_elt.c,v 1.4 2001/02/20 18:28:52 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -705,6 +705,27 @@ static void _tnl_trans_elt_4f(GLfloat (*to)[4], } +static void _tnl_trans_elt_4chan(GLubyte (*to)[4], + const struct gl_client_array *from, + GLuint *flags, + GLuint *elts, + GLuint match, + GLuint start, + GLuint n ) +{ +#if CHAN_TYPE == GL_UNSIGNED_BYTE + _tnl_trans_elt_4ub( to, from, flags, elts, match, start, n ); + (void)_tnl_trans_elt_4us; +#elif CHAN_TYPE == GL_UNSIGNED_SHORT + _tnl_trans_elt_4us( to, from, flags, elts, match, start, n ); +#elif CHAN_TYPE == GL_FLOAT + _tnl_trans_elt_4f( to, from, flags, elts, match, start, n ); + (void)_tnl_trans_elt_4us; +#endif +} + + + static void _tnl_trans_elt_3f(GLfloat (*to)[3], const struct gl_client_array *from, GLuint *flags, @@ -769,41 +790,17 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, start, count); if (translate & VERT_RGBA) { -#if CHAN_TYPE == GL_UNSIGNED_BYTE - _tnl_trans_elt_4ub( IM->Color, + _tnl_trans_elt_4chan( IM->Color, &ctx->Array.Color, flags, elts, (VERT_ELT|VERT_RGBA), start, count); -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - _tnl_trans_elt_4us( IM->Color, - &ctx->Array.Color, - flags, elts, (VERT_ELT|VERT_RGBA), - start, count); -#elif CHAN_TYPE == GL_FLOAT - _tnl_trans_elt_4f( IM->Color, - &ctx->Array.Color, - flags, elts, (VERT_ELT|VERT_RGBA), - start, count); -#endif } if (translate & VERT_SPEC_RGB) { -#if CHAN_TYPE == GL_UNSIGNED_BYTE - _tnl_trans_elt_4ub( IM->SecondaryColor, - &ctx->Array.SecondaryColor, - flags, elts, (VERT_ELT|VERT_SPEC_RGB), - start, count); -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - _tnl_trans_elt_4us( IM->SecondaryColor, - &ctx->Array.SecondaryColor, - flags, elts, (VERT_ELT|VERT_SPEC_RGB), - start, count); -#elif CHAN_TYPE == GL_FLOAT - _tnl_trans_elt_4f( IM->SecondaryColor, - &ctx->Array.SecondaryColor, - flags, elts, (VERT_ELT|VERT_SPEC_RGB), - start, count); -#endif + _tnl_trans_elt_4chan( IM->SecondaryColor, + &ctx->Array.SecondaryColor, + flags, elts, (VERT_ELT|VERT_SPEC_RGB), + start, count); } if (translate & VERT_FOG_COORD) diff --git a/src/mesa/tnl/t_imm_eval.c b/src/mesa/tnl/t_imm_eval.c index a7c5b7db039..1207a9ab158 100644 --- a/src/mesa/tnl/t_imm_eval.c +++ b/src/mesa/tnl/t_imm_eval.c @@ -1,4 +1,4 @@ -/* $Id: t_imm_eval.c,v 1.4 2001/01/24 00:04:59 brianp Exp $ */ +/* $Id: t_imm_eval.c,v 1.5 2001/02/20 18:28:52 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -144,14 +144,7 @@ static void eval1_norm( GLvector3f *dest, } } -static void eval1_color( -#if CHAN_TYPE == GL_UNSIGNED_BYTE - GLvector4ub *dest, -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - GLvector4us *dest, -#elif CHAN_TYPE == GL_FLOAT - GLvector4f *dest, -#endif +static void eval1_color( GLvector4chan *dest, GLfloat coord[][4], const GLuint *flags, struct gl_1d_map *map ) @@ -283,14 +276,7 @@ static void eval2_1ui( GLvector1ui *dest, -static void eval2_color( -#if CHAN_TYPE == GL_UNSIGNED_BYTE - GLvector4ub *dest, -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - GLvector4us *dest, -#elif CHAN_TYPE == GL_FLOAT - GLvector4f *dest, -#endif +static void eval2_color( GLvector4chan *dest, GLfloat coord[][4], GLuint *flags, struct gl_2d_map *map ) diff --git a/src/mesa/tnl/t_imm_exec.c b/src/mesa/tnl/t_imm_exec.c index ce64c16b31a..2e54123fa3e 100644 --- a/src/mesa/tnl/t_imm_exec.c +++ b/src/mesa/tnl/t_imm_exec.c @@ -1,4 +1,4 @@ -/* $Id: t_imm_exec.c,v 1.12 2001/02/16 00:35:35 keithw Exp $ */ +/* $Id: t_imm_exec.c,v 1.13 2001/02/20 18:28:52 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -472,16 +472,8 @@ void _tnl_imm_init( GLcontext *ctx ) gl_vector4f_init( &tmp->Obj, 0, 0 ); gl_vector3f_init( &tmp->Normal, 0, 0 ); -#if CHAN_TYPE == GL_UNSIGNED_BYTE - gl_vector4ub_init( &tmp->Color, 0, 0 ); - gl_vector4ub_init( &tmp->SecondaryColor, 0, 0 ); -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - gl_vector4us_init( &tmp->Color, 0, 0 ); - gl_vector4us_init( &tmp->SecondaryColor, 0, 0 ); -#elif CHAN_TYPE == GL_FLOAT - gl_vector4f_init( &tmp->Color, 0, 0 ); - gl_vector4f_init( &tmp->SecondaryColor, 0, 0 ); -#endif + gl_vector4chan_init( &tmp->Color, 0, 0 ); + gl_vector4chan_init( &tmp->SecondaryColor, 0, 0 ); gl_vector1f_init( &tmp->FogCoord, 0, 0 ); gl_vector1ui_init( &tmp->Index, 0, 0 ); gl_vector1ub_init( &tmp->EdgeFlag, 0, 0 ); diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c index ce180880fb0..53f23ec4e10 100644 --- a/src/mesa/tnl/t_vb_light.c +++ b/src/mesa/tnl/t_vb_light.c @@ -1,4 +1,4 @@ -/* $Id: t_vb_light.c,v 1.8 2001/02/16 18:14:42 keithw Exp $ */ +/* $Id: t_vb_light.c,v 1.9 2001/02/20 18:28:52 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -49,16 +49,8 @@ typedef void (*light_func)( GLcontext *ctx, GLvector4f *input ); struct light_stage_data { -#if CHAN_TYPE == GL_UNSIGNED_BYTE - GLvector4ub LitColor[2]; - GLvector4ub LitSecondary[2]; -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - GLvector4us LitColor[2]; - GLvector4us LitSecondary[2]; -#elif CHAN_TYPE == GL_FLOAT - GLvector4f LitColor[2]; - GLvector4f LitSecondary[2]; -#endif + GLvector4chan LitColor[2]; + GLvector4chan LitSecondary[2]; GLvector1ui LitIndex[2]; light_func *light_func_tab; }; @@ -226,22 +218,10 @@ static GLboolean run_init_lighting( GLcontext *ctx, */ init_lighting(); -#if CHAN_TYPE == GL_UNSIGNED_BYTE - gl_vector4ub_alloc( &store->LitColor[0], 0, size, 32 ); - gl_vector4ub_alloc( &store->LitColor[1], 0, size, 32 ); - gl_vector4ub_alloc( &store->LitSecondary[0], 0, size, 32 ); - gl_vector4ub_alloc( &store->LitSecondary[1], 0, size, 32 ); -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - gl_vector4us_alloc( &store->LitColor[0], 0, size, 32 ); - gl_vector4us_alloc( &store->LitColor[1], 0, size, 32 ); - gl_vector4us_alloc( &store->LitSecondary[0], 0, size, 32 ); - gl_vector4us_alloc( &store->LitSecondary[1], 0, size, 32 ); -#elif CHAN_TYPE == GL_FLOAT - gl_vector4f_alloc( &store->LitColor[0], 0, size, 32 ); - gl_vector4f_alloc( &store->LitColor[1], 0, size, 32 ); - gl_vector4f_alloc( &store->LitSecondary[0], 0, size, 32 ); - gl_vector4f_alloc( &store->LitSecondary[1], 0, size, 32 ); -#endif + gl_vector4chan_alloc( &store->LitColor[0], 0, size, 32 ); + gl_vector4chan_alloc( &store->LitColor[1], 0, size, 32 ); + gl_vector4chan_alloc( &store->LitSecondary[0], 0, size, 32 ); + gl_vector4chan_alloc( &store->LitSecondary[1], 0, size, 32 ); gl_vector1ui_alloc( &store->LitIndex[0], 0, size, 32 ); gl_vector1ui_alloc( &store->LitIndex[1], 0, size, 32 ); @@ -281,22 +261,10 @@ static void dtr( struct gl_pipeline_stage *stage ) struct light_stage_data *store = LIGHT_STAGE_DATA(stage); if (store) { -#if CHAN_TYPE == GL_UNSIGNED_BYTE - gl_vector4ub_free( &store->LitColor[0] ); - gl_vector4ub_free( &store->LitColor[1] ); - gl_vector4ub_free( &store->LitSecondary[0] ); - gl_vector4ub_free( &store->LitSecondary[1] ); -#elif CHAN_TYPE == GL_UNSIGNED_SHORT - gl_vector4us_free( &store->LitColor[0] ); - gl_vector4us_free( &store->LitColor[1] ); - gl_vector4us_free( &store->LitSecondary[0] ); - gl_vector4us_free( &store->LitSecondary[1] ); -#elif CHAN_TYPE == GL_FLOAT - gl_vector4f_free( &store->LitColor[0] ); - gl_vector4f_free( &store->LitColor[1] ); - gl_vector4f_free( &store->LitSecondary[0] ); - gl_vector4f_free( &store->LitSecondary[1] ); -#endif + gl_vector4chan_free( &store->LitColor[0] ); + gl_vector4chan_free( &store->LitColor[1] ); + gl_vector4chan_free( &store->LitSecondary[0] ); + gl_vector4chan_free( &store->LitSecondary[1] ); gl_vector1ui_free( &store->LitIndex[0] ); gl_vector1ui_free( &store->LitIndex[1] ); FREE( store ); |