Skip to content

Commit

Permalink
igl | vulkan | Add more src/dst masks in VulkanImage::transitionLayout()
Browse files Browse the repository at this point in the history
Summary: Add more automatic src/dst stage masks deductions in `VulkanImage::transitionLayout()`.

Reviewed By: EricGriffith

Differential Revision: D49341898

fbshipit-source-id: 740130d27083b3b6a3f9292403651efa24760667
  • Loading branch information
corporateshark authored and facebook-github-bot committed Sep 18, 2023
1 parent 4c2e655 commit 342dc14
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/igl/vulkan/VulkanImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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:
Expand All @@ -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(
Expand All @@ -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_,
Expand Down

0 comments on commit 342dc14

Please sign in to comment.