Fixes for compiling assembly (disable unused 'masked' versions)

Fixes for compiling without debug.
Fix line clipping
Fix unfilled polygon clipping (should be correct now).
This commit is contained in:
Keith Whitwell
2000-12-27 19:57:37 +00:00
parent 770169f230
commit 719344b23e
9 changed files with 144 additions and 103 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: s_context.c,v 1.8 2000/12/26 05:09:32 keithw Exp $ */ /* $Id: s_context.c,v 1.9 2000/12/27 19:57:37 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -367,12 +367,17 @@ _swrast_Triangle( GLcontext *ctx, const SWvertex *v0,
void void
_swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) _swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
{ {
/* fprintf(stderr, "%s\n", __FUNCTION__); */
/* _swrast_print_vertex( ctx, v0 ); */
/* _swrast_print_vertex( ctx, v1 ); */
SWRAST_CONTEXT(ctx)->Line( ctx, v0, v1 ); SWRAST_CONTEXT(ctx)->Line( ctx, v0, v1 );
} }
void void
_swrast_Point( GLcontext *ctx, const SWvertex *v0 ) _swrast_Point( GLcontext *ctx, const SWvertex *v0 )
{ {
/* fprintf(stderr, "%s\n", __FUNCTION__); */
/* _swrast_print_vertex( ctx, v0 ); */
SWRAST_CONTEXT(ctx)->Point( ctx, v0 ); SWRAST_CONTEXT(ctx)->Point( ctx, v0 );
} }
@@ -474,7 +479,6 @@ void
_swrast_print_vertex( GLcontext *ctx, const SWvertex *v ) _swrast_print_vertex( GLcontext *ctx, const SWvertex *v )
{ {
GLuint i; GLuint i;
fprintf(stderr, "\n");
fprintf(stderr, "win %f %f %f %f\n", fprintf(stderr, "win %f %f %f %f\n",
v->win[0], v->win[1], v->win[2], v->win[3]); v->win[0], v->win[1], v->win[2], v->win[3]);
@@ -491,4 +495,5 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v )
fprintf(stderr, "fog %f\n", v->fog); fprintf(stderr, "fog %f\n", v->fog);
fprintf(stderr, "index %d\n", v->index); fprintf(stderr, "index %d\n", v->index);
fprintf(stderr, "pointsize %f\n", v->pointSize); fprintf(stderr, "pointsize %f\n", v->pointSize);
fprintf(stderr, "\n");
} }

View File

