summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2001-01-05 02:26:48 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2001-01-05 02:26:48 +0000
commit58e991705392a2e17a1c8b034f4083a0adaf1943 (patch)
tree828804ca2671809e92a10642030ecd2d21a27b6d /src/mesa/swrast
parentf22c04cdaec47dfef1068af0e90822062478631b (diff)
downloadexternal_mesa3d-58e991705392a2e17a1c8b034f4083a0adaf1943.zip
external_mesa3d-58e991705392a2e17a1c8b034f4083a0adaf1943.tar.gz
external_mesa3d-58e991705392a2e17a1c8b034f4083a0adaf1943.tar.bz2
Remove 'pv' parameter from Line/Tri/Point funcs. The provoking vertex
is always the last vertex parameter. Modify clipping to preserve pv colors. Modify swrast and X11 driver to expect the pv in the last vertex (was looking in the first vertex previously). Remove all handling of flatshading from swrast_setup. Allow drivers to override the unclipped render tabs in tnl_render_stage directly. (Like in 3.4). Removed fxsimplerender stage. Modified t_vb_rendertmp.h to remove the need for 'parity' arguments in RENDER_TRI macros.
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_aalinetemp.h18
-rw-r--r--src/mesa/swrast/s_aatritemp.h20
-rw-r--r--src/mesa/swrast/s_feedback.c12
-rw-r--r--src/mesa/swrast/s_triangle.c56
-rw-r--r--src/mesa/swrast/swrast.h4
5 files changed, 60 insertions, 50 deletions
diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h
index d16fe2c..f36c1f4 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.3 2001/01/04 15:32:32 brianp Exp $ */
+/* $Id: s_aalinetemp.h,v 1.4 2001/01/05 02:26:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -195,10 +195,10 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
v0->color[ACOMP], v1->color[ACOMP], line.aPlane);
}
else {
- constant_plane(v0->color[RCOMP], line.rPlane);
- constant_plane(v0->color[GCOMP], line.gPlane);
- constant_plane(v0->color[BCOMP], line.bPlane);
- constant_plane(v0->color[ACOMP], line.aPlane);
+ constant_plane(v1->color[RCOMP], line.rPlane);
+ constant_plane(v1->color[GCOMP], line.gPlane);
+ constant_plane(v1->color[BCOMP], line.bPlane);
+ constant_plane(v1->color[ACOMP], line.aPlane);
}
#endif
#ifdef DO_SPEC
@@ -211,9 +211,9 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
v0->specular[BCOMP], v1->specular[BCOMP], line.sbPlane);
}
else {
- constant_plane(v0->specular[RCOMP], line.srPlane);
- constant_plane(v0->specular[GCOMP], line.sgPlane);
- constant_plane(v0->specular[BCOMP], line.sbPlane);
+ constant_plane(v1->specular[RCOMP], line.srPlane);
+ constant_plane(v1->specular[GCOMP], line.sgPlane);
+ constant_plane(v1->specular[BCOMP], line.sbPlane);
}
#endif
#ifdef DO_INDEX
@@ -222,7 +222,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
v0->index, v1->index, line.iPlane);
}
else {
- constant_plane(v0->index, line.iPlane);
+ constant_plane(v1->index, line.iPlane);
}
#endif
#ifdef DO_TEX
diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h
index 247c7ac..c50680c 100644
--- a/src/mesa/swrast/s_aatritemp.h
+++ b/src/mesa/swrast/s_aatritemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_aatritemp.h,v 1.4 2000/11/19 23:10:26 brianp Exp $ */
+/* $Id: s_aatritemp.h,v 1.5 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -151,10 +151,10 @@
compute_plane(p0, p1, p2, v0->color[3], v1->color[3], v2->color[3], aPlane);
}
else {
- constant_plane(v0->color[RCOMP], rPlane);
- constant_plane(v0->color[GCOMP], gPlane);
- constant_plane(v0->color[BCOMP], bPlane);
- constant_plane(v0->color[ACOMP], aPlane);
+ constant_plane(v2->color[RCOMP], rPlane);
+ constant_plane(v2->color[GCOMP], gPlane);
+ constant_plane(v2->color[BCOMP], bPlane);
+ constant_plane(v2->color[ACOMP], aPlane);
}
#endif
#ifdef DO_INDEX
@@ -163,15 +163,21 @@
v1->index, v2->index, iPlane);
}
else {
- constant_plane(v0->index, iPlane);
+ constant_plane(v2->index, iPlane);
}
#endif
#ifdef DO_SPEC
- {
+ if (ctx->Light.ShadeModel == GL_SMOOTH) {
compute_plane(p0, p1, p2, v0->specular[0], v1->specular[0], v2->specular[0],srPlane);
compute_plane(p0, p1, p2, v0->specular[1], v1->specular[1], v2->specular[1],sgPlane);
compute_plane(p0, p1, p2, v0->specular[2], v1->specular[2], v2->specular[2],sbPlane);
}
+ else {
+ /* KW: added this */
+ constant_plane(v2->specular[RCOMP], srPlane);
+ constant_plane(v2->specular[GCOMP], sgPlane);
+ constant_plane(v2->specular[BCOMP], sbPlane);
+ }
#endif
#ifdef DO_TEX
{
diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c
index a635569..c63e11d 100644
--- a/src/mesa/swrast/s_feedback.c
+++ b/src/mesa/swrast/s_feedback.c
@@ -1,4 +1,4 @@
-/* $Id: s_feedback.c,v 1.3 2000/11/19 23:10:26 brianp Exp $ */
+/* $Id: s_feedback.c,v 1.4 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -100,9 +100,9 @@ void gl_feedback_triangle( GLcontext *ctx,
feedback_vertex( ctx, v1, v1 );
feedback_vertex( ctx, v2, v2 );
} else {
- feedback_vertex( ctx, v0, v0 );
- feedback_vertex( ctx, v1, v0 );
- feedback_vertex( ctx, v2, v0 );
+ feedback_vertex( ctx, v0, v2 );
+ feedback_vertex( ctx, v1, v2 );
+ feedback_vertex( ctx, v2, v2 );
}
}
}
@@ -122,8 +122,8 @@ void gl_feedback_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
feedback_vertex( ctx, v0, v0 );
feedback_vertex( ctx, v1, v1 );
} else {
- feedback_vertex( ctx, v0, v0 );
- feedback_vertex( ctx, v1, v0 );
+ feedback_vertex( ctx, v0, v1 );
+ feedback_vertex( ctx, v1, v1 );
}
swrast->StippleCounter++;
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index 6c232cb..b61d440 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -1,4 +1,4 @@
-/* $Id: s_triangle.c,v 1.7 2000/12/12 00:31:45 brianp Exp $ */
+/* $Id: s_triangle.c,v 1.8 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -160,7 +160,7 @@ static void flat_rgba_triangle( GLcontext *ctx,
fffog += fdfogdx; \
} \
gl_write_monocolor_span( ctx, n, LEFT, Y, zspan, \
- fogspan, v0->color, \
+ fogspan, v2->color, \
GL_POLYGON ); \
} \
}
@@ -1613,10 +1613,10 @@ static void general_textured_triangle( GLcontext *ctx,
GLboolean flat_shade = (ctx->Light.ShadeModel==GL_FLAT); \
GLint r, g, b, a; \
if (flat_shade) { \
- r = v0->color[0]; \
- g = v0->color[1]; \
- b = v0->color[2]; \
- a = v0->color[3]; \
+ r = v2->color[0]; \
+ g = v2->color[1]; \
+ b = v2->color[2]; \
+ a = v2->color[3]; \
}
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
@@ -1708,13 +1708,13 @@ static void general_textured_spec_triangle1( GLcontext *ctx,
GLboolean flat_shade = (ctx->Light.ShadeModel==GL_FLAT); \
GLint r, g, b, a, sr, sg, sb; \
if (flat_shade) { \
- r = v0->color[0]; \
- g = v0->color[1]; \
- b = v0->color[2]; \
- a = v0->color[3]; \
- sr = v0->specular[0]; \
- sg = v0->specular[1]; \
- sb = v0->specular[2]; \
+ r = v2->color[0]; \
+ g = v2->color[1]; \
+ b = v2->color[2]; \
+ a = v2->color[3]; \
+ sr = v2->specular[0]; \
+ sg = v2->specular[1]; \
+ sb = v2->specular[2]; \
}
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
@@ -1837,10 +1837,10 @@ static void lambda_textured_triangle1( GLcontext *ctx,
const GLboolean flat_shade = (ctx->Light.ShadeModel==GL_FLAT); \
GLint r, g, b, a; \
if (flat_shade) { \
- r = v0->color[0]; \
- g = v0->color[1]; \
- b = v0->color[2]; \
- a = v0->color[3]; \
+ r = v2->color[0]; \
+ g = v2->color[1]; \
+ b = v2->color[2]; \
+ a = v2->color[3]; \
}
#define INNER_LOOP( LEFT, RIGHT, Y ) \
@@ -1942,13 +1942,13 @@ static void lambda_textured_spec_triangle1( GLcontext *ctx,
const GLboolean flat_shade = (ctx->Light.ShadeModel==GL_FLAT); \
GLint r, g, b, a, sr, sg, sb; \
if (flat_shade) { \
- r = v0->color[0]; \
- g = v0->color[1]; \
- b = v0->color[2]; \
- a = v0->color[3]; \
- sr = v0->specular[0]; \
- sg = v0->specular[1]; \
- sb = v0->specular[2]; \
+ r = v2->color[0]; \
+ g = v2->color[1]; \
+ b = v2->color[2]; \
+ a = v2->color[3]; \
+ sr = v2->specular[0]; \
+ sg = v2->specular[1]; \
+ sb = v2->specular[2]; \
}
#define INNER_LOOP( LEFT, RIGHT, Y ) \
@@ -2055,10 +2055,10 @@ lambda_multitextured_triangle1( GLcontext *ctx,
GLfloat twidth[MAX_TEXTURE_UNITS], theight[MAX_TEXTURE_UNITS]; \
GLint r, g, b, a; \
if (flat_shade) { \
- r = v0->color[0]; \
- g = v0->color[1]; \
- b = v0->color[2]; \
- a = v0->color[3]; \
+ r = v2->color[0]; \
+ g = v2->color[1]; \
+ b = v2->color[2]; \
+ a = v2->color[3]; \
} \
{ \
GLuint unit; \
diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h
index d07f30a..056435e 100644
--- a/src/mesa/swrast/swrast.h
+++ b/src/mesa/swrast/swrast.h
@@ -131,6 +131,8 @@ _swrast_ResetLineStipple( GLcontext *ctx );
/* These will always render the correct point/line/triangle for the
* current state.
+ *
+ * For flatshaded primitives, the provoking vertex is the final one.
*/
extern void
_swrast_Point( GLcontext *ctx, const SWvertex *v );
@@ -164,6 +166,8 @@ _swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value );
extern void
_swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value );
+/* Debug:
+ */
extern void
_swrast_print_vertex( GLcontext *ctx, const SWvertex *v );