Skip to main content

Module capabilities

Module capabilities 

Source
Expand description

What the device can do beyond the WebGPU baseline, and how to ask for a narrower device.

WebGPU sets a floor every implementation meets, but wgpu also runs on implementations that miss parts of it — WebGL2 most notably, which has no storage buffers, no base_vertex and no view formats. Which parts are missing is a property of the adapter, reported by [wgpu::Adapter::get_downlevel_capabilities]. [wgpu::Device] exposes its limits and features but not the downlevel flags, and the adapter is normally dropped once the device is built.

So DeviceCapabilities is captured where the adapter still exists, and carried to where the frame is recorded. It holds only what the device cannot answer for itself: the rest is already visible on the device — whether a storage buffer can be bound is supports_storage_buffers, read from the device’s own limits — and asking two sources for one answer is how they drift apart.

DeviceTier is the other half: how much of the baseline to ask for. The two are separate because a device can be narrower than the adapter underneath it, and asking for the baseline rather than the adapter’s own limits is what keeps a frame within reach of every implementation it claims to run on.

Re-exports§

use core::fmt; 🔒

Structs§

DeviceCapabilities
The downlevel capabilities a frame is recorded against.

Enums§

DeviceTier
How much of the WebGPU baseline to ask a device for.

Constants§

TIER_ENV 🔒
The environment variable that narrows the device to a tier.