Skip to content

Commit 88c34b4

Browse files
Handle depth MSAA resolve
1 parent 0809e62 commit 88c34b4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lvk/vulkan/VulkanClasses.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,6 +2159,16 @@ void lvk::CommandBuffer::cmdBeginRendering(const lvk::RenderPass& renderPass, co
21592159
.storeOp = storeOpToVkAttachmentStoreOp(descDepth.storeOp),
21602160
.clearValue = {.depthStencil = {.depth = descDepth.clearDepth, .stencil = descDepth.clearStencil}},
21612161
};
2162+
// handle depth MSAA
2163+
if (descDepth.storeOp == StoreOp_MsaaResolve) {
2164+
LVK_ASSERT(depthTexture.vkSamples_ == samples);
2165+
const lvk::Framebuffer::AttachmentDesc& attachment = fb.depthStencil;
2166+
LVK_ASSERT_MSG(!attachment.resolveTexture.empty(), "Framebuffer attachment should contain a resolve texture");
2167+
lvk::VulkanImage& depthResolveTexture = *ctx_->texturesPool_.get(attachment.resolveTexture);
2168+
depthAttachment.resolveImageView = depthResolveTexture.getOrCreateVkImageViewForFramebuffer(*ctx_, descDepth.level, descDepth.layer);
2169+
depthAttachment.resolveImageLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
2170+
depthAttachment.resolveMode = VK_RESOLVE_MODE_AVERAGE_BIT;
2171+
}
21622172
const VkExtent3D dim = depthTexture.vkExtent_;
21632173
if (fbWidth) {
21642174
LVK_ASSERT_MSG(dim.width == fbWidth, "All attachments should have the save width");

0 commit comments

Comments
 (0)