OSDN Git Service

mesa: fix viewport_z_clip breakage
authorBrian Paul <brianp@vmware.com>
Tue, 8 Sep 2009 22:44:49 +0000 (16:44 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 8 Sep 2009 22:44:49 +0000 (16:44 -0600)
src/mesa/math/m_debug_clip.c

index f2b757a..95ae5a3 100644 (file)
@@ -125,7 +125,8 @@ static GLvector4f *ref_cliptest_points3( GLvector4f *clip_vec,
                                         GLvector4f *proj_vec,
                                         GLubyte clipMask[],
                                         GLubyte *orMask,
-                                        GLubyte *andMask )
+                                        GLubyte *andMask,
+                                         GLboolean viewport_z_clip )
 {
    const GLuint stride = clip_vec->stride;
    const GLuint count = clip_vec->count;
@@ -141,8 +142,10 @@ static GLvector4f *ref_cliptest_points3( GLvector4f *clip_vec,
       else if ( cx < -1.0 )    mask |= CLIP_LEFT_BIT;
       if ( cy >  1.0 )         mask |= CLIP_TOP_BIT;
       else if ( cy < -1.0 )    mask |= CLIP_BOTTOM_BIT;
-      if ( cz >  1.0 )         mask |= CLIP_FAR_BIT;
-      else if ( cz < -1.0 )    mask |= CLIP_NEAR_BIT;
+      if (viewport_z_clip) {
+         if ( cz >  1.0 )              mask |= CLIP_FAR_BIT;
+         else if ( cz < -1.0 ) mask |= CLIP_NEAR_BIT;
+      }
       clipMask[i] = mask;
       tmpOrMask |= mask;
       tmpAndMask &= mask;
@@ -157,7 +160,8 @@ static GLvector4f * ref_cliptest_points2( GLvector4f *clip_vec,
                                          GLvector4f *proj_vec,
                                          GLubyte clipMask[],
                                          GLubyte *orMask,
-                                         GLubyte *andMask )
+                                         GLubyte *andMask,
+                                          GLboolean viewport_z_clip )
 {
    const GLuint stride = clip_vec->stride;
    const GLuint count = clip_vec->count;
@@ -166,6 +170,9 @@ static GLvector4f * ref_cliptest_points2( GLvector4f *clip_vec,
    GLubyte tmpOrMask = *orMask;
    GLubyte tmpAndMask = *andMask;
    GLuint i;
+
+   (void) viewport_z_clip;
+
    for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) {
       const GLfloat cx = from[0], cy = from[1];
       GLubyte mask = 0;
@@ -211,6 +218,7 @@ static int test_cliptest_function( clip_func func, int np,
 #ifdef  RUN_DEBUG_BENCHMARK
    int cycle_i;                /* the counter for the benchmarks we run */
 #endif
+   GLboolean viewport_z_clip = GL_TRUE;
 
    (void) cycles;
 
@@ -250,15 +258,15 @@ static int test_cliptest_function( clip_func func, int np,
    dco = rco = 0;
    dca = rca = CLIP_FRUSTUM_BITS;
 
-   ref_cliptest[psize]( source, ref, rm, &rco, &rca );
+   ref_cliptest[psize]( source, ref, rm, &rco, &rca, viewport_z_clip );
 
    if ( mesa_profile ) {
       BEGIN_RACE( *cycles );
-      func( source, dest, dm, &dco, &dca );
+      func( source, dest, dm, &dco, &dca, viewport_z_clip );
       END_RACE( *cycles );
    }
    else {
-      func( source, dest, dm, &dco, &dca );
+      func( source, dest, dm, &dco, &dca, viewport_z_clip );
    }
 
    if ( dco != rco ) {