Files
wgpu/tests/validation_tests/root.rs
Kevin Reid c4b25b8794 Duplicate BufferSlice methods onto Buffer and vice versa. (#7123)
This allows users to skip creation of `BufferSlice` if they have no use
for it, and brings `wgpu` closer to the WebGPU API without removing any
Rust convenience. New functions:

* `BufferSlice::slice()`
* `Buffer::map_async()`
* `Buffer::get_mapped_range()`
* `Buffer::get_mapped_range_mut()`
* `Buffer::get_mapped_range()`
2025-02-13 14:40:09 +01:00

26 lines
864 B
Rust

//! Tests of the [`wgpu`] library API that are not run against a particular GPU.
mod api;
mod noop;
/// Obtain a device using [`wgpu::Backend::Noop`].
/// This should never fail.
fn request_noop_device() -> (wgpu::Device, wgpu::Queue) {
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
backends: wgpu::Backends::NOOP,
backend_options: wgpu::BackendOptions {
noop: wgpu::NoopBackendOptions { enable: true },
..Default::default()
},
..Default::default()
});
let adapter =
pollster::block_on(instance.request_adapter(&wgpu::RequestAdapterOptions::default()))
.expect("adapter");
assert_eq!(adapter.get_info().backend, wgpu::Backend::Noop);
pollster::block_on(adapter.request_device(&wgpu::DeviceDescriptor::default(), None))
.expect("device")
}