Vulkan: Fix improper subpass dependency when using the MAY_ALIAS bit

This commit is contained in:
Dr. Chat 2017-01-14 18:04:05 -06:00
parent 06588f8703
commit 9f5abb02b7
1 changed files with 19 additions and 11 deletions

View File

@ -199,6 +199,11 @@ CachedTileView::CachedTileView(ui::vulkan::VulkanDevice* device,
auto err = vkCreateImage(device_, &image_info, nullptr, &image); auto err = vkCreateImage(device_, &image_info, nullptr, &image);
CheckResult(err, "vkCreateImage"); CheckResult(err, "vkCreateImage");
device->DbgSetObjectName(
reinterpret_cast<uint64_t>(image), VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
xe::format_string("%.8X pitch %.8X(%d)", key.tile_offset, key.tile_width,
key.tile_width));
VkMemoryRequirements memory_requirements; VkMemoryRequirements memory_requirements;
vkGetImageMemoryRequirements(*device, image, &memory_requirements); vkGetImageMemoryRequirements(*device, image, &memory_requirements);
@ -394,9 +399,6 @@ CachedRenderPass::CachedRenderPass(VkDevice device,
depth_stencil_attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_STORE; depth_stencil_attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_STORE;
depth_stencil_attachment.initialLayout = VK_IMAGE_LAYOUT_GENERAL; depth_stencil_attachment.initialLayout = VK_IMAGE_LAYOUT_GENERAL;
depth_stencil_attachment.finalLayout = VK_IMAGE_LAYOUT_GENERAL; depth_stencil_attachment.finalLayout = VK_IMAGE_LAYOUT_GENERAL;
VkAttachmentReference depth_stencil_attachment_ref;
depth_stencil_attachment_ref.attachment = VK_ATTACHMENT_UNUSED;
depth_stencil_attachment_ref.layout = VK_IMAGE_LAYOUT_GENERAL;
// Configure attachments based on what's enabled. // Configure attachments based on what's enabled.
VkAttachmentReference color_attachment_refs[4]; VkAttachmentReference color_attachment_refs[4];
@ -409,6 +411,11 @@ CachedRenderPass::CachedRenderPass(VkDevice device,
color_attachment_ref.attachment = i; color_attachment_ref.attachment = i;
color_attachment_ref.layout = VK_IMAGE_LAYOUT_GENERAL; color_attachment_ref.layout = VK_IMAGE_LAYOUT_GENERAL;
} }
// Configure depth.
VkAttachmentReference depth_stencil_attachment_ref;
depth_stencil_attachment_ref.layout = VK_IMAGE_LAYOUT_GENERAL;
auto& depth_config = config.depth_stencil; auto& depth_config = config.depth_stencil;
depth_stencil_attachment_ref.attachment = 4; depth_stencil_attachment_ref.attachment = 4;
depth_stencil_attachment.format = depth_stencil_attachment.format =
@ -436,14 +443,15 @@ CachedRenderPass::CachedRenderPass(VkDevice device,
render_pass_info.subpassCount = 1; render_pass_info.subpassCount = 1;
render_pass_info.pSubpasses = &subpass_info; render_pass_info.pSubpasses = &subpass_info;
// Render passes need subpass dependencies between subpasses acting on aliased // Add a dependency on external render passes -> us (MAY_ALIAS bit)
// attachments.
VkSubpassDependency dependencies[1]; VkSubpassDependency dependencies[1];
dependencies[0].srcSubpass = dependencies[0].dstSubpass = 0; dependencies[0].srcSubpass = VK_SUBPASS_EXTERNAL;
dependencies[0].srcStageMask = dependencies[0].dstStageMask = dependencies[0].dstSubpass = 0;
VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT; dependencies[0].srcStageMask = VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT;
dependencies[0].srcAccessMask = dependencies[0].dstAccessMask = dependencies[0].dstStageMask = VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT;
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | dependencies[0].srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
dependencies[0].dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
dependencies[0].dependencyFlags = 0; dependencies[0].dependencyFlags = 0;