wgpu_test

Function fail

Source
pub fn fail<T>(
    device: &Device,
    callback: impl FnOnce() -> T,
    expected_msg_substring: Option<&'static str>,
) -> T
Expand description

Run some code in an error scope and assert that validation fails.

Note that errors related to commands for the GPU (i.e. raised by methods on GPUCommandEncoder, GPURenderPassEncoder, GPUComputePassEncoder, GPURenderBundleEncoder) are usually not raised immediately. They are raised only when finish() is called on the command encoder. Tests of such error cases should call fail with a closure that calls finish(), not with a closure that encodes the actual command.