@@ -1,4 +1,4 @@
/* $Id: t_array_import.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ /* $Id: t_array_import.c,v 1.2 2000/12/27 19:57:37 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -248,9 +248,10 @@ static void _tnl_upgrade_client_data( GLcontext *ctx,
{ {
GLuint i; GLuint i;
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
GLboolean writeable = (flags & VEC_NOT_WRITEABLE) != 0; GLboolean writeable = (flags & VEC_NOT_WRITEABLE) != 0;
GLboolean stride = (flags & VEC_BAD_STRIDE) != 0; GLboolean stride = (flags & VEC_BAD_STRIDE) != 0;
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
(void) inputs;
if ((required & VERT_CLIP) && VB->ClipPtr == VB->ObjPtr) if ((required & VERT_CLIP) && VB->ClipPtr == VB->ObjPtr)
required |= VERT_OBJ; required |= VERT_OBJ;

View File

@@ -1,4 +1,4 @@
/* $Id: t_vb_cliptmp.h,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ /* $Id: t_vb_cliptmp.h,v 1.2 2000/12/27 19:57:37 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -60,10 +60,14 @@ static GLuint TAG(userclip_line)( GLcontext *ctx,
if (flagI ^ flagJ) { if (flagI ^ flagJ) {
if (flagJ) { if (flagJ) {
GLfloat t = dpI / (dpI - dpJ); GLfloat t = dpI / (dpI - dpJ);
VB->ClipMask[jj] |= CLIP_USER_BIT;
jj = interp( ctx, t, ii, jj, GL_FALSE ); jj = interp( ctx, t, ii, jj, GL_FALSE );
VB->ClipMask[jj] = 0;
} else { } else {
GLfloat t = dpJ / (dpJ - dpI); GLfloat t = dpJ / (dpJ - dpI);
VB->ClipMask[ii] |= CLIP_USER_BIT;
ii = interp( ctx, t, jj, ii, GL_FALSE ); ii = interp( ctx, t, jj, ii, GL_FALSE );
VB->ClipMask[ii] = 0;
} }
} }
else if (flagI) else if (flagI)
@@ -86,8 +90,15 @@ static GLuint TAG(userclip_polygon)( GLcontext *ctx,
GLfloat (*coord)[4] = VB->ClipPtr->data; GLfloat (*coord)[4] = VB->ClipPtr->data;
GLuint vlist2[MAX_CLIPPED_VERTICES]; GLuint vlist2[MAX_CLIPPED_VERTICES];
GLuint *inlist = vlist, *outlist = vlist2; GLuint *inlist = vlist, *outlist = vlist2;
GLubyte *clipmask = VB->ClipMask;
GLuint p; GLuint p;
#define CLIP_DOTPROD(xx) d*W(xx) + c*Z(xx) + b*Y(xx) + a*X(xx)
/* Can be speeded up to if vertex_stage actually saves the
* UserClipMask, and if it is used in this loop (after computing a
* UserClipOrMask).
*/
for (p=0;p<MAX_CLIP_PLANES;p++) { for (p=0;p<MAX_CLIP_PLANES;p++) {
if (ctx->Transform.ClipEnabled[p]) { if (ctx->Transform.ClipEnabled[p]) {
register float a = ctx->Transform._ClipUserPlane[p][0]; register float a = ctx->Transform._ClipUserPlane[p][0];
@@ -96,47 +107,63 @@ static GLuint TAG(userclip_polygon)( GLcontext *ctx,
register float d = ctx->Transform._ClipUserPlane[p][3]; register float d = ctx->Transform._ClipUserPlane[p][3];
/* initialize prev to be last in the input list */ /* initialize prev to be last in the input list */
GLuint prevj = inlist[0]; GLuint idxPrev = inlist[n-1];
GLfloat dpJ = d*W(prevj) + c*Z(prevj) + b*Y(prevj) + a*X(prevj); GLfloat dpPrev = CLIP_DOTPROD(idxPrev);
GLuint outcount = 0; GLuint outcount = 0;
GLuint curri; GLuint i;
for (i = 0 ; i < n ; i++) {
GLuint idx = inlist[i];
GLfloat dp = CLIP_DOTPROD(idx);
inlist[n] = inlist[0]; if (!NEGATIVE(dpPrev)) {
outlist[outcount++] = idxPrev;
for (curri=1;curri<n+1;curri++) { GLuint currj = inlist[curri]; clipmask[idxPrev] &= ~CLIP_USER_BIT;
GLfloat dpI = d*W(currj) + c*Z(currj) + b*Y(currj) + a*X(currj);
if (!NEGATIVE(dpJ)) {
outlist[outcount++] = prevj;
VB->ClipMask[prevj] &= ~CLIP_USER_BIT;
} else { } else {
VB->ClipMask[prevj] |= CLIP_USER_BIT; clipmask[idxPrev] |= CLIP_USER_BIT;
} }
if (DIFFERENT_SIGNS(dpI, dpJ)) {
if (NEGATIVE(dpI)) { if (DIFFERENT_SIGNS(dp, dpPrev)) {
GLfloat t = dpI/(dpI-dpJ); GLuint newvert;
outlist[outcount++] = interp( ctx, t, currj, prevj, GL_TRUE); if (NEGATIVE(dp)) {
/* Going out of bounds. Avoid division by zero as we
* know dp != dpPrev from DIFFERENT_SIGNS, above.
*/
GLfloat t = dp / (dp - dpPrev);
newvert = interp( ctx, t, idx, idxPrev, GL_TRUE );
/* fprintf(stderr,"Goint out: in: %d/%d out: %d/%d new: %d/%d\n", */
/* idxPrev, VB->EdgeFlagPtr->data[idxPrev], */
/* idx, VB->EdgeFlagPtr->data[idx], */
/* newvert, VB->EdgeFlagPtr->data[newvert]); */
} else { } else {
GLfloat t = dpJ/(dpJ-dpI); /* Coming back in.
outlist[outcount++] = interp( ctx, t, prevj, currj, GL_FALSE); */
} GLfloat t = dpPrev / (dpPrev - dp);
newvert = interp( ctx, t, idxPrev, idx, GL_FALSE );
/* fprintf(stderr,"coming in: in: %d/%d out: %d/%d new: %d/%d\n", */
/* idx, VB->EdgeFlagPtr->data[idx], */
/* idxPrev, VB->EdgeFlagPtr->data[idxPrev], */
/* newvert, VB->EdgeFlagPtr->data[newvert]); */
}
clipmask[newvert] = 0;
outlist[outcount++] = newvert;
} }
prevj = currj; idxPrev = idx;
dpJ = dpI; dpPrev = dp;
} }
if (outcount < 3) if (outcount < 3)
return 0; return 0;
else {
{
GLuint *tmp; GLuint *tmp;
tmp = inlist; tmp = inlist;
inlist = outlist; inlist = outlist;
outlist = tmp; outlist = tmp;
n = outcount; n = outcount;
} }
} /* if */ } /* if */
} /* for p */ } /* for p */
@@ -146,6 +173,10 @@ static GLuint TAG(userclip_polygon)( GLcontext *ctx,
vlist[i] = inlist[i]; vlist[i] = inlist[i];
} }
/* fprintf(stderr, "%s: finally:\n", __FUNCTION__); */
/* for (i = 0 ; i < n ; i++) */
/* fprintf(stderr, "%d: %d\n", vlist[i], VB->EdgeFlagPtr->data[vlist[i]]); */
return n; return n;
} }
@@ -168,25 +199,29 @@ static void TAG(viewclip_line)( GLcontext *ctx,
/* /*
* We use 6 instances of this code to clip against the 6 planes. * We use 6 instances of this code to clip against the 6 planes.
*/ */
#define GENERAL_CLIP \ #define GENERAL_CLIP \
if (mask & PLANE) { \ if (mask & PLANE) { \
GLfloat dpI = CLIP_DOTPROD( ii ); \ GLfloat dpI = CLIP_DOTPROD( ii ); \
GLfloat dpJ = CLIP_DOTPROD( jj ); \ GLfloat dpJ = CLIP_DOTPROD( jj ); \
\ \
if (DIFFERENT_SIGNS(dpI, dpJ)) { \ if (DIFFERENT_SIGNS(dpI, dpJ)) { \
if (NEGATIVE(dpJ)) { \ if (NEGATIVE(dpJ)) { \
GLfloat t = dpI / (dpI - dpJ); \ GLfloat t = dpI / (dpI - dpJ); \
jj = interp( ctx, t, ii, jj, GL_FALSE ); \ VB->ClipMask[jj] |= PLANE; \
} else { \ jj = interp( ctx, t, ii, jj, GL_FALSE ); \
GLfloat t = dpJ / (dpJ - dpI); \ VB->ClipMask[jj] = 0; \
ii = interp( ctx, t, jj, ii, GL_FALSE ); \ } else { \
} \ GLfloat t = dpJ / (dpJ - dpI); \
} \ VB->ClipMask[ii] |= PLANE; \
else if (NEGATIVE(dpI)) \ ii = interp( ctx, t, jj, ii, GL_FALSE ); \
return; \ VB->ClipMask[ii] = 0; \
} } \
} \
else if (NEGATIVE(dpI)) \
return; \
}
#undef CLIP_DOTPROD
#define PLANE CLIP_RIGHT_BIT #define PLANE CLIP_RIGHT_BIT
#define CLIP_DOTPROD(K) (- X(K) + W(K)) #define CLIP_DOTPROD(K) (- X(K) + W(K))
@@ -271,11 +306,12 @@ static void TAG(viewclip_line)( GLcontext *ctx,
} }
} }
if (ctx->Driver.BuildProjectedVertices) if (ctx->Driver.BuildProjectedVertices)
ctx->Driver.BuildProjectedVertices(ctx, ctx->Driver.BuildProjectedVertices(ctx,
VB->FirstClipped, VB->FirstClipped,
VB->LastClipped, VB->LastClipped,
~0); ~0);
/* Render the new line. /* Render the new line.
*/ */

