Conversation
Whether the swapchain images can carry view formats other than the surface format is now reported per surface by `wgpu_hal::SurfaceCapabilities::native_view_formats`. Vulkan reports `false` when `VK_KHR_swapchain_mutable_format` is unavailable, Metal and DX12 always report `true`, and GLES reports `false`. When the capability is missing, wgpu-core emulates the differing view formats by handing out an intermediate texture that is copied into the swapchain image when presenting. `examples/bug-repro/02_present_bugs` can now exercise both the native and the emulated path with `--emulate-view-formats`, draw a clear pass into the sRGB view of the non-sRGB surface format with `--draw-before-present`, and keep presenting until the window is closed with `--manual-close`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Connections
Fixes #10340
Description
Solution:
wgpu_hal::SurfaceCapabilities::native_view_formats.falsewhenVK_KHR_swapchain_mutable_formatis unavailable, Metal and DX12 always reporttrue, and GLES reportsfalse. When the capability is missing, wgpu-core emulates the differing view formats by handing out an intermediate texture that is copied into the swapchain image when presenting. So vulkan now always supportsSURFACE_VIEW_FORMATS.Testing
examples/bug-repro/02_present_bugscan now exercise both the native and the emulated path with--emulate-view-formats, draw a clear pass into the sRGB view of the non-sRGB surface format with--draw-before-present, and keep presenting until the window is closed with--manual-close.To manually test it:
Squash or Rebase?
Squash
Checklist
CHANGELOG.mdentries for the user-facing effects of this change are present.wgpumay be affected behaviorally.