Allow drivers to provide a dynamic CHECK_HW_DIVIDE, to turn the divide off

according to a runtime test.
This commit is contained in:
Keith Whitwell 2001-04-29 08:41:09 +00:00
parent f358988f2e
commit 1018a16f39
2 changed files with 18 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $Id: t_dd_vb.c,v 1.9 2001/04/28 15:26:43 keithw Exp $ */
/* $Id: t_dd_vb.c,v 1.10 2001/04/29 08:41:09 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -285,8 +285,6 @@ INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx,
LOCALVARS
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
fprintf(stderr, "%s\n", __FUNCTION__);
if (VB->ColorPtr[1]) {
INTERP_4F( t,
GET_COLOR(VB->ColorPtr[1], dst),

View File

@ -1,4 +1,4 @@
/* $Id: t_dd_vbtmp.h,v 1.12 2001/04/28 15:26:43 keithw Exp $ */
/* $Id: t_dd_vbtmp.h,v 1.13 2001/04/29 08:41:09 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -102,13 +102,17 @@
#endif
#if (HAVE_HW_DIVIDE && !HAVE_PTEX_VERTICES)
#error "can't cope with this combination"
#endif
#error "can't cope with this combination"
#endif
#ifndef LOCALVARS
#define LOCALVARS
#endif
#ifndef CHECK_HW_DIVIDE
#define CHECK_HW_DIVIDE 1
#endif
#if (HAVE_HW_DIVIDE || DO_SPEC || DO_TEX0 || DO_FOG || !HAVE_TINY_VERTICES)
static void TAG(emit)( GLcontext *ctx,
@ -132,7 +136,7 @@ static void TAG(emit)( GLcontext *ctx,
const GLubyte *mask = VB->ClipMask;
int i;
if (HAVE_HW_VIEWPORT && HAVE_HW_DIVIDE) {
if (HAVE_HW_VIEWPORT && HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) {
(void) s;
coord = VB->ClipPtr->data;
coord_stride = VB->ClipPtr->stride;
@ -604,21 +608,21 @@ static void TAG(interp)( GLcontext *ctx,
(void)s;
if (!HAVE_HW_DIVIDE) {
w = 1.0 / dstclip[3];
VIEWPORT_X( dst->v.x, dstclip[0] * w );
VIEWPORT_Y( dst->v.y, dstclip[1] * w );
VIEWPORT_Z( dst->v.z, dstclip[2] * w );
}
else {
if (HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) {
VIEWPORT_X( dst->v.x, dstclip[0] );
VIEWPORT_Y( dst->v.y, dstclip[1] );
VIEWPORT_Z( dst->v.z, dstclip[2] );
w = dstclip[3];
}
else {
w = 1.0 / dstclip[3];
VIEWPORT_X( dst->v.x, dstclip[0] * w );
VIEWPORT_Y( dst->v.y, dstclip[1] * w );
VIEWPORT_Z( dst->v.z, dstclip[2] * w );
}
if (HAVE_HW_DIVIDE || DO_FOG || DO_SPEC || DO_TEX0 || DO_TEX1 ||
if ((HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) ||
DO_FOG || DO_SPEC || DO_TEX0 || DO_TEX1 ||
DO_TEX2 || DO_TEX3) {
dst->v.w = w;