Skip to content
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

vulkan: fix subpass validation #6980

Merged
merged 3 commits into from
Jul 25, 2023
Merged

vulkan: fix subpass validation #6980

merged 3 commits into from
Jul 25, 2023

Conversation

poweifeng
Copy link
Contributor

  • Before, we supposed that the maximum number of input attachment should match the maximum number of color attachments. But in reality, we've only used one input attachment for the second subpass.
  • The problem with the above supposition is that the descriptor set layout for the input attachment descriptor set must have the exact number of input attachment specified in the shader. If the layout has more input attachment slots than specified in the shader, then we'd run into a validation error.
  • In this patch, we fix the number of max input attachment in the descriptor set layout to 1, since we ever only make use of one.

Fixes #6513

 - Before, we supposed that the maximum number of input attachment
   should match the maximum number of color attachments. But in
   reality, we've only used one input attachment for the second
   subpass.
 - The problem with the above supposition is that the descriptor
   set layout for the input attachment descriptor set must have the
   exact number of input attachment specified in the shader. If the
   *layout* has more input attachment slots than specified in the
   shader, then we'd run into a validation error.
 - In this patch, we fix the number of max input attachment in
   the descriptor set layout to 1, since we ever only make use of
   one.

Fixes #6513
@poweifeng poweifeng added the internal Issue/PR does not affect clients label Jul 21, 2023
@poweifeng poweifeng requested review from pixelflinger and bejado and removed request for pixelflinger July 21, 2023 20:31
Comment on lines +62 to +65
// We assume only one possible input attachment between two subpasses. See also the subpasses
// definition in VulkanFboCache.
static constexpr uint32_t INPUT_ATTACHMENT_COUNT = 1;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what would need to change so that we break that assumption? I suppose the material knows how many inputs it has, so that should be passed to the renderpass or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the really general case, we'd need to know how many subpasses, and the attachment -> input mapping between consecutive subpasses at the start of the renderpass.

right now we assume we have at most one additional subpass, and the sole input attachment to the second subpass is always the first color attachment.

@poweifeng poweifeng merged commit 6726ccb into main Jul 25, 2023
8 checks passed
@poweifeng poweifeng deleted the pf/fix-subpass-validation branch July 25, 2023 18:24
plepers pushed a commit to plepers/filament that referenced this pull request Dec 9, 2023
- Before, we supposed that the maximum number of input attachment
   should match the maximum number of color attachments. But in
   reality, we've only used one input attachment for the second
   subpass.
 - The problem with the above supposition is that the descriptor
   set layout for the input attachment descriptor set must have the
   exact number of input attachment specified in the shader. If the
   *layout* has more input attachment slots than specified in the
   shader, then we'd run into a validation error.
 - In this patch, we fix the number of max input attachment in
   the descriptor set layout to 1, since we ever only make use of
   one.

Fixes google#6513
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Issue/PR does not affect clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vulkan debug report : Input attachment descriptor image view is not a subpass input attachment
2 participants