nir: fix clip cull lowering to not assert if GLSL already lowered.
authorDave Airlie <airlied@redhat.com>
Wed, 9 May 2018 03:21:43 +0000 (13:21 +1000)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 16 Oct 2018 01:53:48 +0000 (18:53 -0700)
If GLSL has already done the lowering, we'd rather not crash in this pass.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/nir/nir_lower_clip_cull_distance_arrays.c

index 86ce5fb1f86cba7f7fc03647ecf7170f4329cb32..2afbf9285c0672a1ac0a08b6a65017548f5b4b64 100644 (file)
@@ -144,6 +144,12 @@ combine_clip_cull(nir_shader *nir,
          cull = var;
    }
 
+   /* if the GLSL lowering pass has already run, don't bother repeating */
+   if (!cull && clip) {
+      if (!glsl_type_is_array(clip->type))
+         return false;
+   }
+
    const unsigned clip_array_size = get_unwrapped_array_length(nir, clip);
    const unsigned cull_array_size = get_unwrapped_array_length(nir, cull);