From cebc9a119d44cb5b2b3bd5e262452e112b75fea2 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Mon, 25 Dec 2017 14:27:28 +0100 Subject: [PATCH] radv: Flush caches before subpass resolve. Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver" Reviewed-by: Dave Airlie --- src/amd/vulkan/radv_meta_resolve_cs.c | 8 ++++++++ src/amd/vulkan/radv_meta_resolve_fs.c | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/amd/vulkan/radv_meta_resolve_cs.c b/src/amd/vulkan/radv_meta_resolve_cs.c index 3833faa1247..5b6cea6c103 100644 --- a/src/amd/vulkan/radv_meta_resolve_cs.c +++ b/src/amd/vulkan/radv_meta_resolve_cs.c @@ -487,6 +487,14 @@ radv_cmd_buffer_resolve_subpass_cs(struct radv_cmd_buffer *cmd_buffer) if (!subpass->has_resolve) return; + /* Resolves happen before the end-of-subpass barriers get executed, + * so we have to make the attachment shader-readable */ + cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_PS_PARTIAL_FLUSH | + RADV_CMD_FLAG_FLUSH_AND_INV_CB | + RADV_CMD_FLAG_FLUSH_AND_INV_CB_META | + RADV_CMD_FLAG_INV_GLOBAL_L2 | + RADV_CMD_FLAG_INV_VMEM_L1; + for (uint32_t i = 0; i < subpass->color_count; ++i) { VkAttachmentReference src_att = subpass->color_attachments[i]; VkAttachmentReference dest_att = subpass->resolve_attachments[i]; diff --git a/src/amd/vulkan/radv_meta_resolve_fs.c b/src/amd/vulkan/radv_meta_resolve_fs.c index c25aea73670..756309efd2e 100644 --- a/src/amd/vulkan/radv_meta_resolve_fs.c +++ b/src/amd/vulkan/radv_meta_resolve_fs.c @@ -604,6 +604,16 @@ radv_cmd_buffer_resolve_subpass_fs(struct radv_cmd_buffer *cmd_buffer) RADV_META_SAVE_CONSTANTS | RADV_META_SAVE_DESCRIPTORS); + /* Resolves happen before the end-of-subpass barriers get executed, + * so we have to make the attachment shader-readable */ + cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_PS_PARTIAL_FLUSH | + RADV_CMD_FLAG_FLUSH_AND_INV_CB | + RADV_CMD_FLAG_FLUSH_AND_INV_CB_META | + RADV_CMD_FLAG_FLUSH_AND_INV_DB | + RADV_CMD_FLAG_FLUSH_AND_INV_DB_META | + RADV_CMD_FLAG_INV_GLOBAL_L2 | + RADV_CMD_FLAG_INV_VMEM_L1; + for (uint32_t i = 0; i < subpass->color_count; ++i) { VkAttachmentReference src_att = subpass->color_attachments[i]; VkAttachmentReference dest_att = subpass->resolve_attachments[i]; -- 2.30.2