Skip to content

layers: Allow color access for depth/stencil resolves in BP - #13241

Merged
spencer-lunarg merged 1 commit into
KhronosGroup:mainfrom
apollo-2006:bp-ds-resolve-access
Sep 28, 2026
Merged

spencer-lunarg merged 1 commit into
KhronosGroup:mainfrom
apollo-2006:bp-ds-resolve-access

Conversation

@apollo-2006

Copy link
Copy Markdown
Contributor

Fixes #11341.

The spec's resolve operations section says reads from the multisample attachment use COLOR_ATTACHMENT_READ, access to the single sample attachment uses COLOR_ATTACHMENT_READ/WRITE, and "these pipeline stage and access types are used whether the attachments are color or depth/stencil attachments". BestPractices-ImageBarrierAccessLayout only accepted the depth/stencil attachment accesses for the depth/stencil layouts, so the reporter's barrier on a depth/stencil resolve attachment (srcAccessMask = COLOR_ATTACHMENT_WRITE) got:

... accessMask is VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT, but for layout VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL expected accessMask are VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_READ_BIT|VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT.

While looking into it I realized the resolve has two sides, so this covers both:

  • allows COLOR_ATTACHMENT_READ/WRITE for DEPTH_STENCIL_ATTACHMENT_OPTIMAL, DEPTH_ATTACHMENT_OPTIMAL, STENCIL_ATTACHMENT_OPTIMAL and the attachment aspect of the two mixed layouts, since the resolve attachment is written
  • allows only COLOR_ATTACHMENT_READ for DEPTH_STENCIL_READ_ONLY_OPTIMAL, DEPTH_READ_ONLY_OPTIMAL, STENCIL_READ_ONLY_OPTIMAL and the read-only aspect of the mixed layouts, since the multisample attachment is only read. As far as I can tell nothing stops it from being in a read-only layout (the resolveImageLayout VUs only rule out read-only layouts for the resolve attachment), but I may well have missed something there

Tests:

  • PositiveBestPractices.DepthStencilResolveAccessMask does the reporter's barrier, then each layout and aspect above on both the src and dst side, plus a sync1 barrier. On main it gets 23 warnings (all 12 barriers, both sides); with this change, none.
  • NegativeBestPractices.DepthStencilReadOnlyResolveWrite checks that COLOR_ATTACHMENT_WRITE is still reported for each read-only layout and aspect. It passes on main and with this change, and fails if the read-only layouts are given WRITE as well.

I ran the full suite with the mock ICD and max_profile.json with no failures, and the full suite on lavapipe and RADV (RX 9070 XT). The only differences from main there are pre-existing failures, crashes and one flaky GPU-AV test, none in Best Practices.

If you'd rather keep this to just the resolve attachment side, I'm happy to drop the read-only part.

Multisample resolve operations use the color attachment access types
even when the attachments are depth/stencil, but
BestPractices-ImageBarrierAccessLayout only allowed depth/stencil
attachment accesses for the depth/stencil layouts, so barriers that
followed the spec for a resolve were warned about.

Allow COLOR_ATTACHMENT_READ/WRITE for the depth/stencil attachment
layouts, where the single sample attachment is written, and
COLOR_ATTACHMENT_READ for the read-only ones, where the multisample
attachment is only read.
@apollo-2006
apollo-2006 requested a review from a team as a code owner September 27, 2026 22:32
@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build.

@spencer-lunarg
spencer-lunarg merged commit 225b18e into KhronosGroup:main Sep 28, 2026
20 checks passed
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

Successfully merging this pull request may close these issues.

[Best practices] Possible inaccuracy/bug regarding depth/stencil resolve attachment access masks

3 participants