summaryrefslogtreecommitdiff
path: root/src/mesa/swrast/s_triangle.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2002-11-13 16:51:01 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2002-11-13 16:51:01 +0000
commitcdf2da368d180205df3573697b51b8764048ad6e (patch)
treefb8cdd07a95617ff37a7aec3981a00fe4e84c3a0 /src/mesa/swrast/s_triangle.c
parent36723b6538f1b9b59981cb6402a2dd807debee27 (diff)
moved function declaration into the template, define the NAME to specify the function names
Diffstat (limited to 'src/mesa/swrast/s_triangle.c')
-rw-r--r--src/mesa/swrast/s_triangle.c132
1 files changed, 29 insertions, 103 deletions
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index f96fbe1f2c..d1575cb691 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -1,8 +1,8 @@
-/* $Id: s_triangle.c,v 1.64 2002/10/30 20:16:44 brianp Exp $ */
+/* $Id: s_triangle.c,v 1.65 2002/11/13 16:51:01 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 5.0
+ * Version: 5.1
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -74,57 +74,37 @@ GLboolean _mesa_cull_triangle( GLcontext *ctx,
/*
* Render a flat-shaded color index triangle.
*/
-static void flat_ci_triangle( GLcontext *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2 )
-{
+#define NAME flat_ci_triangle
#define INTERP_Z 1
#define INTERP_FOG 1
-
-#define SETUP_CODE \
- span.interpMask |= SPAN_INDEX; \
- span.index = IntToFixed(v2->index); \
+#define SETUP_CODE \
+ span.interpMask |= SPAN_INDEX; \
+ span.index = IntToFixed(v2->index); \
span.indexStep = 0;
-
#define RENDER_SPAN( span ) _mesa_write_index_span(ctx, &span);
-
#include "s_tritemp.h"
-}
/*
* Render a smooth-shaded color index triangle.
*/
-static void smooth_ci_triangle( GLcontext *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2 )
-{
+#define NAME smooth_ci_triangle
#define INTERP_Z 1
#define INTERP_FOG 1
#define INTERP_INDEX 1
-
#define RENDER_SPAN( span ) _mesa_write_index_span(ctx, &span);
-
#include "s_tritemp.h"
-}
/*
* Render a flat-shaded RGBA triangle.
*/
-static void flat_rgba_triangle( GLcontext *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2 )
-{
+#define NAME flat_rgba_triangle
#define INTERP_Z 1
#define INTERP_FOG 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-
#define SETUP_CODE \
ASSERT(ctx->Texture._EnabledUnits == 0); \
ASSERT(ctx->Light.ShadeModel==GL_FLAT); \
@@ -137,41 +117,29 @@ static void flat_rgba_triangle( GLcontext *ctx,
span.greenStep = 0; \
span.blueStep = 0; \
span.alphaStep = 0;
-
#define RENDER_SPAN( span ) _mesa_write_rgba_span(ctx, &span);
-
#include "s_tritemp.h"
-}
/*
* Render a smooth-shaded RGBA triangle.
*/
-static void smooth_rgba_triangle( GLcontext *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2 )
-{
-
+#define NAME smooth_rgba_triangle
#define INTERP_Z 1
#define INTERP_FOG 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define INTERP_RGB 1
#define INTERP_ALPHA 1
-
#define SETUP_CODE \
{ \
/* texturing must be off */ \
ASSERT(ctx->Texture._EnabledUnits == 0); \
ASSERT(ctx->Light.ShadeModel==GL_SMOOTH); \
}
-
#define RENDER_SPAN( span ) _mesa_write_rgba_span(ctx, &span);
-
#include "s_tritemp.h"
-}
/*
@@ -180,11 +148,7 @@ static void smooth_rgba_triangle( GLcontext *ctx,
*
* No fog.
*/
-static void simple_textured_triangle( GLcontext *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2 )
-{
+#define NAME simple_textured_triangle
#define INTERP_INT_TEX 1
#define S_SCALE twidth
#define T_SCALE theight
@@ -222,9 +186,8 @@ static void simple_textured_triangle( GLcontext *ctx,
(*swrast->Driver.WriteRGBSpan)(ctx, span.end, span.x, span.y, \
(CONST GLchan (*)[3]) span.array->rgb,\
NULL );
-
#include "s_tritemp.h"
-}
+
/*
@@ -234,11 +197,7 @@ static void simple_textured_triangle( GLcontext *ctx,
*
* No fog.
*/
-static void simple_z_textured_triangle( GLcontext *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2 )
-{
+#define NAME simple_z_textured_triangle
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define INTERP_INT_TEX 1
@@ -287,9 +246,8 @@ static void simple_z_textured_triangle( GLcontext *ctx,
(*swrast->Driver.WriteRGBSpan)(ctx, span.end, span.x, span.y, \
(CONST GLchan (*)[3]) span.array->rgb,\
span.array->mask );
-
#include "s_tritemp.h"
-}
+
#if CHAN_TYPE != GL_FLOAT
@@ -568,11 +526,7 @@ affine_span(GLcontext *ctx, struct sw_span *span,
/*
* Render an RGB/RGBA textured triangle without perspective correction.
*/
-static void affine_textured_triangle( GLcontext *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2 )
-{
+#define NAME affine_textured_triangle
#define INTERP_Z 1
#define INTERP_FOG 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
@@ -635,8 +589,6 @@ static void affine_textured_triangle( GLcontext *ctx,
#include "s_tritemp.h"
-}
-
struct persp_info
@@ -846,11 +798,7 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span,
* by interpolated Q/W comes out right.
*
*/
-static void persp_textured_triangle( GLcontext *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2 )
-{
+#define NAME persp_textured_triangle
#define INTERP_Z 1
#define INTERP_FOG 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
@@ -911,8 +859,6 @@ static void persp_textured_triangle( GLcontext *ctx,
#include "s_tritemp.h"
-}
-
#endif /* CHAN_BITS != GL_FLOAT */
@@ -923,11 +869,7 @@ static void persp_textured_triangle( GLcontext *ctx,
* Render a smooth-shaded, textured, RGBA triangle.
* Interpolate S,T,R with perspective correction, w/out mipmapping.
*/
-static void general_textured_triangle( GLcontext *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2 )
-{
+#define NAME general_textured_triangle
#define INTERP_Z 1
#define INTERP_FOG 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
@@ -935,11 +877,8 @@ static void general_textured_triangle( GLcontext *ctx,
#define INTERP_SPEC 1
#define INTERP_ALPHA 1
#define INTERP_TEX 1
-
#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span);
-
#include "s_tritemp.h"
-}
@@ -948,13 +887,7 @@ static void general_textured_triangle( GLcontext *ctx,
* Interpolate Z, RGB, Alpha, specular, fog, and N sets of texture coordinates.
* Yup, it's slow.
*/
-static void
-multitextured_triangle( GLcontext *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2 )
-{
-
+#define NAME multitextured_triangle
#define INTERP_Z 1
#define INTERP_FOG 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
@@ -962,27 +895,19 @@ multitextured_triangle( GLcontext *ctx,
#define INTERP_ALPHA 1
#define INTERP_SPEC 1
#define INTERP_MULTITEX 1
-
#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span);
-
#include "s_tritemp.h"
-}
-
-static void occlusion_zless_triangle( GLcontext *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2 )
-{
- if (ctx->OcclusionResult) {
- return;
- }
+#define NAME occlusion_zless_triangle
#define DO_OCCLUSION_TEST
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-
+#define SETUP_CODE \
+ if (ctx->OcclusionResult) { \
+ return; \
+ }
#define RENDER_SPAN( span ) \
GLuint i; \
for (i = 0; i < span.end; i++) { \
@@ -993,14 +918,15 @@ static void occlusion_zless_triangle( GLcontext *ctx,
} \
span.z += span.zStep; \
}
-
#include "s_tritemp.h"
-}
-static void nodraw_triangle( GLcontext *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2 )
+
+
+static void
+nodraw_triangle( GLcontext *ctx,
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
(void) (ctx && v0 && v1 && v2);
}