mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
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()`
26 lines
864 B
Rust
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")
|
|
}
|