summaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_array_api.c14
-rw-r--r--src/mesa/tnl/t_array_import.c48
-rw-r--r--src/mesa/tnl/t_context.h27
-rw-r--r--src/mesa/tnl/t_imm_elt.c57
-rw-r--r--src/mesa/tnl/t_imm_eval.c20
-rw-r--r--src/mesa/tnl/t_imm_exec.c14
-rw-r--r--src/mesa/tnl/t_vb_light.c54
7 files changed, 60 insertions, 174 deletions
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 );