Mesa (master): nir/clip_disable: write 0s instead of undefs for disabled clip planes
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Nov 5 22:15:06 UTC 2020
Module: Mesa
Branch: master
Commit: 1d23a88c6eb7502ea38e3e9d1a28b7df49c78e29
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d23a88c6eb7502ea38e3e9d1a28b7df49c78e29
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Sep 3 10:25:24 2020 -0400
nir/clip_disable: write 0s instead of undefs for disabled clip planes
this should yield more reliable and ideally even correct results
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6563>
---
src/compiler/nir/nir_lower_clip_disable.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/compiler/nir/nir_lower_clip_disable.c b/src/compiler/nir/nir_lower_clip_disable.c
index ae086459c0c..102eab58deb 100644
--- a/src/compiler/nir/nir_lower_clip_disable.c
+++ b/src/compiler/nir/nir_lower_clip_disable.c
@@ -30,7 +30,7 @@
/**
* This pass uses the enabled clip planes from the rasterizer state to rewrite
- * vertex shader store operations and store an undef to the corresponding gl_ClipDistance[n]
+ * vertex shader store operations and store a 0 to the corresponding gl_ClipDistance[n]
* value if the plane is disabled
*/
@@ -45,7 +45,7 @@ recursive_if_chain(nir_builder *b, nir_deref_instr *deref, nir_ssa_def *value, u
if (clip_plane_enable & (1 << start))
nir_store_deref(b, deref, value, 1 << start);
else
- nir_store_deref(b, deref, nir_ssa_undef(b, 1, 32), 1 << start);
+ nir_store_deref(b, deref, nir_imm_int(b, 0), 1 << start);
return;
}
@@ -58,7 +58,7 @@ recursive_if_chain(nir_builder *b, nir_deref_instr *deref, nir_ssa_def *value, u
}
/* vulkan (and some drivers) provides no concept of enabling clip planes through api,
- * so we rewrite disabled clip planes to an undefined value in order to disable them
+ * so we rewrite disabled clip planes to a zero value in order to disable them
*/
static bool
lower_clip_plane_store(nir_intrinsic_instr *instr, unsigned clip_plane_enable, nir_builder *b)
@@ -84,7 +84,7 @@ lower_clip_plane_store(nir_intrinsic_instr *instr, unsigned clip_plane_enable, n
if (clip_plane_enable & (1 << plane))
return false;
- nir_store_deref(b, deref, nir_ssa_undef(b, 1, 32), 1 << plane);
+ nir_store_deref(b, deref, nir_imm_int(b, 0), 1 << plane);
} else {
/* storing using a variable index */
nir_ssa_def *index = nir_ssa_for_src(b, deref->arr.index, 1);
More information about the mesa-commit
mailing list