aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2002-02-02 21:40:33 +0000
committerBrian Paul <[email protected]>2002-02-02 21:40:33 +0000
commitb37a084357dd08573b86d6d8c5ba43d65bdc1bd7 (patch)
treee9b71cecbc7500a5c6144c79cda6ac2a7a7e3558 /src/mesa
parent733a4b602bbbfda83ee03b7ae4f3737bbe659034 (diff)
Converted line drawing over to new span code, pb no longer used.
Big clean-up of line drawing code. Removed many obsolete span processing functions.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/swrast/s_aalinetemp.h6
-rw-r--r--src/mesa/swrast/s_alpha.c63
-rw-r--r--src/mesa/swrast/s_alpha.h11
-rw-r--r--src/mesa/swrast/s_blend.c31
-rw-r--r--src/mesa/swrast/s_blend.h11
-rw-r--r--src/mesa/swrast/s_context.c18
-rw-r--r--src/mesa/swrast/s_context.h3
-rw-r--r--src/mesa/swrast/s_depth.c11
-rw-r--r--src/mesa/swrast/s_fog.c99
-rw-r--r--src/mesa/swrast/s_fog.h16
-rw-r--r--src/mesa/swrast/s_lines.c1179
-rw-r--r--src/mesa/swrast/s_linetemp.h82
-rw-r--r--src/mesa/swrast/s_logic.c47
-rw-r--r--src/mesa/swrast/s_logic.h14
-rw-r--r--src/mesa/swrast/s_masking.c81
-rw-r--r--src/mesa/swrast/s_masking.h27
-rw-r--r--src/mesa/swrast/s_points.h6
-rw-r--r--src/mesa/swrast/s_span.c68
-rw-r--r--src/mesa/swrast/s_stencil.c37
-rw-r--r--src/mesa/swrast/s_stencil.h7
-rw-r--r--src/mesa/swrast/s_texture.c9
21 files changed, 585 insertions, 1241 deletions
diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h
index a473250eab3..117434c8441 100644
--- a/src/mesa/swrast/s_aalinetemp.h
+++ b/src/mesa/swrast/s_aalinetemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_aalinetemp.h,v 1.16 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_aalinetemp.h,v 1.17 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -100,7 +100,7 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
#endif
if (line->span.end == MAX_WIDTH) {
-#ifdef DO_TEX
+#if defined(DO_TEX) || defined(DO_MULTITEX)
_mesa_write_texture_span(ctx, &line->span, GL_LINE);
#elif defined(DO_RGBA)
_mesa_write_rgba_span(ctx, &line->span, GL_LINE);
@@ -293,7 +293,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
segment(ctx, &line, NAME(plot), 0.0, 1.0);
}
-#ifdef DO_TEX
+#if defined(DO_TEX) || defined(DO_MULTITEX)
_mesa_write_texture_span(ctx, &line.span, GL_LINE);
#elif defined(DO_RGBA)
_mesa_write_rgba_span(ctx, &line.span, GL_LINE);
diff --git a/src/mesa/swrast/s_alpha.c b/src/mesa/swrast/s_alpha.c
index d44bdb63eb9..914b699cead 100644
--- a/src/mesa/swrast/s_alpha.c
+++ b/src/mesa/swrast/s_alpha.c
@@ -1,4 +1,4 @@
-/* $Id: s_alpha.c,v 1.8 2002/01/31 00:27:43 brianp Exp $ */
+/* $Id: s_alpha.c,v 1.9 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -218,64 +218,3 @@ _mesa_alpha_test( const GLcontext *ctx, struct sw_span *span )
else
return 1;
}
-
-
-/*
- * Apply the alpha test to a span of pixels.
- * In: rgba - array of pixels
- * In/Out: mask - current pixel mask. Pixels which fail the alpha test
- * will set the corresponding mask flag to 0.
- * Return: 0 = all pixels in the span failed the alpha test.
- * 1 = one or more pixels passed the alpha test.
- */
-GLint
-_old_alpha_test( const GLcontext *ctx,
- GLuint n, CONST GLchan rgba[][4], GLubyte mask[] )
-{
- GLuint i;
- const GLchan ref = ctx->Color.AlphaRef;
-
- /* switch cases ordered from most frequent to less frequent */
- switch (ctx->Color.AlphaFunc) {
- case GL_LESS:
- for (i=0;i<n;i++) {
- mask[i] &= (rgba[i][ACOMP] < ref);
- }
- return 1;
- case GL_LEQUAL:
- for (i=0;i<n;i++)
- mask[i] &= (rgba[i][ACOMP] <= ref);
- return 1;
- case GL_GEQUAL:
- for (i=0;i<n;i++) {
- mask[i] &= (rgba[i][ACOMP] >= ref);
- }
- return 1;
- case GL_GREATER:
- for (i=0;i<n;i++) {
- mask[i] &= (rgba[i][ACOMP] > ref);
- }
- return 1;
- case GL_NOTEQUAL:
- for (i=0;i<n;i++) {
- mask[i] &= (rgba[i][ACOMP] != ref);
- }
- return 1;
- case GL_EQUAL:
- for (i=0;i<n;i++) {
- mask[i] &= (rgba[i][ACOMP] == ref);
- }
- return 1;
- case GL_ALWAYS:
- /* do nothing */
- return 1;
- case GL_NEVER:
- /* caller should check for zero! */
- return 0;
- default:
- _mesa_problem( ctx, "Invalid alpha test in gl_alpha_test" );
- return 0;
- }
- /* Never get here */
- /*return 1;*/
-}
diff --git a/src/mesa/swrast/s_alpha.h b/src/mesa/swrast/s_alpha.h
index 29eae7dca34..784307b5b24 100644
--- a/src/mesa/swrast/s_alpha.h
+++ b/src/mesa/swrast/s_alpha.h
@@ -1,4 +1,4 @@
-/* $Id: s_alpha.h,v 1.5 2002/01/31 00:27:43 brianp Exp $ */
+/* $Id: s_alpha.h,v 1.6 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -34,14 +34,7 @@
extern GLint
-_old_alpha_test( const GLcontext *ctx, GLuint n,
- CONST GLchan rgba[][4], GLubyte mask[] );
-
-extern GLint
_mesa_alpha_test( const GLcontext *ctx, struct sw_span *span );
-#endif
-
-
-
+#endif
diff --git a/src/mesa/swrast/s_blend.c b/src/mesa/swrast/s_blend.c
index 8541b9a0ef8..c1f207d32b8 100644
--- a/src/mesa/swrast/s_blend.c
+++ b/src/mesa/swrast/s_blend.c
@@ -1,4 +1,4 @@
-/* $Id: s_blend.c,v 1.11 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_blend.c,v 1.12 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -33,7 +33,6 @@
#include "s_alphabuf.h"
#include "s_blend.h"
#include "s_context.h"
-#include "s_pb.h"
#include "s_span.h"
@@ -702,31 +701,3 @@ _mesa_blend_span( GLcontext *ctx, const struct sw_span *span,
SWRAST_CONTEXT(ctx)->BlendFunc( ctx, span->end, span->mask, rgba,
(const GLchan (*)[4]) framebuffer );
}
-
-
-
-/*
- * Apply the blending operator to an array of pixels.
- * Input: n - number of pixels in span
- * x, y - array of pixel locations
- * mask - boolean mask indicating which pixels to blend.
- * In/Out: rgba - pixel values
- */
-void
-_mesa_blend_pixels( GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLchan rgba[][4], const GLubyte mask[] )
-{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
- GLchan dest[PB_SIZE][4];
-
- ASSERT(!ctx->Color.ColorLogicOpEnabled);
-
- /* Read pixels from current color buffer */
- (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
- if (swrast->_RasterMask & ALPHABUF_BIT) {
- _mesa_read_alpha_pixels( ctx, n, x, y, dest, mask );
- }
-
- swrast->BlendFunc( ctx, n, mask, rgba, (const GLchan (*)[4])dest );
-}
diff --git a/src/mesa/swrast/s_blend.h b/src/mesa/swrast/s_blend.h
index b431647b1dd..090547d18b2 100644
--- a/src/mesa/swrast/s_blend.h
+++ b/src/mesa/swrast/s_blend.h
@@ -1,10 +1,10 @@
-/* $Id: s_blend.h,v 1.5 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_blend.h,v 1.6 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -40,11 +40,6 @@ _mesa_blend_span( GLcontext *ctx, const struct sw_span *span,
extern void
-_mesa_blend_pixels( GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLchan rgba[][4], const GLubyte mask[] );
-
-extern void
_swrast_choose_blend_func( GLcontext *ctx );
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index b9b7a87f977..e10f8a3bb3d 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -1,4 +1,4 @@
-/* $Id: s_context.c,v 1.28 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_context.c,v 1.29 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,7 +31,7 @@
#include "mtypes.h"
#include "mem.h"
-#include "s_pb.h"
+#include "swrast.h"
#include "s_points.h"
#include "s_lines.h"
#include "s_triangle.h"
@@ -467,12 +467,6 @@ _swrast_CreateContext( GLcontext *ctx )
if (!swrast)
return GL_FALSE;
- swrast->PB = _mesa_alloc_pb();
- if (!swrast->PB) {
- FREE(swrast);
- return GL_FALSE;
- }
-
swrast->NewState = ~0;
swrast->choose_point = _swrast_choose_point;
@@ -513,7 +507,6 @@ _swrast_DestroyContext( GLcontext *ctx )
fprintf(stderr, "_swrast_DestroyContext\n");
}
- FREE( swrast->PB );
FREE( swrast );
ctx->swrast_context = 0;
@@ -561,3 +554,10 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v )
fprintf(stderr, "\n");
}
}
+
+
+void
+_swrast_flush( GLcontext *ctx )
+{
+ /* no-op */
+}
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index 59e029bb8f4..cacbc32052f 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -1,4 +1,4 @@
-/* $Id: s_context.h,v 1.15 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_context.h,v 1.16 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -123,7 +123,6 @@ typedef struct
/* Working values:
*/
- struct pixel_buffer* PB;
GLuint StippleCounter; /* Line stipple counter */
GLuint NewState;
GLuint StateChanges;
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index 0dba77c88be..03a5ec97351 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -1,4 +1,4 @@
-/* $Id: s_depth.c,v 1.14 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_depth.c,v 1.15 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -32,7 +32,6 @@
#include "s_depth.h"
#include "s_context.h"
-#include "s_pb.h"
@@ -533,9 +532,7 @@ depth_test_span32( GLcontext *ctx, GLuint n,
-/*
- * Apply depth test to span of fragments. Hardware or software z buffer.
- */
+
GLuint
_old_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLdepth z[], GLubyte mask[] )
@@ -1334,8 +1331,6 @@ hardware_depth_test_pixels( GLcontext *ctx, GLuint n, GLdepth zbuffer[],
}
}
-
-
void
_mesa_depth_test_pixels( GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
@@ -1344,7 +1339,7 @@ _mesa_depth_test_pixels( GLcontext *ctx,
SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (swrast->Driver.ReadDepthPixels) {
/* read depth values from hardware Z buffer */
- GLdepth zbuffer[PB_SIZE];
+ GLdepth zbuffer[MAX_WIDTH];
(*swrast->Driver.ReadDepthPixels)(ctx, n, x, y, zbuffer);
hardware_depth_test_pixels( ctx, n, zbuffer, z, mask );
diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c
index 2c3b7878b72..caaefcb688f 100644
--- a/src/mesa/swrast/s_fog.c
+++ b/src/mesa/swrast/s_fog.c
@@ -1,10 +1,10 @@
-/* $Id: s_fog.c,v 1.20 2002/01/28 03:42:28 brianp Exp $ */
+/* $Id: s_fog.c,v 1.21 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -33,7 +33,6 @@
#include "s_context.h"
#include "s_fog.h"
-#include "s_pb.h"
@@ -135,34 +134,6 @@ _mesa_fog_rgba_pixels_with_array( const GLcontext *ctx, struct sw_span *span,
}
}
-/**
- * Apply fog to an array of RGBA pixels.
- * Input: n - number of pixels
- * fog - array of fog factors in [0,1]
- * red, green, blue, alpha - pixel colors
- * Output: red, green, blue, alpha - fogged pixel colors
- */
-void
-_old_fog_rgba_pixels( const GLcontext *ctx,
- GLuint n,
- const GLfloat fog[],
- GLchan rgba[][4] )
-{
- GLuint i;
- GLchan rFog, gFog, bFog;
-
- UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]);
- UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]);
- UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]);
-
- for (i = 0; i < n; i++) {
- const GLfloat f = fog[i];
- const GLfloat g = 1.0F - f;
- rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + g * rFog);
- rgba[i][GCOMP] = (GLchan) (f * rgba[i][GCOMP] + g * gFog);
- rgba[i][BCOMP] = (GLchan) (f * rgba[i][BCOMP] + g * bFog);
- }
-}
/**
@@ -217,26 +188,6 @@ _mesa_fog_ci_pixels_with_array( const GLcontext *ctx, struct sw_span *span,
}
}
-/**
- * Apply fog to an array of color index pixels.
- * Input: n - number of pixels
- * fog - array of fog factors in [0,1]
- * index - pixel color indexes
- * Output: index - fogged pixel color indexes
- */
-void
-_old_fog_ci_pixels( const GLcontext *ctx,
- GLuint n, const GLfloat fog[], GLuint index[] )
-{
- GLuint idx = (GLuint) ctx->Fog.Index;
- GLuint i;
-
- for (i = 0; i < n; i++) {
- const GLfloat f = CLAMP(fog[i], 0.0F, 1.0F);
- index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * idx);
- }
-}
-
/**
@@ -391,11 +342,11 @@ void
_mesa_depth_fog_rgba_pixels(const GLcontext *ctx, struct sw_span *span,
GLchan rgba[][4])
{
- GLfloat fogFact[PB_SIZE];
+ GLfloat fogFact[MAX_WIDTH];
ASSERT(ctx->Fog.Enabled);
ASSERT(span->arrayMask & SPAN_Z);
- ASSERT(span->end <= PB_SIZE);
+ ASSERT(span->end <= MAX_WIDTH);
compute_fog_factors_from_z(ctx, span->end, span->zArray, fogFact );
_mesa_fog_rgba_pixels_with_array( ctx, span, fogFact, rgba );
@@ -403,24 +354,6 @@ _mesa_depth_fog_rgba_pixels(const GLcontext *ctx, struct sw_span *span,
/**
- * Apply fog to an array of RGBA pixels.
- * Input: n - number of pixels
- * z - array of integer depth values
- * red, green, blue, alpha - pixel colors
- * Output: red, green, blue, alpha - fogged pixel colors
- */
-void
-_old_depth_fog_rgba_pixels( const GLcontext *ctx,
- GLuint n, const GLdepth z[], GLchan rgba[][4] )
-{
- GLfloat fogFact[PB_SIZE];
- ASSERT(n <= PB_SIZE);
- compute_fog_factors_from_z( ctx, n, z, fogFact );
- _old_fog_rgba_pixels( ctx, n, fogFact, rgba );
-}
-
-
-/**
* Apply fog to a span of color index pixels.
* Input: ctx -
* span - where span->zArray has to be filled.
@@ -431,30 +364,12 @@ void
_mesa_depth_fog_ci_pixels( const GLcontext *ctx, struct sw_span *span,
GLuint index[] )
{
- GLfloat fogFact[PB_SIZE];
+ GLfloat fogFact[MAX_WIDTH];
ASSERT(ctx->Fog.Enabled);
ASSERT(span->arrayMask & SPAN_Z);
- ASSERT(span->end <= PB_SIZE);
+ ASSERT(span->end <= MAX_WIDTH);
compute_fog_factors_from_z(ctx, span->end, span->zArray, fogFact );
_mesa_fog_ci_pixels_with_array( ctx, span, fogFact, index );
}
-
-
-/**
- * Apply fog to an array of color index pixels.
- * Input: n - number of pixels
- * z - array of integer depth values
- * index - pixel color indexes
- * Output: index - fogged pixel color indexes
- */
-void
-_old_depth_fog_ci_pixels( const GLcontext *ctx,
- GLuint n, const GLdepth z[], GLuint index[] )
-{
- GLfloat fogFact[PB_SIZE];
- ASSERT(n <= PB_SIZE);
- compute_fog_factors_from_z( ctx, n, z, fogFact );
- _old_fog_ci_pixels( ctx, n, fogFact, index );
-}
diff --git a/src/mesa/swrast/s_fog.h b/src/mesa/swrast/s_fog.h
index 10f1b923b34..e254f8dd51d 100644
--- a/src/mesa/swrast/s_fog.h
+++ b/src/mesa/swrast/s_fog.h
@@ -1,4 +1,4 @@
-/* $Id: s_fog.h,v 1.7 2002/01/21 18:12:34 brianp Exp $ */
+/* $Id: s_fog.h,v 1.8 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -38,10 +38,6 @@ _mesa_z_to_fogfactor(GLcontext *ctx, GLfloat z);
extern void
-_old_fog_rgba_pixels( const GLcontext *ctx,
- GLuint n, const GLfloat fog[],
- GLchan rgba[][4] );
-extern void
_mesa_fog_rgba_pixels( const GLcontext *ctx, struct sw_span *span,
GLchan rgba[][4]);
extern void
@@ -55,10 +51,6 @@ _mesa_fog_ci_pixels( const GLcontext *ctx, struct sw_span *span,
extern void
_mesa_fog_ci_pixels_with_array( const GLcontext *ctx, struct sw_span *span,
const GLfloat fog[], GLuint index[] );
-extern void
-_old_fog_ci_pixels( const GLcontext *ctx,
- GLuint n, const GLfloat fog[],
- GLuint indx[] );
extern void
_mesa_win_fog_coords_from_z( const GLcontext *ctx,
@@ -69,15 +61,9 @@ _mesa_win_fog_coords_from_z( const GLcontext *ctx,
extern void
_mesa_depth_fog_rgba_pixels( const GLcontext *ctx, struct sw_span *span,
GLchan rgba[][4] );
-extern void
-_old_depth_fog_rgba_pixels( const GLcontext *ctx,
- GLuint n, const GLdepth z[], GLchan rgba[][4] );
extern void
_mesa_depth_fog_ci_pixels( const GLcontext *ctx, struct sw_span *span,
GLuint index[] );
-extern void
-_old_depth_fog_ci_pixels( const GLcontext *ctx,
- GLuint n, const GLdepth z[], GLuint index[] );
#endif
diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c
index 5331e812ddd..3fb895f1600 100644
--- a/src/mesa/swrast/s_lines.c
+++ b/src/mesa/swrast/s_lines.c
@@ -1,10 +1,10 @@
-/* $Id: s_lines.c,v 1.24 2002/01/16 20:15:00 brianp Exp $ */
+/* $Id: s_lines.c,v 1.25 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -30,334 +30,271 @@
#include "macros.h"
#include "mmath.h"
#include "s_aaline.h"
-#include "s_pb.h"
#include "s_context.h"
#include "s_depth.h"
-#include "s_lines.h"
#include "s_feedback.h"
+#include "s_lines.h"
+#include "s_span.h"
+/*
+ * Init the mask[] array to implement a line stipple.
+ */
+static void
+compute_stipple_mask( GLcontext *ctx, GLuint len, GLubyte mask[] )
+{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ GLuint i;
-/**********************************************************************/
-/***** Rasterization *****/
-/**********************************************************************/
+ for (i = 0; i < len; i++) {
+ GLuint bit = (swrast->StippleCounter / ctx->Line.StippleFactor) & 0xf;
+ if ((1 << bit) & ctx->Line.StipplePattern) {
+ mask[i] = GL_TRUE;
+ }
+ else {
+ mask[i] = GL_FALSE;
+ }
+ swrast->StippleCounter++;
+ }
+}
/*
- * There are 4 pairs (RGBA, CI) of line drawing functions:
- * 1. simple: width=1 and no special rasterization functions (fastest)
- * 2. flat: width=1, non-stippled, flat-shaded, any raster operations
- * 3. smooth: width=1, non-stippled, smooth-shaded, any raster operations
- * 4. general: any other kind of line (slowest)
+ * To draw a wide line we can simply redraw the span N times, side by side.
*/
-
-
-/* Flat, color index line */
-static void flat_ci_line( GLcontext *ctx,
- const SWvertex *vert0,
- const SWvertex *vert1 )
+static void
+draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor )
{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
+ GLint width, start;
- PB_SET_INDEX( PB, vert0->index );
+ ASSERT(span->end < MAX_WIDTH);
-#define INTERP_XY 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, 0, 0);
+ width = (GLint) CLAMP( ctx->Line.Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH );
-#include "s_linetemp.h"
-
- _mesa_flush_pb(ctx);
+ if (width & 1)
+ start = width / 2;
+ else
+ start = width / 2 - 1;
+
+ if (xMajor) {
+ GLuint i, w;
+ for (w = 0; w < width; w++) {
+ if (w == 0) {
+ for (i = 0; i < span->end; i++)
+ span->yArray[i] -= start;
+ }
+ else {
+ for (i = 0; i < span->end; i++)
+ span->yArray[i]++;
+ }
+ if ((span->interpMask | span->arrayMask) & SPAN_TEXTURE)
+ _mesa_write_texture_span(ctx, span, GL_LINE);
+ else if ((span->interpMask | span->arrayMask) & SPAN_RGBA)
+ _mesa_write_rgba_span(ctx, span, GL_LINE);
+ else
+ _mesa_write_index_span(ctx, span, GL_LINE);
+ }
+ }
+ else {
+ GLuint i, w;
+ for (w = 0; w < width; w++) {
+ if (w == 0) {
+ for (i = 0; i < span->end; i++)
+ span->xArray[i] -= start;
+ }
+ else {
+ for (i = 0; i < span->end; i++)
+ span->xArray[i]++;
+ }
+ if ((span->interpMask | span->arrayMask) & SPAN_TEXTURE)
+ _mesa_write_texture_span(ctx, span, GL_LINE);
+ else if ((span->interpMask | span->arrayMask) & SPAN_RGBA)
+ _mesa_write_rgba_span(ctx, span, GL_LINE);
+ else
+ _mesa_write_index_span(ctx, span, GL_LINE);
+ }
+ }
}
-/* Flat, color index line with Z interpolation/testing */
-static void flat_ci_z_line( GLcontext *ctx,
- const SWvertex *vert0,
- const SWvertex *vert1 )
+/**********************************************************************/
+/***** Rasterization *****/
+/**********************************************************************/
+
+
+/* Flat, color index line */
+static void flat_ci_line( GLcontext *ctx,
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- PB_SET_INDEX( PB, vert0->index );
+ struct sw_span span;
+
+ ASSERT(ctx->Light.ShadeModel == GL_FLAT);
+ ASSERT(!ctx->Line.StippleFlag);
+ ASSERT(ctx->Line.Width == 1.0F);
+
+ INIT_SPAN(span);
+ span.arrayMask |= SPAN_XY;
+ span.interpMask |= SPAN_INDEX;
+ span.index = IntToFixed(vert1->index);
+ span.indexStep = 0;
#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
+#define PLOT(X,Y) \
+ { \
+ span.xArray[span.end] = X; \
+ span.yArray[span.end] = Y; \
+ span.end++; \
+ }
#include "s_linetemp.h"
- _mesa_flush_pb(ctx);
+ _mesa_write_index_span(ctx, &span, GL_LINE);
}
-
/* Flat-shaded, RGBA line */
static void flat_rgba_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- const GLchan *color = vert1->color;
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] );
+ struct sw_span span;
+
+ ASSERT(ctx->Light.ShadeModel == GL_FLAT);
+ ASSERT(!ctx->Line.StippleFlag);
+ ASSERT(ctx->Line.Width == 1.0F);
+
+ INIT_SPAN(span);
+ span.arrayMask |= SPAN_XY;
+ span.interpMask |= SPAN_RGBA;
+ span.red = ChanToFixed(vert1->color[0]);
+ span.green = ChanToFixed(vert1->color[1]);
+ span.blue = ChanToFixed(vert1->color[2]);
+ span.alpha = ChanToFixed(vert1->color[3]);
+ span.redStep = 0;
+ span.greenStep = 0;
+ span.blueStep = 0;
+ span.alphaStep = 0;
#define INTERP_XY 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, 0, 0);
-
-#include "s_linetemp.h"
-
- _mesa_flush_pb(ctx);
-}
-
-
-
-/* Flat-shaded, RGBA line with Z interpolation/testing */
-static void flat_rgba_z_line( GLcontext *ctx,
- const SWvertex *vert0,
- const SWvertex *vert1 )
-{
- const GLchan *color = vert1->color;
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] );
-
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
+#define PLOT(X,Y) \
+ { \
+ span.xArray[span.end] = X; \
+ span.yArray[span.end] = Y; \
+ span.end++; \
+ }
#include "s_linetemp.h"
- _mesa_flush_pb(ctx);
+ _mesa_write_rgba_span(ctx, &span, GL_LINE);
}
-
/* Smooth shaded, color index line */
static void smooth_ci_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- GLint count = PB->count;
- GLint *pbx = PB->x;
- GLint *pby = PB->y;
- GLuint *pbi = PB->index;
-
- PB->mono = GL_FALSE;
-
-#define INTERP_XY 1
-#define INTERP_INDEX 1
+ struct sw_span span;
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbi[count] = I; \
- count++;
-
-#include "s_linetemp.h"
-
- PB->count = count;
- _mesa_flush_pb(ctx);
-}
+ ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
+ ASSERT(!ctx->Line.StippleFlag);
+ ASSERT(ctx->Line.Width == 1.0F);
-
-
-/* Smooth shaded, color index line with Z interpolation/testing */
-static void smooth_ci_z_line( GLcontext *ctx,
- const SWvertex *vert0,
- const SWvertex *vert1 )
-{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- GLint count = PB->count;
- GLint *pbx = PB->x;
- GLint *pby = PB->y;
- GLdepth *pbz = PB->z;
- GLuint *pbi = PB->index;
-
- PB->mono = GL_FALSE;
+ INIT_SPAN(span);
+ span.arrayMask |= (SPAN_XY | SPAN_INDEX);
#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
#define INTERP_INDEX 1
-
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbi[count] = I; \
- count++;
+#define PLOT(X,Y) \
+ { \
+ span.xArray[span.end] = X; \
+ span.yArray[span.end] = Y; \
+ span.color.index[span.end] = I; \
+ span.end++; \
+ }
#include "s_linetemp.h"
- PB->count = count;
- _mesa_flush_pb(ctx);
+ _mesa_write_index_span(ctx, &span, GL_LINE);
}
-
/* Smooth-shaded, RGBA line */
static void smooth_rgba_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- GLint count = PB->count;
- GLint *pbx = PB->x;
- GLint *pby = PB->y;
- GLchan (*pbrgba)[4] = PB->rgba;
-
- PB->mono = GL_FALSE;
-
-#define INTERP_XY 1
-#define INTERP_RGB 1
-#define INTERP_ALPHA 1
-
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbrgba[count][RCOMP] = FixedToInt(r0); \
- pbrgba[count][GCOMP] = FixedToInt(g0); \
- pbrgba[count][BCOMP] = FixedToInt(b0); \
- pbrgba[count][ACOMP] = FixedToInt(a0); \
- count++;
-
-#include "s_linetemp.h"
-
- PB->count = count;
- _mesa_flush_pb(ctx);
-}
-
-
-
-/* Smooth-shaded, RGBA line with Z interpolation/testing */
-static void smooth_rgba_z_line( GLcontext *ctx,
- const SWvertex *vert0,
- const SWvertex *vert1 )
-{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- GLint count = PB->count;
- GLint *pbx = PB->x;
- GLint *pby = PB->y;
- GLdepth *pbz = PB->z;
- GLfloat *pbfog = PB->fog;
- GLchan (*pbrgba)[4] = PB->rgba;
+ struct sw_span span;
+ ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
+ ASSERT(!ctx->Line.StippleFlag);
+ ASSERT(ctx->Line.Width == 1.0F);
- PB->mono = GL_FALSE;
+ INIT_SPAN(span);
+ span.arrayMask |= (SPAN_XY | SPAN_RGBA);
#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
#define INTERP_RGB 1
#define INTERP_ALPHA 1
-
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbfog[count] = fog0; \
- pbrgba[count][RCOMP] = FixedToInt(r0); \
- pbrgba[count][GCOMP] = FixedToInt(g0); \
- pbrgba[count][BCOMP] = FixedToInt(b0); \
- pbrgba[count][ACOMP] = FixedToInt(a0); \
- count++;
+#define PLOT(X,Y) \
+ { \
+ span.xArray[span.end] = X; \
+ span.yArray[span.end] = Y; \
+ span.color.rgba[span.end][RCOMP] = FixedToInt(r0); \
+ span.color.rgba[span.end][GCOMP] = FixedToInt(g0); \
+ span.color.rgba[span.end][BCOMP] = FixedToInt(b0); \
+ span.color.rgba[span.end][ACOMP] = FixedToInt(a0); \
+ span.end++; \
+ }
#include "s_linetemp.h"
- PB->count = count;
- _mesa_flush_pb(ctx);
+ _mesa_write_rgba_span(ctx, &span, GL_LINE);
}
-#define CHECK_FULL(count) \
- if (count >= PB_SIZE-MAX_WIDTH) { \
- PB->count = count; \
- _mesa_flush_pb(ctx); \
- count = PB->count; \
- }
-
-
-
/* Smooth shaded, color index, any width, maybe stippled */
static void general_smooth_ci_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- GLint count = PB->count;
- GLint *pbx = PB->x;
- GLint *pby = PB->y;
- GLdepth *pbz = PB->z;
- GLfloat *pbfog = PB->fog;
- GLuint *pbi = PB->index;
+ GLboolean xMajor = GL_FALSE;
+ struct sw_span span;
- PB->mono = GL_FALSE;
+ ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
- if (ctx->Line.StippleFlag) {
- /* stippled */
+ INIT_SPAN(span);
+ span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_INDEX);
+
+#define SET_XMAJOR 1
#define INTERP_XY 1
#define INTERP_Z 1
#define INTERP_FOG 1
#define INTERP_INDEX 1
-#define WIDE 1
-#define STIPPLE 1
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbfog[count] = fog0; \
- pbi[count] = I; \
- count++; \
- CHECK_FULL(count);
-#include "s_linetemp.h"
+#define PLOT(X,Y) \
+ { \
+ span.xArray[span.end] = X; \
+ span.yArray[span.end] = Y; \
+ span.zArray[span.end] = Z; \
+ span.fogArray[span.end] = fog0; \
+ span.color.index[span.end] = I; \
+ span.end++; \
}
- else {
- /* unstippled */
- if (ctx->Line.Width==2.0F) {
- /* special case: unstippled and width=2 */
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define INTERP_INDEX 1
-#define XMAJOR_PLOT(X,Y) \
- pbx[count] = X; pbx[count+1] = X; \
- pby[count] = Y; pby[count+1] = Y+1; \
- pbz[count] = Z; pbz[count+1] = Z; \
- pbfog[count] = fog0; pbfog[count+1] = fog0; \
- pbi[count] = I; pbi[count+1] = I; \
- count += 2; \
- CHECK_FULL(count);
-#define YMAJOR_PLOT(X,Y) \
- pbx[count] = X; pbx[count+1] = X+1; \
- pby[count] = Y; pby[count+1] = Y; \
- pbz[count] = Z; pbz[count+1] = Z; \
- pbfog[count] = fog0; pbfog[count+1] = fog0; \
- pbi[count] = I; pbi[count+1] = I; \
- count += 2; \
- CHECK_FULL(count);
#include "s_linetemp.h"
- }
- else {
- /* unstippled, any width */
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define INTERP_INDEX 1
-#define WIDE 1
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbi[count] = I; \
- pbfog[count] = fog0; \
- count++; \
- CHECK_FULL(count);
-#include "s_linetemp.h"
- }
+
+ if (ctx->Line.StippleFlag) {
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.mask);
}
- PB->count = count;
- _mesa_flush_pb(ctx);
+ if (ctx->Line.Width > 1.0) {
+ draw_wide_line(ctx, &span, xMajor);
+ }
+ else {
+ _mesa_write_index_span(ctx, &span, GL_LINE);
+ }
}
@@ -366,73 +303,42 @@ static void general_flat_ci_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- GLint count;
- GLint *pbx = PB->x;
- GLint *pby = PB->y;
- GLdepth *pbz = PB->z;
- GLfloat *pbfog = PB->fog;
- PB_SET_INDEX( PB, vert0->index );
- count = PB->count;
+ GLboolean xMajor = GL_FALSE;
+ struct sw_span span;
- if (ctx->Line.StippleFlag) {
- /* stippled, any width */
+ ASSERT(ctx->Light.ShadeModel == GL_FLAT);
+
+ INIT_SPAN(span);
+ span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG);
+ span.interpMask |= SPAN_INDEX;
+ span.index = IntToFixed(vert1->index);
+ span.indexStep = 0;
+
+#define SET_XMAJOR 1
#define INTERP_XY 1
#define INTERP_Z 1
#define INTERP_FOG 1
-#define WIDE 1
-#define STIPPLE 1
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbfog[count] = fog0; \
- count++; \
- CHECK_FULL(count);
-#include "s_linetemp.h"
+#define PLOT(X,Y) \
+ { \
+ span.xArray[span.end] = X; \
+ span.yArray[span.end] = Y; \
+ span.zArray[span.end] = Z; \
+ span.fogArray[span.end] = fog0; \
+ span.end++; \
}
- else {
- /* unstippled */
- if (ctx->Line.Width==2.0F) {
- /* special case: unstippled and width=2 */
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define XMAJOR_PLOT(X,Y) \
- pbx[count] = X; pbx[count+1] = X; \
- pby[count] = Y; pby[count+1] = Y+1; \
- pbz[count] = Z; pbz[count+1] = Z; \
- pbfog[count] = fog0; pbfog[count+1] = fog0; \
- count += 2; \
- CHECK_FULL(count);
-#define YMAJOR_PLOT(X,Y) \
- pbx[count] = X; pbx[count+1] = X+1; \
- pby[count] = Y; pby[count+1] = Y; \
- pbz[count] = Z; pbz[count+1] = Z; \
- pbfog[count] = fog0; pbfog[count+1] = fog0; \
- count += 2; \
- CHECK_FULL(count);
#include "s_linetemp.h"
- }
- else {
- /* unstippled, any width */
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define WIDE 1
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbfog[count] = fog0; \
- count++; \
- CHECK_FULL(count);
-#include "s_linetemp.h"
- }
+
+ if (ctx->Line.StippleFlag) {
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.mask);
}
- PB->count = count;
- _mesa_flush_pb(ctx);
+ if (ctx->Line.Width > 1.0) {
+ draw_wide_line(ctx, &span, xMajor);
+ }
+ else {
+ _mesa_write_index_span(ctx, &span, GL_LINE);
+ }
}
@@ -441,104 +347,45 @@ static void general_smooth_rgba_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- GLint count = PB->count;
- GLint *pbx = PB->x;
- GLint *pby = PB->y;
- GLdepth *pbz = PB->z;
- GLfloat *pbfog = PB->fog;
- GLchan (*pbrgba)[4] = PB->rgba;
+ GLboolean xMajor = GL_FALSE;
+ struct sw_span span;
- PB->mono = GL_FALSE;
+ ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
- if (ctx->Line.StippleFlag) {
- /* stippled */
+ INIT_SPAN(span);
+ span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA);
+
+#define SET_XMAJOR 1
#define INTERP_XY 1
#define INTERP_Z 1
#define INTERP_FOG 1
#define INTERP_RGB 1
#define INTERP_ALPHA 1
-#define WIDE 1
-#define STIPPLE 1
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbfog[count] = fog0; \
- pbrgba[count][RCOMP] = FixedToInt(r0); \
- pbrgba[count][GCOMP] = FixedToInt(g0); \
- pbrgba[count][BCOMP] = FixedToInt(b0); \
- pbrgba[count][ACOMP] = FixedToInt(a0); \
- count++; \
- CHECK_FULL(count);
-#include "s_linetemp.h"
+#define PLOT(X,Y) \
+ { \
+ span.xArray[span.end] = X; \
+ span.yArray[span.end] = Y; \
+ span.zArray[span.end] = Z; \
+ span.color.rgba[span.end][RCOMP] = FixedToInt(r0); \
+ span.color.rgba[span.end][GCOMP] = FixedToInt(g0); \
+ span.color.rgba[span.end][BCOMP] = FixedToInt(b0); \
+ span.color.rgba[span.end][ACOMP] = FixedToInt(a0); \
+ span.fogArray[span.end] = fog0; \
+ span.end++; \
}
- else {
- /* unstippled */
- if (ctx->Line.Width==2.0F) {
- /* special case: unstippled and width=2 */
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define INTERP_RGB 1
-#define INTERP_ALPHA 1
-#define XMAJOR_PLOT(X,Y) \
- pbx[count] = X; pbx[count+1] = X; \
- pby[count] = Y; pby[count+1] = Y+1; \
- pbz[count] = Z; pbz[count+1] = Z; \
- pbfog[count] = fog0; pbfog[count+1] = fog0; \
- pbrgba[count][RCOMP] = FixedToInt(r0); \
- pbrgba[count][GCOMP] = FixedToInt(g0); \
- pbrgba[count][BCOMP] = FixedToInt(b0); \
- pbrgba[count][ACOMP] = FixedToInt(a0); \
- pbrgba[count+1][RCOMP] = FixedToInt(r0); \
- pbrgba[count+1][GCOMP] = FixedToInt(g0); \
- pbrgba[count+1][BCOMP] = FixedToInt(b0); \
- pbrgba[count+1][ACOMP] = FixedToInt(a0); \
- count += 2; \
- CHECK_FULL(count);
-#define YMAJOR_PLOT(X,Y) \
- pbx[count] = X; pbx[count+1] = X+1; \
- pby[count] = Y; pby[count+1] = Y; \
- pbz[count] = Z; pbz[count+1] = Z; \
- pbfog[count] = fog0; pbfog[count+1] = fog0; \
- pbrgba[count][RCOMP] = FixedToInt(r0); \
- pbrgba[count][GCOMP] = FixedToInt(g0); \
- pbrgba[count][BCOMP] = FixedToInt(b0); \
- pbrgba[count][ACOMP] = FixedToInt(a0); \
- pbrgba[count+1][RCOMP] = FixedToInt(r0); \
- pbrgba[count+1][GCOMP] = FixedToInt(g0); \
- pbrgba[count+1][BCOMP] = FixedToInt(b0); \
- pbrgba[count+1][ACOMP] = FixedToInt(a0); \
- count += 2; \
- CHECK_FULL(count);
-#include "s_linetemp.h"
- }
- else {
- /* unstippled, any width */
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define INTERP_RGB 1
-#define INTERP_ALPHA 1
-#define WIDE 1
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbfog[count] = fog0; \
- pbrgba[count][RCOMP] = FixedToInt(r0); \
- pbrgba[count][GCOMP] = FixedToInt(g0); \
- pbrgba[count][BCOMP] = FixedToInt(b0); \
- pbrgba[count][ACOMP] = FixedToInt(a0); \
- count++; \
- CHECK_FULL(count);
#include "s_linetemp.h"
- }
+
+ if (ctx->Line.StippleFlag) {
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.mask);
}
- PB->count = count;
- _mesa_flush_pb(ctx);
+ if (ctx->Line.Width > 1.0) {
+ draw_wide_line(ctx, &span, xMajor);
+ }
+ else {
+ _mesa_write_rgba_span(ctx, &span, GL_LINE);
+ }
}
@@ -546,52 +393,48 @@ static void general_flat_rgba_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- const GLchan *color = vert1->color;
- GLuint count;
- PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] );
-
- if (ctx->Line.StippleFlag) {
- /* stippled */
+ GLboolean xMajor = GL_FALSE;
+ struct sw_span span;
+
+ ASSERT(ctx->Light.ShadeModel == GL_FLAT);
+
+ INIT_SPAN(span);
+ span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG);
+ span.interpMask |= SPAN_RGBA;
+ span.red = ChanToFixed(vert1->color[0]);
+ span.green = ChanToFixed(vert1->color[1]);
+ span.blue = ChanToFixed(vert1->color[2]);
+ span.alpha = ChanToFixed(vert1->color[3]);
+ span.redStep = 0;
+ span.greenStep = 0;
+ span.blueStep = 0;
+ span.alphaStep = 0;
+
+#define SET_XMAJOR 1
#define INTERP_XY 1
#define INTERP_Z 1
#define INTERP_FOG 1
-#define WIDE 1
-#define STIPPLE 1
-#define PLOT(X,Y) \
- PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \
- count = PB->count; \
- CHECK_FULL(count);
-#include "s_linetemp.h"
+#define PLOT(X,Y) \
+ { \
+ span.xArray[span.end] = X; \
+ span.yArray[span.end] = Y; \
+ span.zArray[span.end] = Z; \
+ span.fogArray[span.end] = fog0; \
+ span.end++; \
}
- else {
- /* unstippled */
- if (ctx->Line.Width==2.0F) {
- /* special case: unstippled and width=2 */
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define XMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \
- PB_WRITE_PIXEL(PB, X, Y+1, Z, fog0);
-#define YMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \
- PB_WRITE_PIXEL(PB, X+1, Y, Z, fog0);
#include "s_linetemp.h"
- }
- else {
- /* unstippled, any width */
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define WIDE 1
-#define PLOT(X,Y) \
- PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \
- count = PB->count; \
- CHECK_FULL(count);
-#include "s_linetemp.h"
- }
+
+ if (ctx->Line.StippleFlag) {
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.mask);
}
- _mesa_flush_pb(ctx);
+ if (ctx->Line.Width > 1.0) {
+ draw_wide_line(ctx, &span, xMajor);
+ }
+ else {
+ _mesa_write_rgba_span(ctx, &span, GL_LINE);
+ }
}
@@ -600,63 +443,59 @@ static void flat_textured_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- GLint count;
- GLint *pbx = PB->x;
- GLint *pby = PB->y;
- GLdepth *pbz = PB->z;
- GLfloat *pbfog = PB->fog;
- GLfloat (*pbtex)[4] = PB->tex[0];
- GLchan *color = (GLchan*) vert1->color;
- PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] );
- count = PB->count;
-
- if (ctx->Line.StippleFlag) {
- /* stippled */
+ GLboolean xMajor = GL_FALSE;
+ struct sw_span span;
+
+ ASSERT(ctx->Light.ShadeModel == GL_FLAT);
+
+ INIT_SPAN(span);
+ span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA);
+ span.interpMask |= (SPAN_RGBA | SPAN_SPEC);
+ span.red = ChanToFixed(vert1->color[0]);
+ span.green = ChanToFixed(vert1->color[1]);
+ span.blue = ChanToFixed(vert1->color[2]);
+ span.alpha = ChanToFixed(vert1->color[3]);
+ span.redStep = 0;
+ span.greenStep = 0;
+ span.blueStep = 0;
+ span.alphaStep = 0;
+ span.specRed = ChanToFixed(vert1->specular[0]);
+ span.specGreen = ChanToFixed(vert1->specular[1]);
+ span.specBlue = ChanToFixed(vert1->specular[2]);
+ span.specRedStep = 0;
+ span.specGreenStep = 0;
+ span.specBlueStep = 0;
+
+#define SET_XMAJOR 1
#define INTERP_XY 1
#define INTERP_Z 1
#define INTERP_FOG 1
#define INTERP_TEX 1
-#define WIDE 1
-#define STIPPLE 1
-#define PLOT(X,Y) \
- { \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbfog[count] = fog0; \
- pbtex[count][0] = fragTexcoord[0]; \
- pbtex[count][1] = fragTexcoord[1]; \
- pbtex[count][2] = fragTexcoord[2]; \
- count++; \
- CHECK_FULL(count); \
- }
-#include "s_linetemp.h"
+#define PLOT(X,Y) \
+ { \
+ span.xArray[span.end] = X; \
+ span.yArray[span.end] = Y; \
+ span.zArray[span.end] = Z; \
+ span.fogArray[span.end] = fog0; \
+ span.texcoords[0][span.end][0] = fragTexcoord[0]; \
+ span.texcoords[0][span.end][1] = fragTexcoord[1]; \
+ span.texcoords[0][span.end][2] = fragTexcoord[2]; \
+ span.lambda[0][span.end] = 0.0; \
+ span.end++; \
}
- else {
- /* unstippled */
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define INTERP_TEX 1
-#define WIDE 1
-#define PLOT(X,Y) \
- { \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbfog[count] = fog0; \
- pbtex[count][0] = fragTexcoord[0]; \
- pbtex[count][1] = fragTexcoord[1]; \
- pbtex[count][2] = fragTexcoord[2]; \
- count++; \
- CHECK_FULL(count); \
- }
#include "s_linetemp.h"
+
+ if (ctx->Line.StippleFlag) {
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.mask);
}
- PB->count = count;
- _mesa_flush_pb(ctx);
+ if (ctx->Line.Width > 1.0) {
+ draw_wide_line(ctx, &span, xMajor);
+ }
+ else {
+ _mesa_write_texture_span(ctx, &span, GL_LINE);
+ }
}
@@ -666,75 +505,50 @@ static void smooth_textured_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- GLint count = PB->count;
- GLint *pbx = PB->x;
- GLint *pby = PB->y;
- GLdepth *pbz = PB->z;
- GLfloat *pbfog = PB->fog;
- GLfloat (*pbtex)[4] = PB->tex[0];
- GLchan (*pbrgba)[4] = PB->rgba;
+ GLboolean xMajor = GL_FALSE;
+ struct sw_span span;
- PB->mono = GL_FALSE;
+ ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
- if (ctx->Line.StippleFlag) {
- /* stippled */
+ INIT_SPAN(span);
+ span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_TEXTURE | SPAN_LAMBDA);
+
+#define SET_XMAJOR 1
#define INTERP_XY 1
#define INTERP_Z 1
#define INTERP_FOG 1
#define INTERP_RGB 1
#define INTERP_ALPHA 1
#define INTERP_TEX 1
-#define WIDE 1
-#define STIPPLE 1
-#define PLOT(X,Y) \
- { \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbfog[count] = fog0; \
- pbtex[count][0] = fragTexcoord[0]; \
- pbtex[count][1] = fragTexcoord[1]; \
- pbtex[count][2] = fragTexcoord[2]; \
- pbrgba[count][RCOMP] = FixedToInt(r0); \
- pbrgba[count][GCOMP] = FixedToInt(g0); \
- pbrgba[count][BCOMP] = FixedToInt(b0); \
- pbrgba[count][ACOMP] = FixedToInt(a0); \
- count++; \
- CHECK_FULL(count); \
- }
-#include "s_linetemp.h"
+#define PLOT(X,Y) \
+ { \
+ span.xArray[span.end] = X; \
+ span.yArray[span.end] = Y; \
+ span.zArray[span.end] = Z; \
+ span.fogArray[span.end] = fog0; \
+ span.color.rgba[span.end][RCOMP] = FixedToInt(r0); \
+ span.color.rgba[span.end][GCOMP] = FixedToInt(g0); \
+ span.color.rgba[span.end][BCOMP] = FixedToInt(b0); \
+ span.color.rgba[span.end][ACOMP] = FixedToInt(a0); \
+ span.texcoords[0][span.end][0] = fragTexcoord[0]; \
+ span.texcoords[0][span.end][1] = fragTexcoord[1]; \
+ span.texcoords[0][span.end][2] = fragTexcoord[2]; \
+ span.lambda[0][span.end] = 0.0; \
+ span.end++; \
}
- else {
- /* unstippled */
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define INTERP_RGB 1
-#define INTERP_ALPHA 1
-#define INTERP_TEX 1
-#define WIDE 1
-#define PLOT(X,Y) \
- { \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbfog[count] = fog0; \
- pbtex[count][0] = fragTexcoord[0]; \
- pbtex[count][1] = fragTexcoord[1]; \
- pbtex[count][2] = fragTexcoord[2]; \
- pbrgba[count][RCOMP] = FixedToInt(r0); \
- pbrgba[count][GCOMP] = FixedToInt(g0); \
- pbrgba[count][BCOMP] = FixedToInt(b0); \
- pbrgba[count][ACOMP] = FixedToInt(a0); \
- count++; \
- CHECK_FULL(count); \
- }
#include "s_linetemp.h"
+
+ if (ctx->Line.StippleFlag) {
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.mask);
}
- PB->count = count;
- _mesa_flush_pb(ctx);
+ if (ctx->Line.Width > 1.0) {
+ draw_wide_line(ctx, &span, xMajor);
+ }
+ else {
+ _mesa_write_texture_span(ctx, &span, GL_LINE);
+ }
}
@@ -745,20 +559,16 @@ static void smooth_multitextured_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- GLint count = PB->count;
- GLint *pbx = PB->x;
- GLint *pby = PB->y;
- GLdepth *pbz = PB->z;
- GLfloat *pbfog = PB->fog;
- GLchan (*pbrgba)[4] = PB->rgba;
- GLchan (*pbspec)[3] = PB->spec;
-
- PB->mono = GL_FALSE;
- PB->haveSpec = GL_TRUE;
+ GLboolean xMajor = GL_FALSE;
+ struct sw_span span;
+ GLuint u;
- if (ctx->Line.StippleFlag) {
- /* stippled */
+ ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
+
+ INIT_SPAN(span);
+ span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_TEXTURE | SPAN_LAMBDA);
+
+#define SET_XMAJOR 1
#define INTERP_XY 1
#define INTERP_Z 1
#define INTERP_FOG 1
@@ -766,73 +576,42 @@ static void smooth_multitextured_line( GLcontext *ctx,
#define INTERP_SPEC 1
#define INTERP_ALPHA 1
#define INTERP_MULTITEX 1
-#define WIDE 1
-#define STIPPLE 1
-#define PLOT(X,Y) \
- { \
- GLuint u; \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbfog[count] = fog0; \
- pbrgba[count][RCOMP] = FixedToInt(r0); \
- pbrgba[count][GCOMP] = FixedToInt(g0); \
- pbrgba[count][BCOMP] = FixedToInt(b0); \
- pbrgba[count][ACOMP] = FixedToInt(a0); \
- pbspec[count][RCOMP] = FixedToInt(sr0); \
- pbspec[count][GCOMP] = FixedToInt(sg0); \
- pbspec[count][BCOMP] = FixedToInt(sb0); \
- for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
- if (ctx->Texture.Unit[u]._ReallyEnabled) { \
- PB->tex[u][count][0] = fragTexcoord[u][0]; \
- PB->tex[u][count][1] = fragTexcoord[u][1]; \
- PB->tex[u][count][2] = fragTexcoord[u][2]; \
- } \
- } \
- count++; \
- CHECK_FULL(count); \
- }
-#include "s_linetemp.h"
+#define PLOT(X,Y) \
+ { \
+ span.xArray[span.end] = X; \
+ span.yArray[span.end] = Y; \
+ span.zArray[span.end] = Z; \
+ span.fogArray[span.end] = fog0; \
+ span.color.rgba[span.end][RCOMP] = FixedToInt(r0); \
+ span.color.rgba[span.end][GCOMP] = FixedToInt(g0); \
+ span.color.rgba[span.end][BCOMP] = FixedToInt(b0); \
+ span.color.rgba[span.end][ACOMP] = FixedToInt(a0); \
+ span.specArray[span.end][RCOMP] = FixedToInt(sr0); \
+ span.specArray[span.end][GCOMP] = FixedToInt(sb0); \
+ span.specArray[span.end][BCOMP] = FixedToInt(sb0); \
+ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
+ if (ctx->Texture.Unit[u]._ReallyEnabled) { \
+ span.texcoords[u][span.end][0] = fragTexcoord[u][0]; \
+ span.texcoords[u][span.end][1] = fragTexcoord[u][1]; \
+ span.texcoords[u][span.end][2] = fragTexcoord[u][2]; \
+ span.lambda[u][span.end] = 0.0; \
+ } \
+ } \
+ span.end++; \
}
- else {
- /* unstippled */
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define INTERP_RGB 1
-#define INTERP_SPEC 1
-#define INTERP_ALPHA 1
-#define INTERP_MULTITEX 1
-#define WIDE 1
-#define PLOT(X,Y) \
- { \
- GLuint u; \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbfog[count] = fog0; \
- pbrgba[count][RCOMP] = FixedToInt(r0); \
- pbrgba[count][GCOMP] = FixedToInt(g0); \
- pbrgba[count][BCOMP] = FixedToInt(b0); \
- pbrgba[count][ACOMP] = FixedToInt(a0); \
- pbspec[count][RCOMP] = FixedToInt(sr0); \
- pbspec[count][GCOMP] = FixedToInt(sg0); \
- pbspec[count][BCOMP] = FixedToInt(sb0); \
- for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
- if (ctx->Texture.Unit[u]._ReallyEnabled) { \
- PB->tex[u][count][0] = fragTexcoord[u][0]; \
- PB->tex[u][count][1] = fragTexcoord[u][1]; \
- PB->tex[u][count][2] = fragTexcoord[u][2]; \
- } \
- } \
- count++; \
- CHECK_FULL(count); \
- }
#include "s_linetemp.h"
+
+ if (ctx->Line.StippleFlag) {
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.mask);
}
- PB->count = count;
- _mesa_flush_pb(ctx);
+ if (ctx->Line.Width > 1.0) {
+ draw_wide_line(ctx, &span, xMajor);
+ }
+ else {
+ _mesa_write_texture_span(ctx, &span, GL_LINE);
+ }
}
@@ -843,94 +622,64 @@ static void flat_multitextured_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- GLint count = PB->count;
- GLint *pbx = PB->x;
- GLint *pby = PB->y;
- GLdepth *pbz = PB->z;
- GLfloat *pbfog = PB->fog;
- GLchan (*pbrgba)[4] = PB->rgba;
- GLchan (*pbspec)[3] = PB->spec;
- GLchan *color = (GLchan*) vert1->color;
- GLchan sRed = vert1->specular[0];
- GLchan sGreen = vert1->specular[1];
- GLchan sBlue = vert1->specular[2];
-
- PB->mono = GL_FALSE;
- PB->haveSpec = GL_TRUE;
-
- if (ctx->Line.StippleFlag) {
- /* stippled */
+ GLboolean xMajor = GL_FALSE;
+ struct sw_span span;
+ GLuint u;
+
+ ASSERT(ctx->Light.ShadeModel == GL_FLAT);
+
+ INIT_SPAN(span);
+ span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA);
+ span.interpMask |= (SPAN_RGBA | SPAN_SPEC);
+ span.red = ChanToFixed(vert1->color[0]);
+ span.green = ChanToFixed(vert1->color[1]);
+ span.blue = ChanToFixed(vert1->color[2]);
+ span.alpha = ChanToFixed(vert1->color[3]);
+ span.redStep = 0;
+ span.greenStep = 0;
+ span.blueStep = 0;
+ span.alphaStep = 0;
+ span.specRed = ChanToFixed(vert1->specular[0]);
+ span.specGreen = ChanToFixed(vert1->specular[1]);
+ span.specBlue = ChanToFixed(vert1->specular[2]);
+ span.specRedStep = 0;
+ span.specGreenStep = 0;
+ span.specBlueStep = 0;
+
+#define SET_XMAJOR 1
#define INTERP_XY 1
#define INTERP_Z 1
#define INTERP_FOG 1
-#define INTERP_ALPHA 1
#define INTERP_MULTITEX 1
-#define WIDE 1
-#define STIPPLE 1
-#define PLOT(X,Y) \
- { \
- GLuint u; \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbfog[count] = fog0; \
- pbrgba[count][RCOMP] = color[0]; \
- pbrgba[count][GCOMP] = color[1]; \
- pbrgba[count][BCOMP] = color[2]; \
- pbrgba[count][ACOMP] = color[3]; \
- pbspec[count][RCOMP] = sRed; \
- pbspec[count][GCOMP] = sGreen; \
- pbspec[count][BCOMP] = sBlue; \
- for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
- if (ctx->Texture.Unit[u]._ReallyEnabled) { \
- PB->tex[u][count][0] = fragTexcoord[u][0]; \
- PB->tex[u][count][1] = fragTexcoord[u][1]; \
- PB->tex[u][count][2] = fragTexcoord[u][2]; \
- } \
- } \
- count++; \
- CHECK_FULL(count); \
- }
-#include "s_linetemp.h"
+#define PLOT(X,Y) \
+ { \
+ span.xArray[span.end] = X; \
+ span.yArray[span.end] = Y; \
+ span.zArray[span.end] = Z; \
+ span.fogArray[span.end] = fog0; \
+ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
+ if (ctx->Texture.Unit[u]._ReallyEnabled) { \
+ span.texcoords[u][span.end][0] = fragTexcoord[u][0]; \
+ span.texcoords[u][span.end][1] = fragTexcoord[u][1]; \
+ span.texcoords[u][span.end][2] = fragTexcoord[u][2]; \
+ span.lambda[u][span.end] = 0.0; \
+ } \
+ } \
+ span.end++; \
}
- else {
- /* unstippled */
-#define INTERP_XY 1
-#define INTERP_Z 1
-#define INTERP_FOG 1
-#define INTERP_ALPHA 1
-#define INTERP_MULTITEX 1
-#define WIDE 1
-#define PLOT(X,Y) \
- { \
- GLuint u; \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- pbfog[count] = fog0; \
- pbrgba[count][RCOMP] = color[0]; \
- pbrgba[count][GCOMP] = color[1]; \
- pbrgba[count][BCOMP] = color[2]; \
- pbrgba[count][ACOMP] = color[3]; \
- pbspec[count][RCOMP] = sRed; \
- pbspec[count][GCOMP] = sGreen; \
- pbspec[count][BCOMP] = sBlue; \
- for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
- if (ctx->Texture.Unit[u]._ReallyEnabled) { \
- PB->tex[u][count][0] = fragTexcoord[u][0]; \
- PB->tex[u][count][1] = fragTexcoord[u][1]; \
- PB->tex[u][count][2] = fragTexcoord[u][2]; \
- } \
- } \
- count++; \
- CHECK_FULL(count); \
- }
#include "s_linetemp.h"
+
+ if (ctx->Line.StippleFlag) {
+ span.arrayMask |= SPAN_MASK;
+ compute_stipple_mask(ctx, span.end, span.mask);
}
- PB->count = count;
- _mesa_flush_pb(ctx);
+ if (ctx->Line.Width > 1.0) {
+ draw_wide_line(ctx, &span, xMajor);
+ }
+ else {
+ _mesa_write_texture_span(ctx, &span, GL_LINE);
+ }
}
@@ -962,20 +711,12 @@ _mesa_print_line_function(GLcontext *ctx)
printf("Line Func == ");
if (swrast->Line == flat_ci_line)
printf("flat_ci_line\n");
- else if (swrast->Line == flat_ci_z_line)
- printf("flat_ci_z_line\n");
else if (swrast->Line == flat_rgba_line)
printf("flat_rgba_line\n");
- else if (swrast->Line == flat_rgba_z_line)
- printf("flat_rgba_z_line\n");
else if (swrast->Line == smooth_ci_line)
printf("smooth_ci_line\n");
- else if (swrast->Line == smooth_ci_z_line)
- printf("smooth_ci_z_line\n");
else if (swrast->Line == smooth_rgba_line)
printf("smooth_rgba_line\n");
- else if (swrast->Line == smooth_rgba_z_line)
- printf("smooth_rgba_z_line\n");
else if (swrast->Line == general_smooth_ci_line)
printf("general_smooth_ci_line\n");
else if (swrast->Line == general_flat_ci_line)
@@ -1032,7 +773,7 @@ _swrast_choose_line( GLcontext *ctx )
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLboolean rgbmode = ctx->Visual.rgbMode;
- if (ctx->RenderMode==GL_RENDER) {
+ if (ctx->RenderMode == GL_RENDER) {
if (ctx->Line.SmoothFlag) {
/* antialiased lines */
_swrast_choose_aa_line_function(ctx);
@@ -1042,13 +783,13 @@ _swrast_choose_line( GLcontext *ctx )
if (ctx->Texture._ReallyEnabled > TEXTURE0_ANY ||
(ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)) {
/* multi-texture and/or separate specular color */
- if (ctx->Light.ShadeModel==GL_SMOOTH)
+ if (ctx->Light.ShadeModel == GL_SMOOTH)
USE(smooth_multitextured_line);
else
USE(flat_multitextured_line);
}
else {
- if (ctx->Light.ShadeModel==GL_SMOOTH) {
+ if (ctx->Light.ShadeModel == GL_SMOOTH) {
USE(smooth_textured_line);
}
else {
@@ -1056,28 +797,14 @@ _swrast_choose_line( GLcontext *ctx )
}
}
}
- else if (ctx->Line.Width!=1.0 || ctx->Line.StippleFlag) {
- if (ctx->Light.ShadeModel==GL_SMOOTH) {
- if (rgbmode)
- USE(general_smooth_rgba_line);
- else
- USE(general_smooth_ci_line);
- }
- else {
- if (rgbmode)
- USE(general_flat_rgba_line);
- else
- USE(general_flat_ci_line);
- }
- }
else {
- if (ctx->Light.ShadeModel==GL_SMOOTH) {
- /* Width==1, non-stippled, smooth-shaded */
- if (ctx->Depth.Test || ctx->Fog.Enabled) {
+ if (ctx->Light.ShadeModel == GL_SMOOTH) {
+ if (ctx->Depth.Test || ctx->Fog.Enabled || ctx->Line.Width != 1.0
+ || ctx->Line.StippleFlag) {
if (rgbmode)
- USE(smooth_rgba_z_line);
+ USE(general_smooth_rgba_line);
else
- USE(smooth_ci_z_line);
+ USE(general_smooth_ci_line);
}
else {
if (rgbmode)
@@ -1087,12 +814,12 @@ _swrast_choose_line( GLcontext *ctx )
}
}
else {
- /* Width==1, non-stippled, flat-shaded */
- if (ctx->Depth.Test || ctx->Fog.Enabled) {
+ if (ctx->Depth.Test || ctx->Fog.Enabled || ctx->Line.Width != 1.0
+ || ctx->Line.StippleFlag) {
if (rgbmode)
- USE(flat_rgba_z_line);
+ USE(general_flat_rgba_line);
else
- USE(flat_ci_z_line);
+ USE(general_flat_ci_line);
}
else {
if (rgbmode)
@@ -1103,11 +830,11 @@ _swrast_choose_line( GLcontext *ctx )
}
}
}
- else if (ctx->RenderMode==GL_FEEDBACK) {
+ else if (ctx->RenderMode == GL_FEEDBACK) {
USE(_mesa_feedback_line);
}
else {
- /* GL_SELECT mode */
+ ASSERT(ctx->RenderMode == GL_SELECT);
USE(_mesa_select_line);
}
diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h
index 21e786b4b2d..54e53c6c46a 100644
--- a/src/mesa/swrast/s_linetemp.h
+++ b/src/mesa/swrast/s_linetemp.h
@@ -1,10 +1,10 @@
-/* $Id: s_linetemp.h,v 1.11 2002/01/16 20:15:01 brianp Exp $ */
+/* $Id: s_linetemp.h,v 1.12 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -56,11 +56,7 @@
* Optionally, one may provide one-time setup code
* SETUP_CODE - code which is to be executed once per line
*
- * To enable line stippling define STIPPLE = 1
- * To enable wide lines define WIDE = 1
- *
- * To actually "plot" each pixel either the PLOT macro or
- * (XMAJOR_PLOT and YMAJOR_PLOT macros) must be defined...
+ * To actually "plot" each pixel the PLOT macro must be defined...
* PLOT(X,Y) - code to plot a pixel. Example:
* if (Z < *zPtr) {
* *zPtr = Z;
@@ -140,16 +136,6 @@
PIXEL_TYPE *pixelPtr;
GLint pixelXstep, pixelYstep;
#endif
-#ifdef STIPPLE
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
-#endif
-#ifdef WIDE
- /* for wide lines, draw all X in [x+min, x+max] or Y in [y+min, y+max] */
- GLint width, min, max;
- width = (GLint) CLAMP( ctx->Line.Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH );
- min = (width-1) / -2;
- max = min + width - 1;
-#endif
#ifdef INTERP_TEX
{
tex[0] = invw0 * vert0->texcoord[0][0];
@@ -313,6 +299,9 @@
GLint errorInc = dy+dy;
GLint error = errorInc-dx;
GLint errorDec = error-dx;
+#ifdef SET_XMAJOR
+ xMajor = GL_TRUE;
+#endif
#ifdef INTERP_Z
dz = (z1-z0) / dx;
#endif
@@ -360,11 +349,6 @@
#endif
for (i=0;i<dx;i++) {
-#ifdef STIPPLE
- GLushort m;
- m = 1 << ((swrast->StippleCounter/ctx->Line.StippleFactor) & 0xf);
- if (ctx->Line.StipplePattern & m) {
-#endif
#ifdef INTERP_Z
GLdepth Z = FixedToDepth(z0);
#endif
@@ -394,26 +378,9 @@
}
}
#endif
-#ifdef WIDE
- {
- GLint yy;
- GLint ymin = y0 + min;
- GLint ymax = y0 + max;
- for (yy=ymin;yy<=ymax;yy++) {
- PLOT( x0, yy );
- }
- }
-#else
-# ifdef XMAJOR_PLOT
- XMAJOR_PLOT( x0, y0 );
-# else
+
PLOT( x0, y0 );
-# endif
-#endif /*WIDE*/
-#ifdef STIPPLE
- }
- swrast->StippleCounter++;
-#endif
+
#ifdef INTERP_XY
x0 += xstep;
#endif
@@ -535,11 +502,6 @@
#endif
for (i=0;i<dy;i++) {
-#ifdef STIPPLE
- GLushort m;
- m = 1 << ((swrast->StippleCounter/ctx->Line.StippleFactor) & 0xf);
- if (ctx->Line.StipplePattern & m) {
-#endif
#ifdef INTERP_Z
GLdepth Z = FixedToDepth(z0);
#endif
@@ -569,26 +531,9 @@
}
}
#endif
-#ifdef WIDE
- {
- GLint xx;
- GLint xmin = x0 + min;
- GLint xmax = x0 + max;
- for (xx=xmin;xx<=xmax;xx++) {
- PLOT( xx, y0 );
- }
- }
-#else
-# ifdef YMAJOR_PLOT
- YMAJOR_PLOT( x0, y0 );
-# else
+
PLOT( x0, y0 );
-# endif
-#endif /*WIDE*/
-#ifdef STIPPLE
- }
- swrast->StippleCounter++;
-#endif
+
#ifdef INTERP_XY
y0 += ystep;
#endif
@@ -675,9 +620,6 @@
#undef BYTES_PER_ROW
#undef SETUP_CODE
#undef PLOT
-#undef XMAJOR_PLOT
-#undef YMAJOR_PLOT
#undef CLIP_HACK
-#undef STIPPLE
-#undef WIDE
#undef FixedToDepth
+#undef SET_XMAJOR
diff --git a/src/mesa/swrast/s_logic.c b/src/mesa/swrast/s_logic.c
index d2f20b7bc42..99633ae4366 100644
--- a/src/mesa/swrast/s_logic.c
+++ b/src/mesa/swrast/s_logic.c
@@ -1,4 +1,4 @@
-/* $Id: s_logic.c,v 1.9 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_logic.c,v 1.10 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -32,7 +32,6 @@
#include "s_alphabuf.h"
#include "s_context.h"
#include "s_logic.h"
-#include "s_pb.h"
#include "s_span.h"
@@ -189,24 +188,6 @@ _mesa_logicop_ci_span( GLcontext *ctx, const struct sw_span *span,
/*
- * Apply the current logic operator to an array of CI pixels. This is only
- * used if the device driver can't do logic ops.
- */
-void
-_mesa_logicop_ci_pixels( GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint index[], const GLubyte mask[] )
-{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
- GLuint dest[PB_SIZE];
- /* Read dest values from frame buffer */
- (*swrast->Driver.ReadCI32Pixels)( ctx, n, x, y, dest, mask );
- index_logicop( ctx, n, index, dest, mask );
-}
-
-
-
-/*
* Apply logic operator to rgba pixels.
* Input: ctx - the context
* n - number of pixels
@@ -512,29 +493,3 @@ _mesa_logicop_rgba_span( GLcontext *ctx, const struct sw_span *span,
(GLchan *) rgba, (const GLchan *) dest);
}
}
-
-
-
-/*
- * Apply the current logic operator to an array of RGBA pixels.
- * This is only used if the device driver can't do logic ops.
- */
-void
-_mesa_logicop_rgba_pixels( GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLchan rgba[][4], const GLubyte mask[] )
-{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
- GLchan dest[PB_SIZE][4];
- (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
- if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
- _mesa_read_alpha_pixels( ctx, n, x, y, dest, mask );
- }
- if (sizeof(GLchan) * 4 == sizeof(GLuint)) {
- rgba_logicop_ui(ctx, n, mask, (GLuint *) rgba, (const GLuint *) dest);
- }
- else {
- rgba_logicop_chan(ctx, 4 * n, mask,
- (GLchan *) rgba, (const GLchan *) dest);
- }
-}
diff --git a/src/mesa/swrast/s_logic.h b/src/mesa/swrast/s_logic.h
index bc3cded9030..537b44a6b96 100644
--- a/src/mesa/swrast/s_logic.h
+++ b/src/mesa/swrast/s_logic.h
@@ -1,4 +1,4 @@
-/* $Id: s_logic.h,v 1.4 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_logic.h,v 1.5 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -39,20 +39,8 @@ _mesa_logicop_ci_span( GLcontext *ctx, const struct sw_span *span,
extern void
-_mesa_logicop_ci_pixels( GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint index[], const GLubyte mask[] );
-
-
-extern void
_mesa_logicop_rgba_span( GLcontext *ctx, const struct sw_span *span,
GLchan rgba[][4] );
-extern void
-_mesa_logicop_rgba_pixels( GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLchan rgba[][4], const GLubyte mask[] );
-
-
#endif
diff --git a/src/mesa/swrast/s_masking.c b/src/mesa/swrast/s_masking.c
index 968a2b914a9..00995cf997a 100644
--- a/src/mesa/swrast/s_masking.c
+++ b/src/mesa/swrast/s_masking.c
@@ -1,4 +1,4 @@
-/* $Id: s_masking.c,v 1.6 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_masking.c,v 1.7 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -37,7 +37,6 @@
#include "s_alphabuf.h"
#include "s_context.h"
#include "s_masking.h"
-#include "s_pb.h"
#include "s_span.h"
@@ -136,58 +135,6 @@ _mesa_mask_rgba_array( GLcontext *ctx,
-/*
- * Apply glColorMask to an array of RGBA pixels.
- */
-void
-_mesa_mask_rgba_pixels( GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLchan rgba[][4], const GLubyte mask[] )
-{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
- GLchan dest[PB_SIZE][4];
- GLuint i;
-
-#if CHAN_BITS == 8
-
- GLuint srcMask = *((GLuint*)ctx->Color.ColorMask);
- GLuint dstMask = ~srcMask;
- GLuint *rgba32 = (GLuint *) rgba;
- GLuint *dest32 = (GLuint *) dest;
-
- (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
- if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
- _mesa_read_alpha_pixels( ctx, n, x, y, dest, mask );
- }
-
- for (i=0; i<n; i++) {
- rgba32[i] = (rgba32[i] & srcMask) | (dest32[i] & dstMask);
- }
-
-#else
-
- const GLint rMask = ctx->Color.ColorMask[RCOMP];
- const GLint gMask = ctx->Color.ColorMask[GCOMP];
- const GLint bMask = ctx->Color.ColorMask[BCOMP];
- const GLint aMask = ctx->Color.ColorMask[ACOMP];
-
- (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
- if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
- _mesa_read_alpha_pixels( ctx, n, x, y, dest, mask );
- }
-
- for (i = 0; i < n; i++) {
- if (!rMask) rgba[i][RCOMP] = dest[i][RCOMP];
- if (!gMask) rgba[i][GCOMP] = dest[i][GCOMP];
- if (!bMask) rgba[i][BCOMP] = dest[i][BCOMP];
- if (!aMask) rgba[i][ACOMP] = dest[i][ACOMP];
- }
-
-#endif
-}
-
-
-
void
_mesa_mask_index_span( GLcontext *ctx, const struct sw_span *span,
GLuint index[] )
@@ -242,29 +189,3 @@ _mesa_mask_index_array( GLcontext *ctx,
index[i] = (index[i] & msrc) | (fbindexes[i] & mdest);
}
}
-
-
-
-/*
- * Apply glIndexMask to an array of CI pixels.
- */
-void
-_mesa_mask_index_pixels( GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint index[], const GLubyte mask[] )
-{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
- GLuint i;
- GLuint fbindexes[PB_SIZE];
- GLuint msrc, mdest;
-
- (*swrast->Driver.ReadCI32Pixels)( ctx, n, x, y, fbindexes, mask );
-
- msrc = ctx->Color.IndexMask;
- mdest = ~msrc;
-
- for (i=0;i<n;i++) {
- index[i] = (index[i] & msrc) | (fbindexes[i] & mdest);
- }
-}
-
diff --git a/src/mesa/swrast/s_masking.h b/src/mesa/swrast/s_masking.h
index 3d4aaaa2be1..df68d81cfb1 100644
--- a/src/mesa/swrast/s_masking.h
+++ b/src/mesa/swrast/s_masking.h
@@ -1,4 +1,4 @@
-/* $Id: s_masking.h,v 1.4 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_masking.h,v 1.5 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -47,16 +47,6 @@ _mesa_mask_rgba_array( GLcontext *ctx, GLuint n, GLint x, GLint y,
/*
- * Implement glColorMask for an array of RGBA pixels.
- */
-extern void
-_mesa_mask_rgba_pixels( GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLchan rgba[][4], const GLubyte mask[] );
-
-
-
-/*
* Implement glIndexMask for a span of CI pixels.
*/
extern void
@@ -64,24 +54,9 @@ _mesa_mask_index_span( GLcontext *ctx, const struct sw_span *span,
GLuint index[] );
-
-/*
- * Implement glIndexMask for a span of CI pixels.
- */
extern void
_mesa_mask_index_array( GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint index[] );
-
-/*
- * Implement glIndexMask for an array of CI pixels.
- */
-extern void
-_mesa_mask_index_pixels( GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint index[], const GLubyte mask[] );
-
-
-
#endif
diff --git a/src/mesa/swrast/s_points.h b/src/mesa/swrast/s_points.h
index f52b32b76e5..27047f45ba8 100644
--- a/src/mesa/swrast/s_points.h
+++ b/src/mesa/swrast/s_points.h
@@ -1,4 +1,4 @@
-/* $Id: s_points.h,v 1.5 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_points.h,v 1.6 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -30,10 +30,10 @@
#include "mtypes.h"
-void
+extern void
_swrast_choose_point( GLcontext *ctx );
-void
+extern void
_swrast_add_spec_terms_point( GLcontext *ctx,
const SWvertex *v0 );
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 2242a0827d4..736049f7b90 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -1,4 +1,4 @@
-/* $Id: s_span.c,v 1.29 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_span.c,v 1.30 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -45,7 +45,6 @@
#include "s_fog.h"
#include "s_logic.h"
#include "s_masking.h"
-#include "s_scissor.h"
#include "s_span.h"
#include "s_stencil.h"
#include "s_texture.h"
@@ -433,10 +432,19 @@ clip_span( GLcontext *ctx, struct sw_span *span )
const GLint n = span->end;
GLubyte *mask = span->mask;
GLint i;
- /* note: using & intead of && to reduce branches */
- for (i = 0; i < n; i++) {
- mask[i] = (x[i] >= xmin) & (x[i] < xmax)
- & (y[i] >= ymin) & (y[i] < ymax);
+ if (span->arrayMask & SPAN_MASK) {
+ /* note: using & intead of && to reduce branches */
+ for (i = 0; i < n; i++) {
+ mask[i] &= (x[i] >= xmin) & (x[i] < xmax)
+ & (y[i] >= ymin) & (y[i] < ymax);
+ }
+ }
+ else {
+ /* note: using & intead of && to reduce branches */
+ for (i = 0; i < n; i++) {
+ mask[i] = (x[i] >= xmin) & (x[i] < xmax)
+ & (y[i] >= ymin) & (y[i] < ymax);
+ }
}
return GL_TRUE; /* some pixels visible */
}
@@ -640,12 +648,26 @@ _mesa_write_index_span( GLcontext *ctx, struct sw_span *span,
/* Clipping */
if ((swrast->_RasterMask & CLIP_BIT) || (primitive == GL_BITMAP)
- || (primitive == GL_POINT)) {
+ || (primitive == GL_POINT) || (primitive == GL_LINE)) {
if (!clip_span(ctx, span)) {
return;
}
}
+#ifdef DEBUG
+ if (span->arrayMask & SPAN_XY) {
+ int i;
+ for (i = 0; i < span->end; i++) {
+ if (span->mask[i]) {
+ assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin);
+ assert(span->xArray[i] < ctx->DrawBuffer->_Xmax);
+ assert(span->yArray[i] >= ctx->DrawBuffer->_Ymin);
+ assert(span->yArray[i] < ctx->DrawBuffer->_Ymax);
+ }
+ }
+ }
+#endif
+
/* Polygon Stippling */
if (ctx->Polygon.StippleFlag && primitive == GL_POLYGON) {
stipple_polygon_span(ctx, span);
@@ -801,12 +823,26 @@ _mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span,
/* Clipping */
if ((swrast->_RasterMask & CLIP_BIT) || (primitive == GL_BITMAP)
- || (primitive == GL_POINT)) {
+ || (primitive == GL_POINT) || (primitive == GL_LINE)) {
if (!clip_span(ctx, span)) {
return;
}
}
+#ifdef DEBUG
+ if (span->arrayMask & SPAN_XY) {
+ int i;
+ for (i = 0; i < span->end; i++) {
+ if (span->mask[i]) {
+ assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin);
+ assert(span->xArray[i] < ctx->DrawBuffer->_Xmax);
+ assert(span->yArray[i] >= ctx->DrawBuffer->_Ymin);
+ assert(span->yArray[i] < ctx->DrawBuffer->_Ymax);
+ }
+ }
+ }
+#endif
+
/* Polygon Stippling */
if (ctx->Polygon.StippleFlag && primitive == GL_POLYGON) {
stipple_polygon_span(ctx, span);
@@ -1014,12 +1050,26 @@ _mesa_write_texture_span( GLcontext *ctx, struct sw_span *span,
/* Clipping */
if ((swrast->_RasterMask & CLIP_BIT) || (primitive == GL_BITMAP)
- || (primitive == GL_POINT)) {
+ || (primitive == GL_POINT) || (primitive == GL_LINE)) {
if (!clip_span(ctx, span)) {
return;
}
}
+#ifdef DEBUG
+ if (span->arrayMask & SPAN_XY) {
+ int i;
+ for (i = 0; i < span->end; i++) {
+ if (span->mask[i]) {
+ assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin);
+ assert(span->xArray[i] < ctx->DrawBuffer->_Xmax);
+ assert(span->yArray[i] >= ctx->DrawBuffer->_Ymin);
+ assert(span->yArray[i] < ctx->DrawBuffer->_Ymax);
+ }
+ }
+ }
+#endif
+
/* Polygon Stippling */
if (ctx->Polygon.StippleFlag && primitive == GL_POLYGON) {
stipple_polygon_span(ctx, span);
diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c
index 809b1ee94cc..88bc60fb852 100644
--- a/src/mesa/swrast/s_stencil.c
+++ b/src/mesa/swrast/s_stencil.c
@@ -1,4 +1,4 @@
-/* $Id: s_stencil.c,v 1.18 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_stencil.c,v 1.19 2002/02/02 21:40:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -32,7 +32,6 @@
#include "s_context.h"
#include "s_depth.h"
-#include "s_pb.h"
#include "s_stencil.h"
@@ -236,12 +235,12 @@ static GLboolean
do_stencil_test( GLcontext *ctx, GLuint n, GLstencil stencil[],
GLubyte mask[] )
{
- GLubyte fail[PB_SIZE];
+ GLubyte fail[MAX_WIDTH];
GLboolean allfail = GL_FALSE;
GLuint i;
GLstencil r, s;
- ASSERT(n <= PB_SIZE);
+ ASSERT(n <= MAX_WIDTH);
/*
* Perform stencil test. The results of this operation are stored
@@ -420,7 +419,7 @@ stencil_and_ztest_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
GLubyte mask[] )
{
ASSERT(ctx->Stencil.Enabled);
- ASSERT(n <= PB_SIZE);
+ ASSERT(n <= MAX_WIDTH);
/*
* Apply the stencil test to the fragments.
@@ -722,7 +721,7 @@ static GLboolean
stencil_test_pixels( GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[], GLubyte mask[] )
{
- GLubyte fail[PB_SIZE];
+ GLubyte fail[MAX_WIDTH];
GLstencil r, s;
GLuint i;
GLboolean allfail = GL_FALSE;
@@ -910,19 +909,19 @@ stencil_test_pixels( GLcontext *ctx, GLuint n,
* Return: GL_TRUE - all fragments failed the testing
* GL_FALSE - one or more fragments passed the testing
*/
-GLboolean
-_mesa_stencil_and_ztest_pixels( GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLdepth z[], GLubyte mask[] )
+static GLboolean
+stencil_and_ztest_pixels( GLcontext *ctx,
+ GLuint n, const GLint x[], const GLint y[],
+ const GLdepth z[], GLubyte mask[] )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
ASSERT(ctx->Stencil.Enabled);
- ASSERT(n <= PB_SIZE);
+ ASSERT(n <= MAX_WIDTH);
if (swrast->Driver.WriteStencilPixels) {
/*** Hardware stencil buffer ***/
- GLstencil stencil[PB_SIZE];
- GLubyte origMask[PB_SIZE];
+ GLstencil stencil[MAX_WIDTH];
+ GLubyte origMask[MAX_WIDTH];
ASSERT(swrast->Driver.ReadStencilPixels);
(*swrast->Driver.ReadStencilPixels)(ctx, n, x, y, stencil);
@@ -938,7 +937,7 @@ _mesa_stencil_and_ztest_pixels( GLcontext *ctx,
_mesa_depth_test_pixels(ctx, n, x, y, z, mask);
if (ctx->Stencil.ZFailFunc != GL_KEEP) {
- GLubyte failmask[PB_SIZE];
+ GLubyte failmask[MAX_WIDTH];
GLuint i;
for (i = 0; i < n; i++) {
ASSERT(mask[i] == 0 || mask[i] == 1);
@@ -948,7 +947,7 @@ _mesa_stencil_and_ztest_pixels( GLcontext *ctx,
n, stencil, failmask);
}
if (ctx->Stencil.ZPassFunc != GL_KEEP) {
- GLubyte passmask[PB_SIZE];
+ GLubyte passmask[MAX_WIDTH];
GLuint i;
for (i = 0; i < n; i++) {
ASSERT(mask[i] == 0 || mask[i] == 1);
@@ -977,7 +976,7 @@ _mesa_stencil_and_ztest_pixels( GLcontext *ctx,
ctx->Stencil.ZPassFunc, mask);
}
else {
- GLubyte passmask[PB_SIZE], failmask[PB_SIZE], oldmask[PB_SIZE];
+ GLubyte passmask[MAX_WIDTH], failmask[MAX_WIDTH], oldmask[MAX_WIDTH];
GLuint i;
MEMCPY(oldmask, mask, n * sizeof(GLubyte));
@@ -1010,9 +1009,9 @@ GLboolean
_mesa_stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span)
{
if (span->arrayMask & SPAN_XY) {
- return _mesa_stencil_and_ztest_pixels(ctx, span->end,
- span->xArray, span->yArray,
- span->zArray, span->mask);
+ return stencil_and_ztest_pixels(ctx, span->end,
+ span->xArray, span->yArray,
+ span->zArray, span->mask);
}
else {
return stencil_and_ztest_span2(ctx, span);
diff --git a/src/mesa/swrast/s_stencil.h b/src/mesa/swrast/s_stencil.h
index 8c4c3b3d037..3658e9dba69 100644
--- a/src/mesa/swrast/s_stencil.h
+++ b/src/mesa/swrast/s_stencil.h
@@ -1,4 +1,4 @@
-/* $Id: s_stencil.h,v 1.5 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_stencil.h,v 1.6 2002/02/02 21:40:34 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -38,11 +38,6 @@ extern GLboolean
_mesa_stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span);
-extern GLboolean
-_mesa_stencil_and_ztest_pixels( GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- const GLdepth z[], GLubyte mask[] );
-
extern void
_mesa_read_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y,
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index 0ed753e9678..882a6ad1789 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -1,4 +1,4 @@
-/* $Id: s_texture.c,v 1.48 2002/01/28 04:25:56 brianp Exp $ */
+/* $Id: s_texture.c,v 1.49 2002/02/02 21:40:34 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -35,7 +35,6 @@
#include "teximage.h"
#include "s_context.h"
-#include "s_pb.h"
#include "s_texture.h"
@@ -3043,7 +3042,7 @@ _swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, GLuint n,
if (textureUnit->_Current) { /* XXX need this? */
const struct gl_texture_object *curObj = textureUnit->_Current;
- GLchan texel[PB_SIZE][4];
+ GLchan texel[MAX_WIDTH][4];
if (textureUnit->LodBias != 0.0F) {
/* apply LOD bias, but don't clamp yet */
@@ -3096,10 +3095,10 @@ _swrast_multitexture_fragments( GLcontext *ctx, struct sw_span *span )
{
if (ctx->Texture._ReallyEnabled & ~TEXTURE0_ANY) {
/* multitexture */
- GLchan primary_rgba[PB_SIZE][4];
+ GLchan primary_rgba[MAX_WIDTH][4];
GLuint unit;
- ASSERT(span->end < PB_SIZE);
+ ASSERT(span->end < MAX_WIDTH);
/* save copy of the span colors (the GL_PRIMARY_COLOR) */
MEMCPY(primary_rgba, span->color.rgba, 4 * span->end * sizeof(GLchan));