附件与附件描述的关系

Relationship of attachments to attachmentdescriptions

渲染通道有一个帧缓冲区,其图像视图用作附件。渲染通道还有一个 VkAttachmentDescriptions 数组,提供有关其附件的信息。

但规范并未明确说明附件与描述之间的关系。也就是没有说第一个VkAttachmentDescription对应第一个附件,第二个描述对应第二个附件,以此类推

规范中的文本是:

pAttachments points to an array of attachmentCount number of VkAttachmentDescription structures describing properties of the attachments, or NULL if attachmentCount is zero.

我们能否假设渲染过程的附件与其附件描述之间始终存在一对一的对应关系?

谢谢。

But the specification doesn't explicitly say how the attachments are related to the descriptions.

当然可以:

pAttachments is an array of VkImageView handles, each of which will be used as the corresponding attachment in a render pass instance.

那是 from the specification on VkFramebufferCreateInfo。有效性规则也明确了这一点:

attachmentCount must be equal to the attachment count specified in renderPass.

来自 VkFramebufferCreatInfo 有效性规则的更多元素:

Any given element of pAttachments must have been created with an VkFormat value that matches the VkFormat specified by the corresponding VkAttachmentDescription in renderPass.

"Any given element of pAttachments [must match some property of] the corresponding VkAttachmentDescription in renderPass." 形式有多个有效性规则,这就是它们之间的关系。