Commit ba9dcc80 authored by Kenneth Graunke's avatar Kenneth Graunke
Browse files

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's avatarTimothy Arceri <>
parent 5730364d
......@@ -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) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment