From 342dc147703de5ae5cdbd735b9f9114db9649424 Mon Sep 17 00:00:00 2001 From: Sergey Kosarevsky Date: Mon, 18 Sep 2023 12:02:28 -0700 Subject: [PATCH] igl | vulkan | Add more src/dst masks in VulkanImage::transitionLayout() Summary: Add more automatic src/dst stage masks deductions in `VulkanImage::transitionLayout()`. Reviewed By: EricGriffith Differential Revision: D49341898 fbshipit-source-id: 740130d27083b3b6a3f9292403651efa24760667 --- src/igl/vulkan/VulkanImage.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/igl/vulkan/VulkanImage.cpp b/src/igl/vulkan/VulkanImage.cpp index e9f25af2e8..36d19fbe73 100644 --- a/src/igl/vulkan/VulkanImage.cpp +++ b/src/igl/vulkan/VulkanImage.cpp @@ -653,6 +653,7 @@ void VulkanImage::transitionLayout(VkCommandBuffer commandBuffer, case VK_PIPELINE_STAGE_ALL_COMMANDS_BIT: case VK_PIPELINE_STAGE_TRANSFER_BIT: case VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT: + case VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT: break; default: IGL_ASSERT_MSG( @@ -674,6 +675,10 @@ void VulkanImage::transitionLayout(VkCommandBuffer commandBuffer, if (srcStageMask & VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT) { srcAccessMask |= VK_ACCESS_SHADER_WRITE_BIT; } + if (srcStageMask & VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT) { + srcAccessMask |= VK_ACCESS_SHADER_READ_BIT; + srcAccessMask |= VK_ACCESS_SHADER_WRITE_BIT; + } switch (dstStageMask) { case VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT: @@ -682,6 +687,7 @@ void VulkanImage::transitionLayout(VkCommandBuffer commandBuffer, case VK_PIPELINE_STAGE_TRANSFER_BIT: case VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT: case VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT: + case VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT: break; default: IGL_ASSERT_MSG( @@ -700,11 +706,16 @@ void VulkanImage::transitionLayout(VkCommandBuffer commandBuffer, } if (dstStageMask & VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT) { dstAccessMask |= VK_ACCESS_SHADER_READ_BIT; + dstAccessMask |= VK_ACCESS_SHADER_WRITE_BIT; dstAccessMask |= VK_ACCESS_INPUT_ATTACHMENT_READ_BIT; } if (dstStageMask & VK_PIPELINE_STAGE_TRANSFER_BIT) { dstAccessMask |= VK_ACCESS_TRANSFER_READ_BIT; } + if (dstStageMask & VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT) { + dstAccessMask |= VK_ACCESS_COLOR_ATTACHMENT_READ_BIT; + dstAccessMask |= VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; + } ivkImageMemoryBarrier(commandBuffer, vkImage_,