mesa: Add support for ARB_depth_clamp.
[mesa.git] / src / mesa / math / m_debug_clip.c
index 460fed4a7547365d088f245cb7df7e30da13dbee..f2b757a91b8b683b857dda478909b324544dfc46 100644 (file)
@@ -67,7 +67,8 @@ static GLvector4f *ref_cliptest_points4( 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;
@@ -87,8 +88,10 @@ static GLvector4f *ref_cliptest_points4( GLvector4f *clip_vec,
       if (  cx + cw < 0 ) mask |= CLIP_LEFT_BIT;
       if ( -cy + cw < 0 ) mask |= CLIP_TOP_BIT;
       if (  cy + cw < 0 ) mask |= CLIP_BOTTOM_BIT;
-      if ( -cz + cw < 0 ) mask |= CLIP_FAR_BIT;
-      if (  cz + cw < 0 ) mask |= CLIP_NEAR_BIT;
+      if (viewport_z_clip) {
+        if ( -cz + cw < 0 ) mask |= CLIP_FAR_BIT;
+        if (  cz + cw < 0 ) mask |= CLIP_NEAR_BIT;
+      }
       clipMask[i] = mask;
       if ( mask ) {
         c++;