Skip to content

fix(🐛): Route surfaces configured with viewFormats through the blit path#73

Open
wcandillon wants to merge 2 commits into
google:mainfrom
wcandillon:patch-5
Open

fix(🐛): Route surfaces configured with viewFormats through the blit path#73
wcandillon wants to merge 2 commits into
google:mainfrom
wcandillon:patch-5

Conversation

@wcandillon

Copy link
Copy Markdown
Contributor

Added check for viewFormats in swapchain image usage validation.The Vulkan swapchain creates its images without VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT and wraps them in a texture descriptor that omits the configuration's viewFormats, so the first GetCurrentTexture() fails the viewFormats consistency DAWN_CHECK and aborts. Any non-empty viewFormats now sets needsBlit, like an unsupported extent or usage: the user-facing texture becomes the intermediate blit texture, a regular texture created from the full descriptor, which supports reinterpretation.

Metal already builds the swapchain texture from the full descriptor and is unaffected. Adds a SurfaceTests end2end case; the file previously only exercised viewFormatCount = 0, which is why this went unnoticed.

@Kangz

Kangz commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

The import failed again, do you mind opening a CL on Gerrit? VK_KHR_swapchain_mutable_format should help with this as well, can you either add support for that extension, or add a TODO on a new issue to add support for it?

Added check for viewFormats in swapchain image usage validation.The Vulkan swapchain creates its images without
VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT and wraps them in a texture
descriptor that omits the configuration's viewFormats, so the first
GetCurrentTexture() fails the viewFormats consistency DAWN_CHECK and
aborts. Any non-empty viewFormats now sets needsBlit, like an
unsupported extent or usage: the user-facing texture becomes the
intermediate blit texture, a regular texture created from the full
descriptor, which supports reinterpretation.

Metal already builds the swapchain texture from the full descriptor and
is unaffected. Adds a SurfaceTests end2end case; the file previously
only exercised viewFormatCount = 0, which is why this went unnoticed.

Change-Id: If09df3749bb4de9c9ed011bf924141ea1fbfe15b
When the device supports VK_KHR_swapchain_mutable_format, a surface
configured with viewFormats no longer needs the blit fallback: the
swapchain is created with VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR
and a VkImageFormatListCreateInfo listing the base format and the
viewFormats, and the wrapped texture descriptor carries the
viewFormats so views can reinterpret the swapchain images directly.

The SurfaceTests case is extended to render through the reinterpreted
srgb view instead of only acquiring the texture.

Change-Id: If6557d1600bb45f18c4889c794b924a8fdc49fe9
@wcandillon

Copy link
Copy Markdown
Contributor Author

done ✅ and I also tested the fix on Android

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