From 9bf68ad963ba92b5d1e725f965979042495a5313 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 May 2001 16:23:04 +0000 Subject: New triangle rasterization code. Store per-span initial/step values in the new triangle_span struct. Much cleaner code and possibilities for future optimizations. --- src/mesa/drivers/osmesa/osmesa.c | 47 +++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'src/mesa/drivers/osmesa') diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 65ab67798cb..c046b18822f 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -1,4 +1,4 @@ -/* $Id: osmesa.c,v 1.54 2001/05/10 12:22:32 keithw Exp $ */ +/* $Id: osmesa.c,v 1.55 2001/05/14 16:23:04 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -55,6 +55,7 @@ #include "swrast/s_depth.h" #include "swrast/s_lines.h" #include "swrast/s_triangle.h" +#include "swrast/s_trispan.h" #include "tnl/tnl.h" #include "tnl/t_context.h" #include "tnl/t_pipeline.h" @@ -1600,21 +1601,24 @@ static void smooth_rgba_z_triangle( GLcontext *ctx, #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 -#define INNER_LOOP( LEFT, RIGHT, Y ) \ -{ \ - GLint i, len = RIGHT-LEFT; \ - GLchan *img = PIXELADDR4(LEFT, Y); \ - for (i = 0; i < len; i++, img += 4) { \ - GLdepth z = FixedToDepth(ffz); \ +#define RENDER_SPAN( span ) \ + GLuint i; \ + GLchan *img = PIXELADDR4(span.x, span.y); \ + for (i = 0; i < span.count; i++, img += 4) { \ + const GLdepth z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ - PACK_RGBA(img, FixedToInt(ffr), FixedToInt(ffg), \ - FixedToInt(ffb), FixedToInt(ffa)); \ + PACK_RGBA(img, FixedToInt(span.red), \ + FixedToInt(span.green), FixedToInt(span.blue), \ + FixedToInt(span.alpha)); \ zRow[i] = z; \ } \ - ffr += fdrdx; ffg += fdgdx; ffb += fdbdx; ffa += fdadx;\ - ffz += fdzdx; \ - } \ -} + span.red += span.redStep; \ + span.green += span.greenStep; \ + span.blue += span.blueStep; \ + span.alpha += span.alphaStep; \ + span.z += span.zStep; \ + } + #ifdef WIN32 #include "..\swrast\s_tritemp.h" #else @@ -1641,19 +1645,18 @@ static void flat_rgba_z_triangle( GLcontext *ctx, PACK_RGBA((GLchan *) &pixel, v0->color[0], v0->color[1], \ v0->color[2], v0->color[3]); -#define INNER_LOOP( LEFT, RIGHT, Y ) \ -{ \ - GLint i, len = RIGHT-LEFT; \ - GLuint *img = (GLuint *) PIXELADDR4(LEFT, Y); \ - for (i=0;i