StorageTextureFormat
Type in Types
The texel formats a storage texture may carry, which is WebGPU's set of formats every device supports with STORAGE_BINDING and no optional feature.
import type { StorageTextureFormat } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
type StorageTextureFormat = | 'rgba8unorm' | 'rgba8snorm' | 'rgba8uint' | 'rgba8sint' | 'rgba16uint' | 'rgba16sint' | 'rgba16float' | 'r32uint' | 'r32sint' | 'r32float' | 'rg32uint' | 'rg32sint' | 'rg32float' | 'rgba32uint' | 'rgba32sint' | 'rgba32float' | 'bgra8unorm';Description
Measured rather than read off a spec: a real device was asked to build a bind group layout
for each format at each access mode, and these sixteen are the ones a device with nothing
requested took. The tiered texture-format formats (r8unorm, rg8unorm, rgb10a2unorm,
rg16float and their siblings) are not here: a module naming one compiles on Tint and then
fails at createBindGroupLayout, which is a wrong program emitted without a diagnostic.
bgra8unorm Is here, as the seventeenth and the only one that is not core. It is
measured too, on two independent Chromium builds: a device with no feature requested refuses
it (“Texture format TextureFormat::BGRA8Unorm does not support storage texture access
StorageTextureAccess::WriteOnly”), a device that requested bgra8unorm-storage takes it at
write, and both refuse it at read and read_write. Tint accepts every one of those
spellings, so the compile gate cannot see the difference and a capability is what carries
it: a module using the format needs bgra8unormStorage, which reflect().requiredFeatures
hands the host as the feature to request. WRITE_ONLY_STORAGE_FORMATS is the access
half of the same measurement.
See also
Source
src/core/ir/types.ts, line 53, at commit 26de7be8