From 208533f4905cbb9d4770b6445a7fc234b272ffd9 Mon Sep 17 00:00:00 2001 From: Kearwood Gilbert Date: Fri, 12 Jan 2024 21:22:43 -0800 Subject: [PATCH] Fix validation error on render passes that do not clear the depth buffer on load. --- kraken/KRRenderPass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kraken/KRRenderPass.cpp b/kraken/KRRenderPass.cpp index 7ceb80c..96c8224 100644 --- a/kraken/KRRenderPass.cpp +++ b/kraken/KRRenderPass.cpp @@ -71,7 +71,7 @@ void KRRenderPass::create(KRDevice& device, VkFormat swapChainImageFormat, VkFor depthAttachment.storeOp = info.keepDepth ? VK_ATTACHMENT_STORE_OP_STORE : VK_ATTACHMENT_STORE_OP_DONT_CARE; depthAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; depthAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; - depthAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; + depthAttachment.initialLayout = info.clearDepth ? VK_IMAGE_LAYOUT_UNDEFINED : VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; depthAttachment.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; VkAttachmentReference depthAttachmentRef{};