mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 05:51:03 +01:00
refactor(tests): Add NoopBackendOptions::enabled() constructor
This commit is contained in:
1 parent
d199493486
commit
f9b4cbf365
5 files changed
+9
-4
No files matched your search
@@ -2,7 +2,7 @@ fn noop_adapter() -> wgpu::Adapter {
|
||||
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
||||
backends: wgpu::Backends::NOOP,
|
||||
backend_options: wgpu::BackendOptions {
|
||||
noop: wgpu::NoopBackendOptions { enable: true },
|
||||
noop: wgpu::NoopBackendOptions::enabled(),
|
||||
..Default::default()
|
||||
},
|
||||
..wgpu::InstanceDescriptor::new_without_display_handle()
|
||||
|
||||
@@ -19,7 +19,7 @@ fn device_is_available_when_requested() {
|
||||
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
||||
backends: wgpu::Backends::NOOP,
|
||||
backend_options: wgpu::BackendOptions {
|
||||
noop: wgpu::NoopBackendOptions { enable: true },
|
||||
noop: wgpu::NoopBackendOptions::enabled(),
|
||||
..Default::default()
|
||||
},
|
||||
..wgpu::InstanceDescriptor::new_without_display_handle()
|
||||
|
||||
@@ -20,7 +20,7 @@ fn trace_test(test_type: TestType) {
|
||||
wgt::instance::InstanceDescriptor {
|
||||
backends: wgt::Backends::NOOP,
|
||||
backend_options: wgt::BackendOptions {
|
||||
noop: wgt::NoopBackendOptions { enable: true },
|
||||
noop: wgt::NoopBackendOptions::enabled(),
|
||||
..Default::default()
|
||||
},
|
||||
..wgt::instance::InstanceDescriptor::new_without_display_handle()
|
||||
|
||||
@@ -613,6 +613,11 @@ pub struct NoopBackendOptions {
|
||||
}
|
||||
|
||||
impl NoopBackendOptions {
|
||||
/// Enable the noop backend.
|
||||
pub fn enabled() -> Self {
|
||||
Self { enable: true }
|
||||
}
|
||||
|
||||
/// Choose whether the noop backend is enabled from the environment.
|
||||
///
|
||||
/// It will be enabled if the environment variable `WGPU_NOOP_BACKEND` has the value `1`
|
||||
|
||||
@@ -63,7 +63,7 @@ impl Device {
|
||||
let instance = Instance::new(InstanceDescriptor {
|
||||
backends: Backends::NOOP,
|
||||
backend_options: BackendOptions {
|
||||
noop: NoopBackendOptions { enable: true },
|
||||
noop: NoopBackendOptions::enabled(),
|
||||
..Default::default()
|
||||
},
|
||||
..InstanceDescriptor::new_without_display_handle()
|
||||
|
||||
Reference in new issue
Block a user