Mesa (main): nir/lower_clip: replace bogus comment about gl_ClipDistance reading in GL

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Nov 28 05:39:46 UTC 2021


Module: Mesa
Branch: main
Commit: a8930e63028b52420b24e238263db50fa8ca2c30
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a8930e63028b52420b24e238263db50fa8ca2c30

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Sun Nov 21 03:18:25 2021 -0500

nir/lower_clip: replace bogus comment about gl_ClipDistance reading in GL

gl_ClipDistance most definitely can be read in fragment shaders since
GLSL 1.30. This is also accessible in ES with EXT_clip_cull_distance.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>

---

 src/compiler/nir/nir_lower_clip.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/compiler/nir/nir_lower_clip.c b/src/compiler/nir/nir_lower_clip.c
index bb0543df4ca..9bb167eeaa6 100644
--- a/src/compiler/nir/nir_lower_clip.c
+++ b/src/compiler/nir/nir_lower_clip.c
@@ -491,9 +491,9 @@ nir_lower_clip_fs(nir_shader *shader, unsigned ucp_enables,
    if (!ucp_enables)
       return false;
 
-   /* Fragment shaders can't read gl_ClipDistance[] in OpenGL so it will not
-    * have the variable defined, but Vulkan allows this, in which case the
-    * SPIR-V compiler would have already added it as a compact array.
+   /* No hard reason to require use_clipdist_arr to work with
+    * frag-shader-based gl_ClipDistance, except that the only user that does
+    * not enable this does not support GL 3.0 (or EXT_clip_cull_distance).
     */
    if (!fs_has_clip_dist_input_var(shader, in, &ucp_enables))
       create_clipdist_vars(shader, in, ucp_enables, false, use_clipdist_array);



More information about the mesa-commit mailing list