radv: Flush caches before subpass resolve.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 25 Dec 2017 13:27:28 +0000 (14:27 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Wed, 27 Dec 2017 23:26:07 +0000 (00:26 +0100)
Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver"
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_meta_resolve_cs.c
src/amd/vulkan/radv_meta_resolve_fs.c

index 3833faa1247b47a985d68daeba0008bc8d7a990f..5b6cea6c103bfb74ea06ee90022b1c7509a74349 100644 (file)
@@ -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];
index c25aea73670e54e4b7e93ed9bf28b1d7ffe8b40f..756309efd2e453b663c7f0da8620f0ed705fd69e 100644 (file)
@@ -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];