The texture format to configure surface with: one the surface supports that is not sRGB
(unless srgb), so colors mean the same everywhere. Natively a surface usually lists an sRGB
format first (bgra8unorm-srgb), where the GPU converts the shader's output to sRGB on write;
the browser's canvas has only plain formats. A shader that writes already-encoded colors (or
applies gamma itself) wants srgb = false; one that writes linear colors wants srgb = true,
and must then encode them itself where the surface has no sRGB format (check with
webgpu_format_is_srgb). .Undefined when the surface reports no formats, or is null.
webgpu_surface_format :: (
surface: WGPUSurface,
adapter: WGPUAdapter,
srgb := false
) -> WGPUTextureFormat
The texture format to configure surface with: one the surface supports that is not sRGB
(unless srgb), so colors mean the same everywhere. Natively a surface usually lists an sRGB
format first (bgra8unorm-srgb), where the GPU converts the shader's output to sRGB on write;
the browser's canvas has only plain formats. A shader that writes already-encoded colors (or
applies gamma itself) wants srgb = false; one that writes linear colors wants srgb = true,
and must then encode them itself where the surface has no sRGB format (check with
webgpu_format_is_srgb). .Undefined when the surface reports no formats, or is null.
Parameters
- surface: WGPUSurface
- adapter: WGPUAdapter
- srgb := false
Returns
- WGPUTextureFormat