demo · v132
WebGPU texture format capabilities
Every WebGPU texture format has rules: can it be sampled? Stored? Blended? Used as render target? Here's the matrix, with v132's row highlighted — r32float, rg32float, rgba32float now allow blending if the float32-blendable feature is enabled.
checking support…
| format | sample | storage | render | blend (default) | blend (float32-blendable) |
|---|---|---|---|---|---|
| r8unorm | yes | no | yes | yes | yes |
| rgba8unorm | yes | yes | yes | yes | yes |
| r16float | yes | no | yes | yes | yes |
| rgba16float | yes | yes | yes | yes | yes |
| r32float (v132) | yes | yes | yes | no | yes |
| rg32float (v132) | yes | yes | yes | no | yes |
| rgba32float (v132) | yes | yes | yes | no | yes |
| depth24plus | yes (depth) | no | yes | no | no |
request the feature
const adapter = await navigator.gpu.requestAdapter();
if (!adapter.features.has("float32-blendable")) {
console.log("device cannot blend 32-bit float textures");
}
const device = await adapter.requestDevice({
requiredFeatures: ["float32-blendable"],
});
// now r32float / rg32float / rgba32float
// participate in fragment-stage alpha blending
const pipeline = device.createRenderPipeline({
fragment: {
targets: [{
format: "rgba32float",
blend: {
color: { srcFactor: "src-alpha", dstFactor: "one-minus-src-alpha" },
alpha: { srcFactor: "one", dstFactor: "one-minus-src-alpha" },
}
}]
},
// ...
});
see also
- 32-bit float blending — feature index
- 32-bit float blending demo
- HDR bloom
- spec
- ChromeStatus entry