WebGPU module

webgpu_surface_format

procedureextensionexperimentalSource

The format to configure surface with: one it supports that is not sRGB, unless srgb is set, so colours mean the same everywhere. Natively a surface usually lists an sRGB format first, where the GPU converts the shader's output on write; a browser canvas has only plain formats. A shader that writes already encoded colours wants srgb = false; one that writes linear colours wants srgb = true and must encode them itself where the surface has no sRGB format (see webgpu_format_is_srgb). Returns .Undefined when the surface lists none.

Example↗
surface: WGPUSurface;
adapter: WGPUAdapter;
format := webgpu_surface_format(surface, adapter);

This one is only checked to compile, not run.

webgpu_surface_format :: (
    surface: WGPUSurface,
    adapter: WGPUAdapter,
    srgb := false
) -> WGPUTextureFormat

Parameters

surface: WGPUSurface
adapter: WGPUAdapter
srgb := false

Returns

See also