From 9f5abb02b7c23850440588c8ba6d6405527b625e Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Sat, 14 Jan 2017 18:04:05 -0600 Subject: [PATCH] Vulkan: Fix improper subpass dependency when using the MAY_ALIAS bit --- src/xenia/gpu/vulkan/render_cache.cc | 30 ++++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/xenia/gpu/vulkan/render_cache.cc b/src/xenia/gpu/vulkan/render_cache.cc index c08709ae0..43db3c47c 100644 --- a/src/xenia/gpu/vulkan/render_cache.cc +++ b/src/xenia/gpu/vulkan/render_cache.cc @@ -199,6 +199,11 @@ CachedTileView::CachedTileView(ui::vulkan::VulkanDevice* device, auto err = vkCreateImage(device_, &image_info, nullptr, &image); CheckResult(err, "vkCreateImage"); + device->DbgSetObjectName( + reinterpret_cast(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; 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.initialLayout = 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. VkAttachmentReference color_attachment_refs[4]; @@ -409,6 +411,11 @@ CachedRenderPass::CachedRenderPass(VkDevice device, color_attachment_ref.attachment = i; 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; depth_stencil_attachment_ref.attachment = 4; depth_stencil_attachment.format = @@ -436,15 +443,16 @@ CachedRenderPass::CachedRenderPass(VkDevice device, render_pass_info.subpassCount = 1; render_pass_info.pSubpasses = &subpass_info; - // Render passes need subpass dependencies between subpasses acting on aliased - // attachments. + // Add a dependency on external render passes -> us (MAY_ALIAS bit) VkSubpassDependency dependencies[1]; - dependencies[0].srcSubpass = dependencies[0].dstSubpass = 0; - dependencies[0].srcStageMask = dependencies[0].dstStageMask = - VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT; - dependencies[0].srcAccessMask = dependencies[0].dstAccessMask = - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | - VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; + dependencies[0].srcSubpass = VK_SUBPASS_EXTERNAL; + dependencies[0].dstSubpass = 0; + dependencies[0].srcStageMask = VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT; + dependencies[0].dstStageMask = VK_PIPELINE_STAGE_ALL_GRAPHICS_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; dependencies[0].dependencyFlags = 0; render_pass_info.dependencyCount = 1;