Skip to content

Commit

Permalink
Merge pull request #17754 from hrydgard/vulkan-validation-fixes
Browse files Browse the repository at this point in the history
Fix an initialLayout issue with the image we use as the backbuffers's depth buffer
  • Loading branch information
hrydgard authored Jul 21, 2023
2 parents 3b9e7bf + 8f6662a commit f6b2ba4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Common/GPU/Vulkan/VulkanFramebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,12 @@ VkRenderPass CreateRenderPass(VulkanContext *vulkan, const RPKey &key, RenderPas
bool multiview = RenderPassTypeHasMultiView(rpType);
bool multisample = RenderPassTypeHasMultisample(rpType);

_dbg_assert_(!(isBackbuffer && multisample));

if (isBackbuffer) {
_dbg_assert_(key.depthLoadAction == VKRRenderPassLoadAction::CLEAR);
}

if (multiview) {
// TODO: Assert that the device has multiview support enabled.
}
Expand All @@ -296,7 +302,7 @@ VkRenderPass CreateRenderPass(VulkanContext *vulkan, const RPKey &key, RenderPas
attachments[attachmentCount].storeOp = ConvertStoreAction(key.depthStoreAction);
attachments[attachmentCount].stencilLoadOp = multisample ? VK_ATTACHMENT_LOAD_OP_DONT_CARE : ConvertLoadAction(key.stencilLoadAction);
attachments[attachmentCount].stencilStoreOp = ConvertStoreAction(key.stencilStoreAction);
attachments[attachmentCount].initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
attachments[attachmentCount].initialLayout = isBackbuffer ? VK_IMAGE_LAYOUT_UNDEFINED : VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
attachments[attachmentCount].finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
attachmentCount++;
}
Expand Down

0 comments on commit f6b2ba4

Please sign in to comment.