[Mesa-dev] [Bug 97231] GL_DEPTH_CLAMP doesn't clamp to the far plane

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Aug 13 01:13:31 UTC 2016


https://bugs.freedesktop.org/show_bug.cgi?id=97231

--- Comment #18 from Ilia Mirkin <imirkin at alum.mit.edu> ---
FWIW this also fails on nouveau right now... this is a part of the patch I'm
going to have to apply (still working out the full details, but this should
have the general idea):

@@ -329,8 +329,21 @@ nvc0_validate_viewport(struct nvc0_context *nvc0)
       PUSH_DATA (push, (w << 16) | x);
       PUSH_DATA (push, (h << 16) | y);

-      zmin = vp->translate[2] - fabsf(vp->scale[2]);
-      zmax = vp->translate[2] + fabsf(vp->scale[2]);
+      if (nvc0->rast->pipe.clip_halfz) {
+         zmin = vp->translate[2];
+         zmax = vp->translate[2] + vp->scale[2];
+         if (zmax < zmin) {
+            float t = zmax;
+            zmax = zmin;
+            zmin = t;
+         }
+      } else {
+         zmin = vp->translate[2] - fabsf(vp->scale[2]);
+         zmax = vp->translate[2] + fabsf(vp->scale[2]);
+      }

Note that the near/far planes have to be calculated differently based on
whether clip_halfz is enabled.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160813/2625c493/attachment-0001.html>


More information about the mesa-dev mailing list