panfrost: Lower clip_fs late
authorAlyssa Rosenzweig <alyssa@collabora.com>
Tue, 7 Feb 2023 04:53:35 +0000 (23:53 -0500)
committerMarge Bot <emma+marge@anholt.net>
Thu, 23 Mar 2023 23:53:46 +0000 (23:53 +0000)
This pass works both early and late, so this is an easy one to sink down.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20906>

src/gallium/drivers/panfrost/pan_shader.c

index 8997cd2..98ffb86 100644 (file)
@@ -104,10 +104,6 @@ panfrost_shader_compile(struct panfrost_screen *screen, const nir_shader *ir,
          NIR_PASS_V(s, nir_lower_texcoord_replace, key->fs.sprite_coord_enable,
                     true /* point coord is sysval */, false /* Y-invert */);
       }
-
-      if (key->fs.clip_plane_enable) {
-         NIR_PASS_V(s, nir_lower_clip_fs, key->fs.clip_plane_enable, false);
-      }
    } else if (s->info.stage == MESA_SHADER_VERTEX) {
       inputs.fixed_varying_mask = fixed_varying_mask;
 
@@ -118,6 +114,12 @@ panfrost_shader_compile(struct panfrost_screen *screen, const nir_shader *ir,
    util_dynarray_init(&out->binary, NULL);
    pan_shader_preprocess(s, inputs.gpu_id);
 
+   if (s->info.stage == MESA_SHADER_FRAGMENT) {
+      if (key->fs.clip_plane_enable) {
+         NIR_PASS_V(s, nir_lower_clip_fs, key->fs.clip_plane_enable, false);
+      }
+   }
+
    if (dev->arch <= 5 && s->info.stage == MESA_SHADER_FRAGMENT) {
       NIR_PASS_V(s, pan_lower_framebuffer, key->fs.rt_formats,
                  pan_raw_format_mask_midgard(key->fs.rt_formats), 0,