summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_lines.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/swrast/s_lines.c')
-rw-r--r--src/mesa/swrast/s_lines.c493
1 files changed, 251 insertions, 242 deletions
diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c
index 75a01cf12eb..eaf4e8a2faf 100644
--- a/src/mesa/swrast/s_lines.c
+++ b/src/mesa/swrast/s_lines.c
@@ -1,4 +1,4 @@
-/* $Id: s_lines.c,v 1.1 2000/10/31 18:00:04 keithw Exp $ */
+/* $Id: s_lines.c,v 1.2 2000/11/05 18:24:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -26,13 +26,15 @@
#include "glheader.h"
-#include "feedback.h"
#include "macros.h"
#include "mmath.h"
#include "vb.h"
#include "s_pb.h"
+#include "s_context.h"
#include "s_depth.h"
+#include "s_lines.h"
+#include "s_feedback.h"
@@ -53,7 +55,6 @@
/*
* All line drawing functions have the same arguments:
* v1, v2 - indexes of first and second endpoints into vertex buffer arrays
- * pv - provoking vertex: which vertex color/index to use for flat shading.
*/
@@ -70,12 +71,15 @@
/* Flat, color index line */
static void flat_ci_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
- PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
+ struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
+
+ PB_SET_INDEX( PB, vert0->index );
#define INTERP_XY 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0, 0);
+#define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, 0, 0);
#include "s_linetemp.h"
@@ -86,13 +90,15 @@ static void flat_ci_line( GLcontext *ctx,
/* Flat, color index line with Z interpolation/testing */
static void flat_ci_z_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
- PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
+ struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
+ PB_SET_INDEX( PB, vert0->index );
#define INTERP_XY 1
#define INTERP_Z 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0);
+#define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
#include "s_linetemp.h"
@@ -103,13 +109,15 @@ static void flat_ci_z_line( GLcontext *ctx,
/* Flat-shaded, RGBA line */
static void flat_rgba_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
- const GLchan *color = ctx->VB->ColorPtr->data[pvert];
- PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
+ const GLchan *color = vert0->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 PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0, 0);
+#define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, 0, 0);
#include "s_linetemp.h"
@@ -120,14 +128,16 @@ static void flat_rgba_line( GLcontext *ctx,
/* Flat-shaded, RGBA line with Z interpolation/testing */
static void flat_rgba_z_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
- const GLchan *color = ctx->VB->ColorPtr->data[pvert];
- PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
+ const GLchan *color = vert0->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 PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0);
+#define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
#include "s_linetemp.h"
@@ -138,15 +148,16 @@ static void flat_rgba_z_line( GLcontext *ctx,
/* Smooth shaded, color index line */
static void smooth_ci_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
- GLint count = ctx->PB->count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLuint *pbi = ctx->PB->index;
- (void) pvert;
+ struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
+ GLint count = PB->count;
+ GLint *pbx = PB->x;
+ GLint *pby = PB->y;
+ GLuint *pbi = PB->index;
- ctx->PB->mono = GL_FALSE;
+ PB->mono = GL_FALSE;
#define INTERP_XY 1
#define INTERP_INDEX 1
@@ -159,7 +170,7 @@ static void smooth_ci_line( GLcontext *ctx,
#include "s_linetemp.h"
- ctx->PB->count = count;
+ PB->count = count;
gl_flush_pb(ctx);
}
@@ -167,16 +178,17 @@ static void smooth_ci_line( GLcontext *ctx,
/* Smooth shaded, color index line with Z interpolation/testing */
static void smooth_ci_z_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
- GLint count = ctx->PB->count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLdepth *pbz = ctx->PB->z;
- GLuint *pbi = ctx->PB->index;
- (void) pvert;
+ 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;
- ctx->PB->mono = GL_FALSE;
+ PB->mono = GL_FALSE;
#define INTERP_XY 1
#define INTERP_Z 1
@@ -191,7 +203,7 @@ static void smooth_ci_z_line( GLcontext *ctx,
#include "s_linetemp.h"
- ctx->PB->count = count;
+ PB->count = count;
gl_flush_pb(ctx);
}
@@ -199,15 +211,16 @@ static void smooth_ci_z_line( GLcontext *ctx,
/* Smooth-shaded, RGBA line */
static void smooth_rgba_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
- GLint count = ctx->PB->count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLchan (*pbrgba)[4] = ctx->PB->rgba;
- (void) pvert;
+ 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;
- ctx->PB->mono = GL_FALSE;
+ PB->mono = GL_FALSE;
#define INTERP_XY 1
#define INTERP_RGB 1
@@ -224,7 +237,7 @@ static void smooth_rgba_line( GLcontext *ctx,
#include "s_linetemp.h"
- ctx->PB->count = count;
+ PB->count = count;
gl_flush_pb(ctx);
}
@@ -232,18 +245,19 @@ static void smooth_rgba_line( GLcontext *ctx,
/* Smooth-shaded, RGBA line with Z interpolation/testing */
static void smooth_rgba_z_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
- GLint count = ctx->PB->count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLdepth *pbz = ctx->PB->z;
- GLfixed *pbfog = ctx->PB->fog;
- GLchan (*pbrgba)[4] = ctx->PB->rgba;
+ struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
+ GLint count = PB->count;
+ GLint *pbx = PB->x;
+ GLint *pby = PB->y;
+ GLdepth *pbz = PB->z;
+ GLfixed *pbfog = PB->fog;
+ GLchan (*pbrgba)[4] = PB->rgba;
- (void) pvert;
- ctx->PB->mono = GL_FALSE;
+ PB->mono = GL_FALSE;
#define INTERP_XY 1
#define INTERP_Z 1
@@ -263,33 +277,34 @@ static void smooth_rgba_z_line( GLcontext *ctx,
#include "s_linetemp.h"
- ctx->PB->count = count;
+ PB->count = count;
gl_flush_pb(ctx);
}
#define CHECK_FULL(count) \
if (count >= PB_SIZE-MAX_WIDTH) { \
- ctx->PB->count = count; \
+ PB->count = count; \
gl_flush_pb(ctx); \
- count = ctx->PB->count; \
+ count = PB->count; \
}
/* Smooth shaded, color index, any width, maybe stippled */
static void general_smooth_ci_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
- GLint count = ctx->PB->count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLdepth *pbz = ctx->PB->z;
- GLfixed *pbfog = ctx->PB->fog;
- GLuint *pbi = ctx->PB->index;
- (void) pvert;
+ struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
+ GLint count = PB->count;
+ GLint *pbx = PB->x;
+ GLint *pby = PB->y;
+ GLdepth *pbz = PB->z;
+ GLfixed *pbfog = PB->fog;
+ GLuint *pbi = PB->index;
- ctx->PB->mono = GL_FALSE;
+ PB->mono = GL_FALSE;
if (ctx->Line.StippleFlag) {
/* stippled */
@@ -351,22 +366,24 @@ static void general_smooth_ci_line( GLcontext *ctx,
}
}
- ctx->PB->count = count;
+ PB->count = count;
gl_flush_pb(ctx);
}
/* Flat shaded, color index, any width, maybe stippled */
static void general_flat_ci_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
+ struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLdepth *pbz = ctx->PB->z;
- GLfixed *pbfog = ctx->PB->fog;
- PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
- count = ctx->PB->count;
+ GLint *pbx = PB->x;
+ GLint *pby = PB->y;
+ GLdepth *pbz = PB->z;
+ GLfixed *pbfog = PB->fog;
+ PB_SET_INDEX( PB, vert0->index );
+ count = PB->count;
if (ctx->Line.StippleFlag) {
/* stippled, any width */
@@ -421,25 +438,25 @@ static void general_flat_ci_line( GLcontext *ctx,
}
}
- ctx->PB->count = count;
+ PB->count = count;
gl_flush_pb(ctx);
}
static void general_smooth_rgba_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert)
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
- GLint count = ctx->PB->count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLdepth *pbz = ctx->PB->z;
- GLfixed *pbfog = ctx->PB->fog;
- GLchan (*pbrgba)[4] = ctx->PB->rgba;
-
- (void) pvert;
+ struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
+ GLint count = PB->count;
+ GLint *pbx = PB->x;
+ GLint *pby = PB->y;
+ GLdepth *pbz = PB->z;
+ GLfixed *pbfog = PB->fog;
+ GLchan (*pbrgba)[4] = PB->rgba;
- ctx->PB->mono = GL_FALSE;
+ PB->mono = GL_FALSE;
if (ctx->Line.StippleFlag) {
/* stippled */
@@ -524,16 +541,18 @@ static void general_smooth_rgba_line( GLcontext *ctx,
}
}
- ctx->PB->count = count;
+ PB->count = count;
gl_flush_pb(ctx);
}
static void general_flat_rgba_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
- const GLchan *color = ctx->VB->ColorPtr->data[pvert];
- PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
+ struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
+ const GLchan *color = vert0->color;
+ PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] );
if (ctx->Line.StippleFlag) {
/* stippled */
@@ -541,7 +560,7 @@ static void general_flat_rgba_line( GLcontext *ctx,
#define INTERP_Z 1
#define WIDE 1
#define STIPPLE 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0);
+#define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
#include "s_linetemp.h"
}
else {
@@ -550,10 +569,10 @@ static void general_flat_rgba_line( GLcontext *ctx,
/* special case: unstippled and width=2 */
#define INTERP_XY 1
#define INTERP_Z 1
-#define XMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0); \
- PB_WRITE_PIXEL(ctx->PB, X, Y+1, Z, fog0);
-#define YMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0); \
- PB_WRITE_PIXEL(ctx->PB, X+1, Y, Z, fog0);
+#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 {
@@ -561,7 +580,7 @@ static void general_flat_rgba_line( GLcontext *ctx,
#define INTERP_XY 1
#define INTERP_Z 1
#define WIDE 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0);
+#define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
#include "s_linetemp.h"
}
}
@@ -572,19 +591,21 @@ static void general_flat_rgba_line( GLcontext *ctx,
/* Flat-shaded, textured, any width, maybe stippled */
static void flat_textured_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pv )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
+ struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLdepth *pbz = ctx->PB->z;
- GLfixed *pbfog = ctx->PB->fog;
- GLfloat *pbs = ctx->PB->s[0];
- GLfloat *pbt = ctx->PB->t[0];
- GLfloat *pbu = ctx->PB->u[0];
- GLchan *color = ctx->VB->ColorPtr->data[pv];
- PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
- count = ctx->PB->count;
+ GLint *pbx = PB->x;
+ GLint *pby = PB->y;
+ GLdepth *pbz = PB->z;
+ GLfixed *pbfog = PB->fog;
+ GLfloat *pbs = PB->s[0];
+ GLfloat *pbt = PB->t[0];
+ GLfloat *pbu = PB->u[0];
+ GLchan *color = vert0->color;
+ PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] );
+ count = PB->count;
if (ctx->Line.StippleFlag) {
/* stippled */
@@ -628,7 +649,7 @@ static void flat_textured_line( GLcontext *ctx,
#include "s_linetemp.h"
}
- ctx->PB->count = count;
+ PB->count = count;
gl_flush_pb(ctx);
}
@@ -636,20 +657,21 @@ static void flat_textured_line( GLcontext *ctx,
/* Smooth-shaded, textured, any width, maybe stippled */
static void smooth_textured_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
- GLint count = ctx->PB->count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLdepth *pbz = ctx->PB->z;
- GLfixed *pbfog = ctx->PB->fog;
- GLfloat *pbs = ctx->PB->s[0];
- GLfloat *pbt = ctx->PB->t[0];
- GLfloat *pbu = ctx->PB->u[0];
- GLchan (*pbrgba)[4] = ctx->PB->rgba;
- (void) pvert;
-
- ctx->PB->mono = GL_FALSE;
+ struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
+ GLint count = PB->count;
+ GLint *pbx = PB->x;
+ GLint *pby = PB->y;
+ GLdepth *pbz = PB->z;
+ GLfixed *pbfog = PB->fog;
+ GLfloat *pbs = PB->s[0];
+ GLfloat *pbt = PB->t[0];
+ GLfloat *pbu = PB->u[0];
+ GLchan (*pbrgba)[4] = PB->rgba;
+
+ PB->mono = GL_FALSE;
if (ctx->Line.StippleFlag) {
/* stippled */
@@ -705,7 +727,7 @@ static void smooth_textured_line( GLcontext *ctx,
#include "s_linetemp.h"
}
- ctx->PB->count = count;
+ PB->count = count;
gl_flush_pb(ctx);
}
@@ -714,19 +736,19 @@ static void smooth_textured_line( GLcontext *ctx,
* color interpolation.
*/
static void smooth_multitextured_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
- GLint count = ctx->PB->count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLdepth *pbz = ctx->PB->z;
- GLfixed *pbfog = ctx->PB->fog;
- GLchan (*pbrgba)[4] = ctx->PB->rgba;
- GLchan (*pbspec)[3] = ctx->PB->spec;
+ struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
+ GLint count = PB->count;
+ GLint *pbx = PB->x;
+ GLint *pby = PB->y;
+ GLdepth *pbz = PB->z;
+ GLfixed *pbfog = PB->fog;
+ GLchan (*pbrgba)[4] = PB->rgba;
+ GLchan (*pbspec)[3] = PB->spec;
- (void) pvert;
-
- ctx->PB->mono = GL_FALSE;
+ PB->mono = GL_FALSE;
if (ctx->Line.StippleFlag) {
/* stippled */
@@ -753,11 +775,11 @@ static void smooth_multitextured_line( GLcontext *ctx,
pbspec[count][GCOMP] = FixedToInt(sg0); \
pbspec[count][BCOMP] = FixedToInt(sb0); \
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
- if (ctx->Texture.Unit[u].ReallyEnabled) { \
- ctx->PB->s[u][0] = fragTexcoord[u][0]; \
- ctx->PB->s[u][1] = fragTexcoord[u][1]; \
- ctx->PB->s[u][2] = fragTexcoord[u][2]; \
- ctx->PB->s[u][3] = fragTexcoord[u][3]; \
+ if (ctx->Texture.Unit[u]._ReallyEnabled) { \
+ PB->s[u][0] = fragTexcoord[u][0]; \
+ PB->s[u][1] = fragTexcoord[u][1]; \
+ PB->s[u][2] = fragTexcoord[u][2]; \
+ PB->s[u][3] = fragTexcoord[u][3]; \
} \
} \
count++; \
@@ -789,11 +811,11 @@ static void smooth_multitextured_line( GLcontext *ctx,
pbspec[count][GCOMP] = FixedToInt(sg0); \
pbspec[count][BCOMP] = FixedToInt(sb0); \
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
- if (ctx->Texture.Unit[u].ReallyEnabled) { \
- ctx->PB->s[u][0] = fragTexcoord[u][0]; \
- ctx->PB->s[u][1] = fragTexcoord[u][1]; \
- ctx->PB->s[u][2] = fragTexcoord[u][2]; \
- ctx->PB->s[u][3] = fragTexcoord[u][3]; \
+ if (ctx->Texture.Unit[u]._ReallyEnabled) { \
+ PB->s[u][0] = fragTexcoord[u][0]; \
+ PB->s[u][1] = fragTexcoord[u][1]; \
+ PB->s[u][2] = fragTexcoord[u][2]; \
+ PB->s[u][3] = fragTexcoord[u][3]; \
} \
} \
count++; \
@@ -802,7 +824,7 @@ static void smooth_multitextured_line( GLcontext *ctx,
#include "s_linetemp.h"
}
- ctx->PB->count = count;
+ PB->count = count;
gl_flush_pb(ctx);
}
@@ -811,23 +833,23 @@ static void smooth_multitextured_line( GLcontext *ctx,
* color interpolation.
*/
static void flat_multitextured_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
- GLint count = ctx->PB->count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLdepth *pbz = ctx->PB->z;
- GLfixed *pbfog = ctx->PB->fog;
- GLchan (*pbrgba)[4] = ctx->PB->rgba;
- GLchan (*pbspec)[3] = ctx->PB->spec;
- GLchan *color = ctx->VB->ColorPtr->data[pvert];
- GLchan sRed = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][0] : 0;
- GLchan sGreen = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][1] : 0;
- GLchan sBlue = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][2] : 0;
-
- (void) pvert;
-
- ctx->PB->mono = GL_FALSE;
+ struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
+ GLint count = PB->count;
+ GLint *pbx = PB->x;
+ GLint *pby = PB->y;
+ GLdepth *pbz = PB->z;
+ GLfixed *pbfog = PB->fog;
+ GLchan (*pbrgba)[4] = PB->rgba;
+ GLchan (*pbspec)[3] = PB->spec;
+ GLchan *color = vert0->color;
+ GLchan sRed = vert0->specular[0];
+ GLchan sGreen = vert0->specular[1];
+ GLchan sBlue = vert0->specular[2];
+
+ PB->mono = GL_FALSE;
if (ctx->Line.StippleFlag) {
/* stippled */
@@ -852,11 +874,11 @@ static void flat_multitextured_line( GLcontext *ctx,
pbspec[count][GCOMP] = sGreen; \
pbspec[count][BCOMP] = sBlue; \
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
- if (ctx->Texture.Unit[u].ReallyEnabled) { \
- ctx->PB->s[u][0] = fragTexcoord[u][0]; \
- ctx->PB->s[u][1] = fragTexcoord[u][1]; \
- ctx->PB->s[u][2] = fragTexcoord[u][2]; \
- ctx->PB->s[u][3] = fragTexcoord[u][3]; \
+ if (ctx->Texture.Unit[u]._ReallyEnabled) { \
+ PB->s[u][0] = fragTexcoord[u][0]; \
+ PB->s[u][1] = fragTexcoord[u][1]; \
+ PB->s[u][2] = fragTexcoord[u][2]; \
+ PB->s[u][3] = fragTexcoord[u][3]; \
} \
} \
count++; \
@@ -886,11 +908,11 @@ static void flat_multitextured_line( GLcontext *ctx,
pbspec[count][GCOMP] = sGreen; \
pbspec[count][BCOMP] = sBlue; \
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
- if (ctx->Texture.Unit[u].ReallyEnabled) { \
- ctx->PB->s[u][0] = fragTexcoord[u][0]; \
- ctx->PB->s[u][1] = fragTexcoord[u][1]; \
- ctx->PB->s[u][2] = fragTexcoord[u][2]; \
- ctx->PB->s[u][3] = fragTexcoord[u][3]; \
+ if (ctx->Texture.Unit[u]._ReallyEnabled) { \
+ PB->s[u][0] = fragTexcoord[u][0]; \
+ PB->s[u][1] = fragTexcoord[u][1]; \
+ PB->s[u][2] = fragTexcoord[u][2]; \
+ PB->s[u][3] = fragTexcoord[u][3]; \
} \
} \
count++; \
@@ -899,7 +921,7 @@ static void flat_multitextured_line( GLcontext *ctx,
#include "s_linetemp.h"
}
- ctx->PB->count = count;
+ PB->count = count;
gl_flush_pb(ctx);
}
@@ -914,7 +936,8 @@ static void flat_multitextured_line( GLcontext *ctx,
* to the specification.
*/
static void aa_rgba_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
#define INTERP_RGBA 1
#define PLOT(x, y) \
@@ -933,7 +956,8 @@ static void aa_rgba_line( GLcontext *ctx,
* to the specification.
*/
static void aa_tex_rgba_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
#define INTERP_RGBA 1
#define INTERP_TEX 1
@@ -955,7 +979,8 @@ static void aa_tex_rgba_line( GLcontext *ctx,
* to the specification.
*/
static void aa_multitex_rgba_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
#define INTERP_RGBA 1
#define INTERP_SPEC 1
@@ -974,7 +999,8 @@ static void aa_multitex_rgba_line( GLcontext *ctx,
* Antialiased CI line. Same comments for RGBA antialiased lines apply.
*/
static void aa_ci_line( GLcontext *ctx,
- GLuint vert0, GLuint vert1, GLuint pvert )
+ SWvertex *vert0,
+ SWvertex *vert1 )
{
#define INTERP_INDEX 1
#define PLOT(x, y) \
@@ -985,68 +1011,56 @@ static void aa_ci_line( GLcontext *ctx,
}
-/*
- * Null rasterizer for measuring transformation speed.
- */
-static void null_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv )
-{
- (void) ctx;
- (void) v1;
- (void) v2;
- (void) pv;
-}
-
-
#ifdef DEBUG
void
_mesa_print_line_function(GLcontext *ctx)
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
printf("Line Func == ");
- if (ctx->Driver.LineFunc == flat_ci_line)
+ if (swrast->Line == flat_ci_line)
printf("flat_ci_line\n");
- else if (ctx->Driver.LineFunc == flat_ci_z_line)
+ else if (swrast->Line == flat_ci_z_line)
printf("flat_ci_z_line\n");
- else if (ctx->Driver.LineFunc == flat_rgba_line)
+ else if (swrast->Line == flat_rgba_line)
printf("flat_rgba_line\n");
- else if (ctx->Driver.LineFunc == flat_rgba_z_line)
+ else if (swrast->Line == flat_rgba_z_line)
printf("flat_rgba_z_line\n");
- else if (ctx->Driver.LineFunc == smooth_ci_line)
+ else if (swrast->Line == smooth_ci_line)
printf("smooth_ci_line\n");
- else if (ctx->Driver.LineFunc == smooth_ci_z_line)
+ else if (swrast->Line == smooth_ci_z_line)
printf("smooth_ci_z_line\n");
- else if (ctx->Driver.LineFunc == smooth_rgba_line)
+ else if (swrast->Line == smooth_rgba_line)
printf("smooth_rgba_line\n");
- else if (ctx->Driver.LineFunc == smooth_rgba_z_line)
+ else if (swrast->Line == smooth_rgba_z_line)
printf("smooth_rgba_z_line\n");
- else if (ctx->Driver.LineFunc == general_smooth_ci_line)
+ else if (swrast->Line == general_smooth_ci_line)
printf("general_smooth_ci_line\n");
- else if (ctx->Driver.LineFunc == general_flat_ci_line)
+ else if (swrast->Line == general_flat_ci_line)
printf("general_flat_ci_line\n");
- else if (ctx->Driver.LineFunc == general_smooth_rgba_line)
+ else if (swrast->Line == general_smooth_rgba_line)
printf("general_smooth_rgba_line\n");
- else if (ctx->Driver.LineFunc == general_flat_rgba_line)
+ else if (swrast->Line == general_flat_rgba_line)
printf("general_flat_rgba_line\n");
- else if (ctx->Driver.LineFunc == flat_textured_line)
+ else if (swrast->Line == flat_textured_line)
printf("flat_textured_line\n");
- else if (ctx->Driver.LineFunc == smooth_textured_line)
+ else if (swrast->Line == smooth_textured_line)
printf("smooth_textured_line\n");
- else if (ctx->Driver.LineFunc == smooth_multitextured_line)
+ else if (swrast->Line == smooth_multitextured_line)
printf("smooth_multitextured_line\n");
- else if (ctx->Driver.LineFunc == flat_multitextured_line)
+ else if (swrast->Line == flat_multitextured_line)
printf("flat_multitextured_line\n");
- else if (ctx->Driver.LineFunc == aa_rgba_line)
+ else if (swrast->Line == aa_rgba_line)
printf("aa_rgba_line\n");
- else if (ctx->Driver.LineFunc == aa_tex_rgba_line)
+ else if (swrast->Line == aa_tex_rgba_line)
printf("aa_tex_rgba_line\n");
- else if (ctx->Driver.LineFunc == aa_multitex_rgba_line)
+ else if (swrast->Line == aa_multitex_rgba_line)
printf("aa_multitex_rgba_line\n");
- else if (ctx->Driver.LineFunc == aa_ci_line)
+ else if (swrast->Line == aa_ci_line)
printf("aa_ci_line\n");
- else if (ctx->Driver.LineFunc == null_line)
- printf("null_line\n");
else
- printf("Driver func %p\n", ctx->Driver.LineFunc);
+ printf("Driver func %p\n", swrast->Line);
}
#endif
@@ -1060,56 +1074,49 @@ _mesa_print_line_function(GLcontext *ctx)
* tests to this code.
*/
void
-_swrast_set_line_function( GLcontext *ctx )
+_swrast_choose_line( GLcontext *ctx )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
GLboolean rgbmode = ctx->Visual.RGBAflag;
/* TODO: antialiased lines */
if (ctx->RenderMode==GL_RENDER) {
- if (ctx->NoRaster) {
- ctx->Driver.LineFunc = null_line;
- return;
- }
- if (ctx->Driver.LineFunc) {
- /* Device driver will draw lines. */
- return;
- }
-
if (ctx->Line.SmoothFlag) {
/* antialiased lines */
if (rgbmode) {
- if (ctx->Texture.ReallyEnabled) {
- if (ctx->Texture.MultiTextureEnabled
+ if (ctx->Texture._ReallyEnabled) {
+ if (ctx->Texture._MultiTextureEnabled
|| ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR
|| ctx->Fog.ColorSumEnabled)
/* Multitextured! */
- ctx->Driver.LineFunc = aa_multitex_rgba_line;
+ swrast->Line = aa_multitex_rgba_line;
else
- ctx->Driver.LineFunc = aa_tex_rgba_line;
+ swrast->Line = aa_tex_rgba_line;
} else {
- ctx->Driver.LineFunc = aa_rgba_line;
+ swrast->Line = aa_rgba_line;
}
}
else {
- ctx->Driver.LineFunc = aa_ci_line;
+ swrast->Line = aa_ci_line;
}
}
- else if (ctx->Texture.ReallyEnabled) {
- if (ctx->Texture.MultiTextureEnabled
+ else if (ctx->Texture._ReallyEnabled) {
+ if (ctx->Texture._MultiTextureEnabled
|| ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR
|| ctx->Fog.ColorSumEnabled) {
/* multi-texture and/or separate specular color */
if (ctx->Light.ShadeModel==GL_SMOOTH)
- ctx->Driver.LineFunc = smooth_multitextured_line;
+ swrast->Line = smooth_multitextured_line;
else
- ctx->Driver.LineFunc = flat_multitextured_line;
+ swrast->Line = flat_multitextured_line;
}
else {
if (ctx->Light.ShadeModel==GL_SMOOTH) {
- ctx->Driver.LineFunc = smooth_textured_line;
+ swrast->Line = smooth_textured_line;
}
else {
- ctx->Driver.LineFunc = flat_textured_line;
+ swrast->Line = flat_textured_line;
}
}
}
@@ -1117,15 +1124,15 @@ _swrast_set_line_function( GLcontext *ctx )
|| ctx->Line.SmoothFlag) {
if (ctx->Light.ShadeModel==GL_SMOOTH) {
if (rgbmode)
- ctx->Driver.LineFunc = general_smooth_rgba_line;
+ swrast->Line = general_smooth_rgba_line;
else
- ctx->Driver.LineFunc = general_smooth_ci_line;
+ swrast->Line = general_smooth_ci_line;
}
else {
if (rgbmode)
- ctx->Driver.LineFunc = general_flat_rgba_line;
+ swrast->Line = general_flat_rgba_line;
else
- ctx->Driver.LineFunc = general_flat_ci_line;
+ swrast->Line = general_flat_ci_line;
}
}
else {
@@ -1133,41 +1140,43 @@ _swrast_set_line_function( GLcontext *ctx )
/* Width==1, non-stippled, smooth-shaded */
if (ctx->Depth.Test || ctx->Fog.Enabled) {
if (rgbmode)
- ctx->Driver.LineFunc = smooth_rgba_z_line;
+ swrast->Line = smooth_rgba_z_line;
else
- ctx->Driver.LineFunc = smooth_ci_z_line;
+ swrast->Line = smooth_ci_z_line;
}
else {
if (rgbmode)
- ctx->Driver.LineFunc = smooth_rgba_line;
+ swrast->Line = smooth_rgba_line;
else
- ctx->Driver.LineFunc = smooth_ci_line;
+ swrast->Line = smooth_ci_line;
}
}
else {
/* Width==1, non-stippled, flat-shaded */
if (ctx->Depth.Test || ctx->Fog.Enabled) {
if (rgbmode)
- ctx->Driver.LineFunc = flat_rgba_z_line;
+ swrast->Line = flat_rgba_z_line;
else
- ctx->Driver.LineFunc = flat_ci_z_line;
+ swrast->Line = flat_ci_z_line;
}
else {
if (rgbmode)
- ctx->Driver.LineFunc = flat_rgba_line;
+ swrast->Line = flat_rgba_line;
else
- ctx->Driver.LineFunc = flat_ci_line;
+ swrast->Line = flat_ci_line;
}
}
}
}
else if (ctx->RenderMode==GL_FEEDBACK) {
- ctx->Driver.LineFunc = gl_feedback_line;
+ swrast->Line = gl_feedback_line;
}
else {
/* GL_SELECT mode */
- ctx->Driver.LineFunc = gl_select_line;
+ swrast->Line = gl_select_line;
}
/*_mesa_print_line_function(ctx);*/
}
+
+