Skip to main content

headless_test_device

Function headless_test_device 

Source
pub fn headless_test_device(request: &TestDeviceRequest) -> Option<GpuContext>
Available on (crate features testing) and non-WebAssembly only.
Expand description

Returns a headless device for request, or None on a machine without a device.

The device carries its adapter’s henad_compute::runtime_info::RuntimeInfo. Returns None as well when the adapter lacks an optional feature that the request lists, even under HENAD_REQUIRE_GPU. An adapter that offers less than the WebGPU baseline yields no device for a baseline or a raised request.

Note that each test takes its own device. Clones of a context share its fault sink, and a check of the kit attributes every fault it finds there to itself. A device error that another test leaves in a shared sink is then dropped, or reported as that check’s failure.

§Panics

Panics when HENAD_REQUIRE_GPU is set to anything but empty or 0 and no device is available.