OSDN Git Service

Allow drivers to provide a dynamic CHECK_HW_DIVIDE, to turn the divide off
authorKeith Whitwell <keith@tungstengraphics.com>
Sun, 29 Apr 2001 08:41:09 +0000 (08:41 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Sun, 29 Apr 2001 08:41:09 +0000 (08:41 +0000)
according to a runtime test.

src/mesa/drivers/common/t_dd_vb.c
src/mesa/drivers/common/t_dd_vbtmp.h

index 1affe31..6682118 100644 (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),
index 0a3305e..d0c7408 100644 (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
 #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;