pub struct WgpuSetupCreateNew {
pub instance_descriptor: InstanceDescriptor,
pub power_preference: PowerPreference,
pub native_adapter_selector: Option<NativeAdapterSelectorMethod>,
pub device_descriptor: Arc<dyn Fn(&Adapter) -> DeviceDescriptor<'static> + Send + Sync>,
pub trace_path: Option<PathBuf>,
}
Expand description
Configuration for creating a new wgpu setup.
Used for WgpuSetup::CreateNew
.
Fields§
§instance_descriptor: InstanceDescriptor
Instance descriptor for creating a wgpu instance.
The most important field is wgpu::InstanceDescriptor::backends
, which
controls which backends are supported (wgpu will pick one of these).
If you only want to support WebGL (and not WebGPU),
you can set this to wgpu::Backends::GL
.
By default on web, WebGPU will be used if available.
WebGL will only be used as a fallback,
and only if you have enabled the webgl
feature of crate wgpu
.
power_preference: PowerPreference
Power preference for the adapter if Self::native_adapter_selector
is not set or targeting web.
native_adapter_selector: Option<NativeAdapterSelectorMethod>
Optional selector for native adapters.
This field has no effect when targeting web!
Otherwise, if set Self::power_preference
is ignored and the adapter is instead selected by this method.
Note that Self::instance_descriptor
’s wgpu::InstanceDescriptor::backends
are still used to filter the adapter enumeration in the first place.
Defaults to None
.
device_descriptor: Arc<dyn Fn(&Adapter) -> DeviceDescriptor<'static> + Send + Sync>
Configuration passed on device request, given an adapter
trace_path: Option<PathBuf>
Option path to output a wgpu trace file.
This only works if this feature is enabled in wgpu-core
.
Does not work when running with WebGPU.
Defaults to the path set in the WGPU_TRACE
environment variable.