Skip to content

questions about renderpass compatibility #2517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
njuwau9 opened this issue Mar 29, 2025 · 2 comments
Open

questions about renderpass compatibility #2517

njuwau9 opened this issue Mar 29, 2025 · 2 comments
Assignees

Comments

@njuwau9
Copy link

njuwau9 commented Mar 29, 2025

In chapter renderpass compatibility, it states that:

Two attachment references are compatible if they have matching format and sample count, or are both ename:VK_ATTACHMENT_UNUSED or the pointer that would contain the reference is NULL.

I'm wondering what's the meaning of the 3rd condition or the pointer that would contain the reference is NULL.
What if we have two VkSubpassDescription, all other compatibility requirements are met except that one has a valid pInputAttachments, while the other has NULL pInputAttachments.

is the two compatibility with each other?

// renderpass 1
VkSubpassDescription subpass = {
    .inputAttachmentCount= 0,
    .pInputAttachments= NULL,
};

// renderpass 2
VkSubpassDescription subpass = {
    .inputAttachmentCount= 1,
    .pInputAttachments= &inputAttachments, // valid pointer
    // all other references are compatible with renderpass 1
};

OR does the 3rd condition simply means that both attachment reference array are NULL?
what does the word pointer stands for?

thanks.

@FuXiii
Copy link
Contributor

FuXiii commented Apr 8, 2025

看起来应该就是两个 VkSubpassDescription::pInputAttachments 都是 NULL 是兼容(两者皆NULL的情况),一个是有效指针,另一个是无效指针应该是不兼容的。 Vulkan 中有很多 both A or B ,一般都是要么全满足 A 要么全满足 B

Looks like we need both VkSubpassDescription::pInputAttachments to be NULL will become compatible(the case: both is NULL), one is valid and another is invalid will become incompatible. In Vulkan has many description like both A or B , basically, they're all talking about: Either both of them a A or B.

但是基于文档原文,可能如下情况两者是兼容的:

But according the specification, maybe the following case is compatible:

// renderpass 1
VkSubpassDescription subpass = {
    .inputAttachmentCount = 0,
    .pInputAttachments = NULL,
};

// renderpass 2
VkAttachmentReference ar = {};
ar.attachment  = VK_ATTACHMENT_UNUSED;
ar.layout = VK_IMAGE_LAYOUT_UNDEFINED;

VkSubpassDescription subpass = {
    .inputAttachmentCount = 1,
    .pInputAttachments = &ar;
};

@r-potter
Copy link
Contributor

This should be clarified in the next spec update. The new text will say:

Two attachment references are compatible if they have matching format and sample count, or are both VK_ATTACHMENT_UNUSED.

Two arrays of attachment references are compatible if all corresponding pairs of attachments are compatible. If the arrays are of different lengths, attachment references not present in the smaller array are treated as VK_ATTACHMENT_UNUSED. If the pointer that would contain the reference is NULL, the attachment reference is treated as VK_ATTACHMENT_UNUSED.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants