summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJohn Zulauf <jzulauf@lunarg.com>2020-10-16 18:34:06 -0600
committerJohn Zulauf <jzulauf@lunarg.com>2020-10-16 19:17:07 -0600
commit459fa078e01586f1b9296fb75950fd4c0a9d2b9b (patch)
treee08324bdb9181dd3f93c90cf3d81ded456842af1 /drivers
parent5191a8e9db629a7791820c9786c7fbf8c0ccaec9 (diff)
Add subpass sync support for layout transitions
Add additional source and dest mask bits for "from external" and "to external" subpass dependencies (respectively) when intial and final layouts cause implicit layout transitions. This is a big hammer -- any transition in a given direction will create a full barrier. Attachment specific stage and access flags could be used instead with additional logic to deduce the prior and intended subsequent usages.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index 72a0c128c2..b051fe825c 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -3218,6 +3218,18 @@ VkRenderPass RenderingDeviceVulkan::_render_pass_create(const Vector<AttachmentF
} else {
ERR_FAIL_V_MSG(VK_NULL_HANDLE, "Texture index " + itos(i) + " is neither color, depth stencil or resolve so it can't be used as attachment.");
}
+
+ // NOTE: Big Mallet Approach -- any layout transition causes a full barrier
+ if (reference.layout != description.initialLayout) {
+ // NOTE: this should be smarter based on the textures knowledge of it's previous role
+ dependency_from_external.srcStageMask |= VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
+ dependency_from_external.srcAccessMask |= VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT;
+ }
+ if (reference.layout != description.finalLayout) {
+ // NOTE: this should be smarter based on the textures knowledge of it's subsequent role
+ dependency_from_external.dstStageMask |= VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
+ dependency_from_external.dstAccessMask |= VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT;
+ }
}
ERR_FAIL_COND_V_MSG(depth_stencil_references.size() > 1, VK_NULL_HANDLE,