在 Vulkan 中,您可以为每个颜色附件设置一个深度缓冲区吗?

In Vulkan can you have a depth buffer for each colour attachment?

在 Vulkan 中,如果您想写入带有深度缓冲区的颜色缓冲区,您可以为颜色创建一个帧缓冲区附件,并为深度缓冲区创建一个附件。然后,当您创建子通道描述时,您将深度和模板附件指针指向您的深度缓冲区,但似乎只有一个指针:

VkSubpassDescription subpass_description = {};
subpass_description.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
subpass_description.colorAttachmentCount = vk_attachment_descriptions.size();
subpass_description.pColorAttachments = vk_attachment_references.data();
subpass_description.pDepthStencilAttachment;

尽管子通道接受多种颜色附件,但似乎只有一个 pDepthStencilAttachment 指针。写入多个颜色附件时,Vulkan 是否只允许一个深度和模板缓冲区?

Does Vulkan only allow one depth and stencil buffer when writing to multiple colour attachments?

是的。