[Mesa-dev] [PATCH] gallium: do not automatically enable clip planes when a vertex shader writes to gl_ClipDistance
Olivier Lauffenburger
o.lauffenburger at topsolid.com
Wed Sep 27 07:13:44 UTC 2017
Software rasterizer and LLVM contain code to enable clipping as soon as
a vertex shader writes to gl_ClipDistance, even if the corresponding
clip planes are disabled.
GLSL specification states that "Values written into gl_ClipDistance for
planes that are not enabled have no effect."
The actual behavior is thus non-conformant.
This patch removes the code that automagically enables user clipping
planes even if they are disabled.
Signed-off-by: Olivier Lauffenburger <o.lauffenburger at topsolid.com>
---
src/gallium/auxiliary/draw/draw_cliptest_tmp.h | 7 -------
src/gallium/auxiliary/draw/draw_llvm.c | 5 -----
2 files changed, 12 deletions(-)
diff --git a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h
index dd57c5678e..129ee7230d 100644
--- a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h
+++ b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h
@@ -57,13 +57,6 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs,
if (cd[0] != pos || cd[1] != pos)
have_cd = true;
- /* If clipdistance semantic has been written by the shader
- * that means we're expected to do 'user plane clipping' */
- if (num_written_clipdistance && !(flags & DO_CLIP_USER)) {
- flags |= DO_CLIP_USER;
- ucp_enable = (1 << num_written_clipdistance) - 1;
- }
-
assert(pos != -1);
for (j = 0; j < info->count; j++) {
float *position = out->data[pos];
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 203572010f..80b1b48f21 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -1162,11 +1162,6 @@ generate_clipmask(struct draw_llvm *llvm,
if (cd[0] != pos || cd[1] != pos)
have_cd = true;
- if (num_written_clipdistance && !clip_user) {
- clip_user = true;
- ucp_enable = (1 << num_written_clipdistance) - 1;
- }
-
mask = lp_build_const_int_vec(gallivm, i32_type, 0);
temp = lp_build_const_int_vec(gallivm, i32_type, 0);
zero = lp_build_const_vec(gallivm, f32_type, 0); /* 0.0f 0.0f 0.0f 0.0f */
--
2.13.2.windows.1
More information about the mesa-dev
mailing list