crocus: avoid issues with undefined clip distance
authorTapani Pälli <tapani.palli@intel.com>
Tue, 12 Sep 2023 10:35:31 +0000 (13:35 +0300)
committerTapani Pälli <tapani.palli@intel.com>
Tue, 19 Sep 2023 04:19:32 +0000 (07:19 +0300)
Cc: mesa-stable
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25177>

src/gallium/drivers/crocus/crocus_program.c

index c44e08e..b51757a 100644 (file)
@@ -1173,12 +1173,14 @@ crocus_compile_vs(struct crocus_context *ice,
 
    if (key->nr_userclip_plane_consts) {
       nir_function_impl *impl = nir_shader_get_entrypoint(nir);
-      nir_lower_clip_vs(nir, (1 << key->nr_userclip_plane_consts) - 1, true,
-                        false, NULL);
-      nir_lower_io_to_temporaries(nir, impl, true, false);
-      nir_lower_global_vars_to_local(nir);
-      nir_lower_vars_to_ssa(nir);
-      nir_shader_gather_info(nir, impl);
+      /* Check if variables were found. */
+      if (nir_lower_clip_vs(nir, (1 << key->nr_userclip_plane_consts) - 1,
+                            true, false, NULL)) {
+         nir_lower_io_to_temporaries(nir, impl, true, false);
+         nir_lower_global_vars_to_local(nir);
+         nir_lower_vars_to_ssa(nir);
+         nir_shader_gather_info(nir, impl);
+      }
    }
 
    if (key->clamp_pointsize)