tu/lrz: Fix multiple depth attachment case with secondaries
authorConnor Abbott <cwabbott0@gmail.com>
Thu, 1 Sep 2022 12:37:41 +0000 (14:37 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 1 Sep 2022 19:11:19 +0000 (19:11 +0000)
This is a counterpart to the previous commit. When we have multiple
depth attachments, in the secondary we currently don't disable LRZ and
so we may need a valid LRZ fast-clear base.

Fixes: 4b5f0d98 ("tu: Overhaul LRZ, implement on-GPU dir tracking and LRZ fast-clear")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18369>

src/freedreno/vulkan/tu_lrz.c

index a60be23..31b6598 100644 (file)
@@ -318,6 +318,14 @@ tu_lrz_begin_renderpass(struct tu_cmd_buffer *cmd,
          struct tu_image *image = cmd->state.attachments[i]->image;
          tu_disable_lrz(cmd, &cmd->cs, image);
       }
+
+      /* We need a valid LRZ fast-clear base, in case the render pass contents
+       * are in secondaries that enable LRZ, so that they can read that LRZ is
+       * dynamically disabled. It doesn't matter which we use, so just leave
+       * the last one as emitted in tu_disable_lrz().
+       */
+      memset(&cmd->state.lrz, 0, sizeof(cmd->state.lrz));
+      return;
    }
 
     /* Track LRZ valid state */