radv: Allow fast clears with concurrent queue mask for some layouts.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 17 Mar 2019 02:18:29 +0000 (03:18 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 18 Mar 2019 09:10:55 +0000 (09:10 +0000)
For VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL and
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL we do not care about
the queue mask because

1) using these is only allowed on the gfx queue
2) transitions for these are only allowed on the gfx queue.

This enables some fast clears for Doom that uses
VK_SHARING_MODE_CONCURRENT.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_image.c

index fc8c6a2ebfe0baec7aed717ec5a961bf413c5b49..dba8c1f450273252a9afa88bd05fc070312f7ef6 100644 (file)
@@ -1222,8 +1222,8 @@ bool radv_layout_has_htile(const struct radv_image *image,
 
        return radv_image_has_htile(image) &&
               (layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
-               layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) &&
-              queue_mask == (1u << RADV_QUEUE_GENERAL);
+               (layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL &&
+                queue_mask == (1u << RADV_QUEUE_GENERAL)));
 }
 
 bool radv_layout_is_htile_compressed(const struct radv_image *image,
@@ -1235,16 +1235,15 @@ bool radv_layout_is_htile_compressed(const struct radv_image *image,
 
        return radv_image_has_htile(image) &&
               (layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
-               layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) &&
-              queue_mask == (1u << RADV_QUEUE_GENERAL);
+               (layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL &&
+                queue_mask == (1u << RADV_QUEUE_GENERAL)));
 }
 
 bool radv_layout_can_fast_clear(const struct radv_image *image,
                                VkImageLayout layout,
                                unsigned queue_mask)
 {
-       return layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL &&
-               queue_mask == (1u << RADV_QUEUE_GENERAL);
+       return layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
 }
 
 bool radv_layout_dcc_compressed(const struct radv_image *image,