Commit 0516e8a5 by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Fix subpass declaration for depth/stencil-only FBOs

If an FBO only has a depth/stencil attachment, the attachment index will be 0, but that value was incorrectly being used as a flag for no depth/stencil attachment. Bug: angleproject:2361 Change-Id: I4ee803a392a29f7b261bc0cfabf9f2507dc7b178 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1541670 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 6854940d
......@@ -187,7 +187,7 @@ angle::Result InitializeRenderPassFromDesc(vk::Context *context,
// Unpack the packed and split representation into the format required by Vulkan.
gl::DrawBuffersVector<VkAttachmentReference> colorAttachmentRefs;
VkAttachmentReference depthStencilAttachmentRef = {};
VkAttachmentReference depthStencilAttachmentRef = {VK_ATTACHMENT_UNUSED};
gl::AttachmentArray<VkAttachmentDescription> attachmentDescs;
for (uint32_t attachmentIndex = 0; attachmentIndex < attachmentCount; ++attachmentIndex)
{
......@@ -205,7 +205,7 @@ angle::Result InitializeRenderPassFromDesc(vk::Context *context,
}
else
{
ASSERT(depthStencilAttachmentRef.attachment == 0);
ASSERT(depthStencilAttachmentRef.attachment == VK_ATTACHMENT_UNUSED);
depthStencilAttachmentRef.attachment = attachmentIndex;
depthStencilAttachmentRef.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
}
......@@ -224,7 +224,8 @@ angle::Result InitializeRenderPassFromDesc(vk::Context *context,
subpassDesc.pColorAttachments = colorAttachmentRefs.data();
subpassDesc.pResolveAttachments = nullptr;
subpassDesc.pDepthStencilAttachment =
(depthStencilAttachmentRef.attachment > 0 ? &depthStencilAttachmentRef : nullptr);
(depthStencilAttachmentRef.attachment != VK_ATTACHMENT_UNUSED ? &depthStencilAttachmentRef
: nullptr);
subpassDesc.preserveAttachmentCount = 0;
subpassDesc.pPreserveAttachments = nullptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment