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.
Trait Implementations§
Source§impl Clone for WgpuSetupCreateNew
impl Clone for WgpuSetupCreateNew
Source§impl Debug for WgpuSetupCreateNew
impl Debug for WgpuSetupCreateNew
Source§impl Default for WgpuSetupCreateNew
impl Default for WgpuSetupCreateNew
Source§impl From<WgpuSetupCreateNew> for WgpuSetup
impl From<WgpuSetupCreateNew> for WgpuSetup
Source§fn from(create_new: WgpuSetupCreateNew) -> Self
fn from(create_new: WgpuSetupCreateNew) -> Self
Auto Trait Implementations§
impl Freeze for WgpuSetupCreateNew
impl !RefUnwindSafe for WgpuSetupCreateNew
impl Send for WgpuSetupCreateNew
impl Sync for WgpuSetupCreateNew
impl Unpin for WgpuSetupCreateNew
impl !UnwindSafe for WgpuSetupCreateNew
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.