aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2019-01-23 01:15:05 -0800
committerKenneth Graunke <[email protected]>2019-02-05 13:58:46 -0800
commitba9dcc80fb2fc103835eef17153895f403d8654e (patch)
tree3204c5eb104367b9913c498665ce695e7667421b /src
parent5730364d695b706c99c0d3fe6379cbeac61d79f1 (diff)
nir: Avoid clip/cull distance lowering multiple times.
A couple places in st/nir assume that cull distances have been lowered away, so it will need to call this lowering pass for drivers which opt out of the GLSL IR lowering. The Intel backend also calls this pass, for i965 and anv. We need to only do it once. Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir_lower_clip_cull_distance_arrays.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c b/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c
index 79d61fabea3..05cd6af2195 100644
--- a/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c
+++ b/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c
@@ -148,6 +148,12 @@ combine_clip_cull(nir_shader *nir,
/* The GLSL IR lowering pass must have converted these to vectors */
if (!clip->data.compact)
return false;
+
+ /* If this pass has already run, don't repeat. We would think that
+ * the combined clip/cull distance array was clip-only and mess up.
+ */
+ if (clip->data.how_declared == nir_var_hidden)
+ return false;
}
const unsigned clip_array_size = get_unwrapped_array_length(nir, clip);
@@ -158,11 +164,15 @@ combine_clip_cull(nir_shader *nir,
nir->info.cull_distance_array_size = cull_array_size;
}
- if (clip)
+ if (clip) {
clip->data.compact = true;
+ clip->data.how_declared = nir_var_hidden;
+ }
- if (cull)
+ if (cull) {
cull->data.compact = true;
+ cull->data.how_declared = nir_var_hidden;
+ }
if (cull_array_size > 0) {
if (clip_array_size == 0) {