textureFormatSupport method

  1. @override
TextureFormatSupport textureFormatSupport(
  1. TextureFormat format
)

What format can be used for on what this device was granted — see webgpuTextureFormatSupport. Its sampled is what supportsTextureFormat answers.

Two questions, and the second is asked of the device rather than of a table. A spelling is not permission: bc7-rgba-unorm is a name the specification defines and a device that did not request texture-compression-bc refuses it at allocation and at sampling alike. open asks the adapter which of the three families it carries and requests exactly those, so what came back is what this reads — _gpuDevice.features, not the list of wants. A device may be granted less than it asked for, and a capability answering from a wish is how a loader is told to upload a texture the browser will not take.

Three formats answer none whatever any adapter carries — TextureFormat.a8UNormInt and the two HDR ASTC layouts — because WebGPU has no spelling for them at all. See gpuTextureFormat, which is where that is written down.

Implementation

@override
TextureFormatSupport textureFormatSupport(TextureFormat format) =>
    _formatSupport[format] ??= webgpuTextureFormatSupport(
      format,
      granted: (String feature) => _gpuDevice.features.has(feature),
    );