refactor(tests): Add NoopBackendOptions::enabled() constructor

This commit is contained in:
Andy Leiserson committed 2026-03-23 18:25:15 -07:00
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()
+1 -1
View File
@@ -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()
+1 -1
View File
@@ -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()
+5
View File
@@ -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`
+1 -1
View File
@@ -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()