View File

@@ -1,4 +1,4 @@
/* $Id: t_vb_light.c,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ /* $Id: t_vb_light.c,v 1.2 2000/12/27 19:57:37 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -176,6 +176,8 @@ static GLboolean run_validate_lighting( GLcontext *ctx,
} }
/* tab = _tnl_light_tab; */ /* tab = _tnl_light_tab; */
} }
else
tab = _tnl_light_ci_tab;
if (ctx->Light.ColorMaterialEnabled) if (ctx->Light.ColorMaterialEnabled)
ind |= LIGHT_COLORMATERIAL; ind |= LIGHT_COLORMATERIAL;

View File

@@ -1,4 +1,4 @@
/* $Id: t_vb_normals.c,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ /* $Id: t_vb_normals.c,v 1.2 2000/12/27 19:57:37 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -64,6 +64,7 @@ static GLboolean run_normal_stage( GLcontext *ctx,
if (VB->NormalLengthPtr) { if (VB->NormalLengthPtr) {
GLfloat diff = VB->NormalLengthPtr[0] - GLfloat diff = VB->NormalLengthPtr[0] -
1.0/LEN_3FV(VB->NormalPtr->data[0]); 1.0/LEN_3FV(VB->NormalPtr->data[0]);
(void)diff;
ASSERT((diff*diff) < .01); ASSERT((diff*diff) < .01);
} }

View File

@@ -1,4 +1,4 @@
/* $Id: t_vb_render.c,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ /* $Id: t_vb_render.c,v 1.2 2000/12/27 19:57:37 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -630,6 +630,7 @@ static void check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
if (ctx->_TriangleCaps & DD_TRI_UNFILLED) { if (ctx->_TriangleCaps & DD_TRI_UNFILLED) {
inputs |= VERT_EDGE; inputs |= VERT_EDGE;
interp |= INTERP_EDGE;
} }
if (ctx->RenderMode==GL_FEEDBACK) { if (ctx->RenderMode==GL_FEEDBACK) {

View File

@@ -1,4 +1,4 @@
/* $Id: t_vb_rendertmp.h,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ /* $Id: t_vb_rendertmp.h,v 1.2 2000/12/27 19:57:37 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -105,9 +105,8 @@ static void TAG(render_line_strip)( GLcontext *ctx,
RESET_OCCLUSION; RESET_OCCLUSION;
INIT(GL_LINES); INIT(GL_LINES);
for (j=start+1; j<count; j++ ) { for (j=start+1; j<count; j++ )
RENDER_LINE( ELT(j-1), ELT(j) ); RENDER_LINE( ELT(j-1), ELT(j) );
}
if (TEST_PRIM_END(flags)) if (TEST_PRIM_END(flags))
RESET_STIPPLE; RESET_STIPPLE;
@@ -273,55 +272,51 @@ static void TAG(render_poly_pv)( GLcontext *ctx,
INIT(GL_POLYGON); INIT(GL_POLYGON);
if (NEED_EDGEFLAG_SETUP) { if (NEED_EDGEFLAG_SETUP) {
if (start+3 < count) { GLboolean efstart = EDGEFLAG_GET( ELT(start) );
GLboolean efstart = EDGEFLAG_GET( ELT(start) ); GLboolean efcount = EDGEFLAG_GET( ELT(count-1) );
GLboolean efcount = EDGEFLAG_GET( ELT(count-1) );
/* If the primitive does not begin here, the first edge
/* If the primitive does not begin here, the first edge * is non-boundary.
* is non-boundary. */
*/ if (!TEST_PRIM_BEGIN(flags))
if (!TEST_PRIM_BEGIN(flags)) EDGEFLAG_SET( ELT(start), GL_FALSE );
EDGEFLAG_SET( ELT(start), GL_FALSE );
/* If the primitive does not end here, the final edge is /* If the primitive does not end here, the final edge is
* non-boundary. * non-boundary.
*/ */
if (!TEST_PRIM_END(flags)) if (!TEST_PRIM_END(flags))
EDGEFLAG_SET( ELT(count-1), GL_FALSE ); EDGEFLAG_SET( ELT(count-1), GL_FALSE );
/* Draw the first triangle (possibly also the last). /* Draw the first triangles (possibly zero)
*/ */
if (j<count) { if (j<count-1) {
GLboolean ef = EDGEFLAG_GET( ELT(j) ); GLboolean ef = EDGEFLAG_GET( ELT(j) );
EDGEFLAG_SET( ELT(j), GL_FALSE ); EDGEFLAG_SET( ELT(j), GL_FALSE );
RENDER_TRI( ELT(start), ELT(j-1), ELT(j), ELT(pv), 0 ); RENDER_TRI( ELT(start), ELT(j-1), ELT(j), ELT(pv), 0 );
EDGEFLAG_SET( ELT(j), ef ); EDGEFLAG_SET( ELT(j), ef );
j++; j++;
}
/* For internal tris, the first and last edges are non-boundary. /* Don't render the first edge again:
*/ */
EDGEFLAG_SET( ELT(start), GL_FALSE ); EDGEFLAG_SET( ELT(start), GL_FALSE );
for (;j<count-1;j++) { for (;j<count-1;j++) {
GLboolean ef = EDGEFLAG_GET( ELT(j) ); GLboolean efj = EDGEFLAG_GET( ELT(j) );
EDGEFLAG_SET( ELT(j), GL_FALSE ); EDGEFLAG_SET( ELT(j), GL_FALSE );
RENDER_TRI( ELT(start), ELT(j-1), ELT(j), ELT(pv), 0 ); RENDER_TRI( ELT(start), ELT(j-1), ELT(j), ELT(pv), 0 );
EDGEFLAG_SET( ELT(j), ef ); EDGEFLAG_SET( ELT(j), efj );
} }
/* Draw the last triangle
*/
if (j < count) {
RENDER_TRI( ELT(start), ELT(j-1), ELT(j), ELT(pv), 0 );
j++;
}
/* Restore the first, last edgeflags:
*/
EDGEFLAG_SET( ELT(count-1), efcount );
EDGEFLAG_SET( ELT(start), efstart );
} }
/* Draw the last or only triangle
*/
if (j < count)
RENDER_TRI( ELT(start), ELT(j-1), ELT(j), ELT(pv), 0 );
/* Restore the first and last edgeflags:
*/
EDGEFLAG_SET( ELT(count-1), efcount );
EDGEFLAG_SET( ELT(start), efstart );
if (TEST_PRIM_END(flags)) { if (TEST_PRIM_END(flags)) {
RESET_STIPPLE; RESET_STIPPLE;

View File

@@ -1,4 +1,4 @@
/* $Id: 3dnow.c,v 1.12 2000/11/22 08:55:53 joukj Exp $ */ /* $Id: 3dnow.c,v 1.13 2000/12/27 19:57:37 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -159,10 +159,10 @@ void gl_init_3dnow_transform_asm( void )
ASSIGN_XFORM_GROUP( 3dnow, 0, 3, raw ); ASSIGN_XFORM_GROUP( 3dnow, 0, 3, raw );
ASSIGN_XFORM_GROUP( 3dnow, 0, 4, raw ); ASSIGN_XFORM_GROUP( 3dnow, 0, 4, raw );
ASSIGN_XFORM_GROUP( 3dnow, CULL_MASK_ACTIVE, 1, masked ); /* ASSIGN_XFORM_GROUP( 3dnow, CULL_MASK_ACTIVE, 1, masked ); */
ASSIGN_XFORM_GROUP( 3dnow, CULL_MASK_ACTIVE, 2, masked ); /* ASSIGN_XFORM_GROUP( 3dnow, CULL_MASK_ACTIVE, 2, masked ); */
ASSIGN_XFORM_GROUP( 3dnow, CULL_MASK_ACTIVE, 3, masked ); /* ASSIGN_XFORM_GROUP( 3dnow, CULL_MASK_ACTIVE, 3, masked ); */
ASSIGN_XFORM_GROUP( 3dnow, CULL_MASK_ACTIVE, 4, masked ); /* ASSIGN_XFORM_GROUP( 3dnow, CULL_MASK_ACTIVE, 4, masked ); */
ASSIGN_NORM_GROUP( 3dnow, 0, raw ); ASSIGN_NORM_GROUP( 3dnow, 0, raw );
/* ASSIGN_NORM_GROUP( 3dnow, CULL_MASK_ACTIVE, masked ); */ /* ASSIGN_NORM_GROUP( 3dnow, CULL_MASK_ACTIVE, masked ); */

View File

@@ -1,4 +1,4 @@
/* $Id: x86.c,v 1.13 2000/11/22 08:55:53 joukj Exp $ */ /* $Id: x86.c,v 1.14 2000/12/27 19:57:37 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -115,9 +115,9 @@ void gl_init_x86_transform_asm( void )
ASSIGN_XFORM_GROUP( x86, 0, 3, raw ); ASSIGN_XFORM_GROUP( x86, 0, 3, raw );
ASSIGN_XFORM_GROUP( x86, 0, 4, raw ); ASSIGN_XFORM_GROUP( x86, 0, 4, raw );
ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 2, masked ); /* ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 2, masked ); */
ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 3, masked ); /* ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 3, masked ); */
ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 4, masked ); /* ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 4, masked ); */
/* XXX this function has been found to cause FP overflow exceptions */ /* XXX this function has been found to cause FP overflow exceptions */
gl_clip_tab[4] = gl_x86_cliptest_points4; gl_clip_tab[4] = gl_x86_cliptest_points4;