From 1018a16f392a642da227f2875ab576b78762fc5d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 29 Apr 2001 08:41:09 +0000 Subject: Allow drivers to provide a dynamic CHECK_HW_DIVIDE, to turn the divide off according to a runtime test. --- src/mesa/drivers/common/t_dd_vb.c | 4 +--- src/mesa/drivers/common/t_dd_vbtmp.h | 30 +++++++++++++++++------------- 2 files changed, 18 insertions(+), 16 deletions(-) (limited to 'src/mesa/drivers/common') diff --git a/src/mesa/drivers/common/t_dd_vb.c b/src/mesa/drivers/common/t_dd_vb.c index 1affe3132c..6682118430 100644 --- a/src/mesa/drivers/common/t_dd_vb.c +++ b/src/mesa/drivers/common/t_dd_vb.c @@ -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), diff --git a/src/mesa/drivers/common/t_dd_vbtmp.h b/src/mesa/drivers/common/t_dd_vbtmp.h index 0a3305e915..d0c7408a7c 100644 --- a/src/mesa/drivers/common/t_dd_vbtmp.h +++ b/src/mesa/drivers/common/t_dd_vbtmp.h @@ -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; -- cgit v1.2.3