GPU: safe, discoverable surface format selection (wide-gamut/HDR) - #33
Open
codymullins wants to merge 1 commit into
Open
GPU: safe, discoverable surface format selection (wide-gamut/HDR)#33codymullins wants to merge 1 commit into
codymullins wants to merge 1 commit into
Conversation
Expose surface-format support so a consumer can ask for a wide-gamut or HDR format and fall back safely, and turn an unsupported format into a managed error instead of a wgpu process abort. - WindowSurfaceCapabilities.Supports(TextureFormat) and ChooseFormat, mirroring the present-mode and alpha-mode helpers. - WindowSurface.Configure validates the requested format against the surface's capabilities, the way it already does for the alpha mode. Addresses #26
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.
Addresses #26.
Scope note
wgpu-native's surface configuration has no explicit color-space, tone-mapping, or gamma field — on WebGPU, wide-gamut and HDR are selected through the surface format (e.g. a float format like
Rgba16floatfor extended range, or an sRGB vs linear 8-bit format for gamut). So the useful, in-platform deliverable is making format selection safe and discoverable. Explicit color-space/gamma knobs are a wgpu-native API limitation, not something Skyline can plumb today — noted here so #26 can be closed or rescoped with that understanding.What changed (all in
Skyline.Gpu)WindowSurfaceCapabilities.Supports(TextureFormat)andChooseFormat(...preferred)— pick the first supported format from a preference list, falling back to the surface's own preferred format. Mirrors the existingChoosePresentMode/Supports(PresentMode)/Supports(CompositeAlphaMode)helpers.WindowSurface.Configurenow validates the requested format against the surface's capabilities and throws a managedInvalidOperationException— today an unsupported format makes wgpu'sSurfaceConfigureabort the process with a non-unwinding panic. This mirrors the alpha-mode validation already there.Tests
Skyline.WindowedTests—Supports/ChooseFormat(supported, preferred-fallback), and thatConfigurethrows a managed error on an unsupported single-channel format (the analog of the existing alpha-mode test).Verification
dotnet build Skyline.slnxclean (0 warnings); headless tests pass; windowed harness passes (92 checks);format-check.shclean.WindowSurfaceCapabilities100%; my newWindowSurfacelines are covered. The only uncoveredWindowSurfacelines (the stale-swapchain-with-live-texture release path) are pre-existing — cleanmainshows the identical lines uncovered in this environment (verified by A/B). Overall line coverage matchesmain.Note
Isolated to
Skyline.Gpu(plus the GPU section of the windowed harness), so no conflict with the open window/input PRs (#30/#31/#32).