Skip to content

Fix colorAttachmentCount error in dynamicrenderinglocalread example - #1268

Open
SRSaunders wants to merge 7 commits into
SaschaWillems:masterfrom
SRSaunders:dynlocalread-resize
Open

SRSaunders wants to merge 7 commits into
SaschaWillems:masterfrom
SRSaunders:dynlocalread-resize

Conversation

@SRSaunders

@SRSaunders SRSaunders commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1267 #1271.

This change fixes startup resize for dynamicrenderinglocalread to support non-default device screen sizes.

This also updates the iOS subproject to include this new sample and make it work on iOS devices and the Simulator.

UPDATED: Now fixes some validation layer errors in the example (all platforms):

  1. Wrong image layout validation error. Original fix in this PR has now been reverted. This remains an outstanding VVL bug, see Validation for dynamic rendering attachment layout possibly doesn't respect input attachment indices for local reads KhronosGroup/Vulkan-ValidationLayers#12039
  2. Fixes the non-matching color attachment count when drawing the UI (1 actual vs. 4 expected)
  3. Failure to destroy buffer and memory on exit. Already fixed in master.
  4. Fixes some missing overrides (static analysis warnings in IDE)

@SRSaunders

SRSaunders commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor Author

FYI, another way to handle this could be to move the attachment resize logic out of setupFrameBuffer() and into a new windowResized() entry point override for the example. Some examples do this, while others use the resized flag in either setupFrameBuffer() or buildCommandBuffer() (e.g. the ray tracing examples).

Given that it looks like a stylistic thing vs. functional, I decided to leave things alone and just use the resized flag.

@SRSaunders SRSaunders changed the title Fix initial resize handling for dynamicrenderinglocalread Add dynamicrenderinglocalread to iOS subproject Apr 11, 2026
@SRSaunders

Copy link
Copy Markdown
Contributor Author

Limited PR to adding dynamicrenderinglocalread example to iOS subproject and iOS Simulator.

Resize logic now handled by changes within master branch.

@SRSaunders

Copy link
Copy Markdown
Contributor Author

Updated PR to include validation error fixes for dynamicrenderinglocalread.

.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO,
.imageView = imageViewList[i],
.imageLayout = VK_IMAGE_LAYOUT_RENDERING_LOCAL_READ_KHR,
.imageLayout = (i == 0) ? VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_RENDERING_LOCAL_READ_KHR,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I don't think this needs fixing. IMO this is a false positive and I've raised an issue in the VVL repo about this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Interesting. Referring to your issue KhronosGroup/Vulkan-ValidationLayers#12039 where you discuss VK_ATTACHMENT_UNUSED, do you think this requires the VK_EXT_dynamic_rendering_unused_attachments extension to make this work for dynamic rendering?

MoltenVK does not support this extension so I can't test there. However, I will try on my Windows 11 and linux machines to see if my AMD card supports it, and report back later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Scratch that idea re the VK_EXT_dynamic_rendering_unused_attachments extension. Looks like that is for adapting to multiple pipelines where you can have an unused attachment in one, but not the other.

I will leave my original change in place for now and resolve once your VVL issue is looked at.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@SaschaWillems I have given up waiting for the VVL team to fix this defect. I have reverted my workaround in this PR and limited the scope to fixing the remaining colorAttachmentCount validation issue, as well as correcting a few IDE static analysis warnings. See updated description at the top of this PR.

Should now be ready for your review and merge.

Comment thread examples/dynamicrenderinglocalread/dynamicrenderinglocalread.cpp Outdated
@SRSaunders SRSaunders changed the title Add dynamicrenderinglocalread to iOS subproject Fix colorAttachmentCount error in dynamicrenderinglocalread example Aug 24, 2026
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.

2 participants