aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast_setup/ss_tritmp.h
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2001-01-05 02:26:48 +0000
committerKeith Whitwell <[email protected]>2001-01-05 02:26:48 +0000
commit58e991705392a2e17a1c8b034f4083a0adaf1943 (patch)
tree828804ca2671809e92a10642030ecd2d21a27b6d /src/mesa/swrast_setup/ss_tritmp.h
parentf22c04cdaec47dfef1068af0e90822062478631b (diff)
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_setup/ss_tritmp.h')
-rw-r--r--src/mesa/swrast_setup/ss_tritmp.h184
1 files changed, 39 insertions, 145 deletions
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index d04a36b18b5..936774aba4e 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -26,44 +26,20 @@
*/
-static void TAG(triangle)(GLcontext *ctx,
- GLuint e0, GLuint e1, GLuint e2,
- GLuint pv)
+static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts;
SWvertex *v[3];
- GLfloat offset;
GLfloat z[3];
- GLubyte c[3][4], s[3][4];
- GLuint i[3];
+ GLfloat offset;
GLenum mode = GL_FILL;
+ GLuint facing;
v[0] = &verts[e0];
v[1] = &verts[e1];
v[2] = &verts[e2];
- if (IND & (SS_TWOSIDE_BIT | SS_FLAT_BIT)) {
- if (IND & SS_RGBA_BIT) {
- SS_COLOR(c[0], v[0]->color);
- SS_SPEC(s[0], v[0]->specular);
-
- if (IND & SS_TWOSIDE_BIT) {
- SS_COLOR(c[1], v[1]->color);
- SS_COLOR(c[2], v[2]->color);
-
- SS_SPEC(s[1], v[1]->specular);
- SS_SPEC(s[2], v[2]->specular);
- }
- } else {
- SS_IND(i[0], v[0]->index);
-
- if (IND & SS_TWOSIDE_BIT) {
- SS_IND(i[1], v[1]->index);
- SS_IND(i[2], v[2]->index);
- }
- }
- }
if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT))
{
@@ -75,46 +51,24 @@ static void TAG(triangle)(GLcontext *ctx,
if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT))
{
- GLuint facing = (cc < 0.0) ^ ctx->Polygon._FrontBit;
+ facing = (cc < 0.0) ^ ctx->Polygon._FrontBit;
if (IND & SS_UNFILLED_BIT)
mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode;
- if (IND & SS_TWOSIDE_BIT) {
- if (IND & SS_FLAT_BIT) {
+ if (facing == 1) {
+ if (IND & SS_TWOSIDE_BIT) {
if (IND & SS_RGBA_BIT) {
- GLubyte (*vbcolor)[4] = VB->ColorPtr[facing]->data;
- GLubyte (*vbspec)[4] = VB->SecondaryColorPtr[facing]->data;
-
- SS_COLOR(v[0]->color, vbcolor[pv]);
- SS_COLOR(v[1]->color, vbcolor[pv]);
- SS_COLOR(v[2]->color, vbcolor[pv]);
-
- SS_SPEC(v[0]->specular, vbspec[pv]);
- SS_SPEC(v[1]->specular, vbspec[pv]);
- SS_SPEC(v[2]->specular, vbspec[pv]);
- } else {
- GLuint *vbindex = VB->IndexPtr[facing]->data;
-
- SS_IND(v[0]->index, vbindex[pv]);
- SS_IND(v[1]->index, vbindex[pv]);
- SS_IND(v[2]->index, vbindex[pv]);
- }
- } else {
- if (IND & SS_RGBA_BIT) {
- GLubyte (*vbcolor)[4] = VB->ColorPtr[facing]->data;
- GLubyte (*vbspec)[4] = VB->SecondaryColorPtr[facing]->data;
-
+ GLubyte (*vbcolor)[4] = VB->ColorPtr[1]->data;
+ GLubyte (*vbspec)[4] = VB->SecondaryColorPtr[1]->data;
SS_COLOR(v[0]->color, vbcolor[e0]);
SS_COLOR(v[1]->color, vbcolor[e1]);
SS_COLOR(v[2]->color, vbcolor[e2]);
-
SS_SPEC(v[0]->specular, vbspec[e0]);
SS_SPEC(v[1]->specular, vbspec[e1]);
SS_SPEC(v[2]->specular, vbspec[e2]);
} else {
- GLuint *vbindex = VB->IndexPtr[facing]->data;
-
+ GLuint *vbindex = VB->IndexPtr[1]->data;
SS_IND(v[0]->index, vbindex[e0]);
SS_IND(v[1]->index, vbindex[e1]);
SS_IND(v[2]->index, vbindex[e2]);
@@ -143,23 +97,9 @@ static void TAG(triangle)(GLcontext *ctx,
}
}
}
- else if (IND & SS_FLAT_BIT)
- {
- if (IND & SS_RGBA_BIT) {
- GLubyte *color = VB->ColorPtr[0]->data[pv];
- GLubyte *spec = VB->SecondaryColorPtr[0]->data[pv];
-
- SS_COLOR(v[0]->color, color);
- SS_SPEC(v[0]->specular, spec);
- }
- else {
- GLuint index = VB->IndexPtr[0]->data[pv];
- SS_IND(v[0]->index, index);
- }
- }
if (mode == GL_POINT) {
- GLubyte *ef = VB->EdgeFlagPtr->data;
+ GLubyte *ef = VB->EdgeFlag;
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetPoint) {
v[0]->win[2] += offset;
v[1]->win[2] += offset;
@@ -169,7 +109,7 @@ static void TAG(triangle)(GLcontext *ctx,
if (ef[e1]) _swrast_Point( ctx, v[1] );
if (ef[e2]) _swrast_Point( ctx, v[2] );
} else if (mode == GL_LINE) {
- GLubyte *ef = VB->EdgeFlagPtr->data;
+ GLubyte *ef = VB->EdgeFlag;
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) {
v[0]->win[2] += offset;
v[1]->win[2] += offset;
@@ -193,27 +133,25 @@ static void TAG(triangle)(GLcontext *ctx,
v[2]->win[2] = z[2];
}
- if (IND & (SS_FLAT_BIT | SS_TWOSIDE_BIT)) {
- if (IND & SS_RGBA_BIT) {
- SS_COLOR(v[0]->color, c[0]);
- SS_SPEC(v[0]->specular, s[0]);
-
- if (IND & SS_TWOSIDE_BIT) {
- SS_COLOR(v[1]->color, c[1]);
- SS_COLOR(v[2]->color, c[2]);
- SS_SPEC(v[1]->specular, s[1]);
- SS_SPEC(v[2]->specular, s[2]);
- }
- }
- else {
- SS_IND(v[0]->index, i[0]);
-
- if (IND & SS_TWOSIDE_BIT) {
- SS_IND(v[1]->index, i[1]);
- SS_IND(v[2]->index, i[2]);
+ if (IND & SS_TWOSIDE_BIT) {
+ if (facing == 1) {
+ if (IND & SS_RGBA_BIT) {
+ GLubyte (*vbcolor)[4] = VB->ColorPtr[0]->data;
+ GLubyte (*vbspec)[4] = VB->SecondaryColorPtr[0]->data;
+ SS_COLOR(v[0]->color, vbcolor[e0]);
+ SS_COLOR(v[1]->color, vbcolor[e1]);
+ SS_COLOR(v[2]->color, vbcolor[e2]);
+ SS_SPEC(v[0]->specular, vbspec[e0]);
+ SS_SPEC(v[1]->specular, vbspec[e1]);
+ SS_SPEC(v[2]->specular, vbspec[e2]);
+ } else {
+ GLuint *vbindex = VB->IndexPtr[0]->data;
+ SS_IND(v[0]->index, vbindex[e0]);
+ SS_IND(v[1]->index, vbindex[e1]);
+ SS_IND(v[2]->index, vbindex[e2]);
}
}
- }
+ }
}
@@ -221,75 +159,31 @@ static void TAG(triangle)(GLcontext *ctx,
/* Need to do something with edgeflags:
*/
static void TAG(quad)( GLcontext *ctx, GLuint v0,
- GLuint v1, GLuint v2, GLuint v3,
- GLuint pv )
+ GLuint v1, GLuint v2, GLuint v3 )
{
if (IND & SS_UNFILLED_BIT) {
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLubyte ef1 = VB->EdgeFlagPtr->data[v1];
- GLubyte ef3 = VB->EdgeFlagPtr->data[v3];
- VB->EdgeFlagPtr->data[v1] = 0;
- TAG(triangle)( ctx, v0, v1, v3, pv );
- VB->EdgeFlagPtr->data[v1] = ef1;
- VB->EdgeFlagPtr->data[v3] = 0;
- TAG(triangle)( ctx, v1, v2, v3, pv );
- VB->EdgeFlagPtr->data[v3] = ef3;
+ GLubyte ef1 = VB->EdgeFlag[v1];
+ GLubyte ef3 = VB->EdgeFlag[v3];
+ VB->EdgeFlag[v1] = 0;
+ TAG(triangle)( ctx, v0, v1, v3 );
+ VB->EdgeFlag[v1] = ef1;
+ VB->EdgeFlag[v3] = 0;
+ TAG(triangle)( ctx, v1, v2, v3 );
+ VB->EdgeFlag[v3] = ef3;
} else {
- TAG(triangle)( ctx, v0, v1, v3, pv );
- TAG(triangle)( ctx, v1, v2, v3, pv );
+ TAG(triangle)( ctx, v0, v1, v3 );
+ TAG(triangle)( ctx, v1, v2, v3 );
}
}
-static void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts;
- GLubyte c[2][4], s[2][4];
- GLuint i[2];
- SWvertex *vert0 = &verts[v0];
- SWvertex *vert1 = &verts[v1];
-
-
- if (IND & SS_FLAT_BIT) {
- if (IND & SS_RGBA_BIT) {
- GLubyte *color = VB->ColorPtr[0]->data[pv];
- GLubyte *spec = VB->SecondaryColorPtr[0]->data[pv];
-
- SS_COLOR(c[0], vert0->color);
- SS_COLOR(vert0->color, color);
-
- SS_SPEC(s[0], vert0->specular);
- SS_SPEC(vert0->specular, spec);
- }
- else {
- GLuint index = VB->IndexPtr[0]->data[pv];
-
- SS_IND(i[0], vert0->index);
- SS_IND(vert0->index, index);
- }
- }
-
- _swrast_Line( ctx, vert0, vert1 );
-
- if (IND & SS_FLAT_BIT) {
- if (IND & SS_RGBA_BIT) {
- SS_COLOR(vert0->color, c[0]);
- SS_SPEC(vert0->specular, s[0]);
- }
- else {
- SS_IND(vert0->index, i[0]);
- }
- }
-}
-
static void TAG(init)( void )
{
tri_tab[IND] = TAG(triangle);
quad_tab[IND] = TAG(quad);
- line_tab[IND] = TAG(line);
}