Mesa (main): panvk: Allow clear_attachment of RTs > 0

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 4 13:33:38 UTC 2021


Module: Mesa
Branch: main
Commit: c3ebd8ddaca658607ad5e6c205b1e9fb55616d53
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c3ebd8ddaca658607ad5e6c205b1e9fb55616d53

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Thu Sep 30 12:53:11 2021 +0200

panvk: Allow clear_attachment of RTs > 0

It's just a matter of skipping unused BLEND descriptors and emitting
the one we want to clear.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13137>

---

 src/panfrost/vulkan/panvk_vX_meta_clear.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/panfrost/vulkan/panvk_vX_meta_clear.c b/src/panfrost/vulkan/panvk_vX_meta_clear.c
index 073b69bff30..c3dca80abb4 100644
--- a/src/panfrost/vulkan/panvk_vX_meta_clear.c
+++ b/src/panfrost/vulkan/panvk_vX_meta_clear.c
@@ -95,10 +95,7 @@ panvk_meta_clear_attachments_emit_rsd(struct panfrost_device *pdev,
    struct panfrost_ptr rsd_ptr =
       pan_pool_alloc_desc_aggregate(desc_pool,
                                     PAN_DESC(RENDERER_STATE),
-                                    PAN_DESC(BLEND));
-
-   /* TODO: Support multiple render targets */
-   assert(rt == 0);
+                                    PAN_DESC_ARRAY(rt + 1, BLEND));
 
    pan_pack(rsd_ptr.cpu, RENDERER_STATE, cfg) {
       pan_shader_prepare_rsd(shader_info, shader, &cfg);
@@ -129,7 +126,21 @@ panvk_meta_clear_attachments_emit_rsd(struct panfrost_device *pdev,
 #endif
    }
 
-   pan_pack(rsd_ptr.cpu + pan_size(RENDERER_STATE), BLEND, cfg) {
+   void *bd = rsd_ptr.cpu + pan_size(RENDERER_STATE);
+
+   /* Disable all RTs except the one we're interested in. */
+   for (unsigned i = 0; i < rt; i++) {
+      pan_pack(bd, BLEND, cfg) {
+         cfg.enable = false;
+#if PAN_ARCH >= 6
+         cfg.internal.mode = MALI_BLEND_MODE_OFF;
+#endif
+      }
+
+      bd += pan_size(BLEND);
+   }
+
+   pan_pack(bd, BLEND, cfg) {
       cfg.round_to_fb_precision = true;
       cfg.load_destination = false;
       cfg.equation.rgb.a = MALI_BLEND_OPERAND_A_SRC;



More information about the mesa-commit mailing list