pub enum WgpuSetup {
CreateNew(WgpuSetupCreateNew),
Existing(WgpuSetupExisting),
}
Variants§
CreateNew(WgpuSetupCreateNew)
Construct a wgpu setup using some predefined settings & heuristics. This is the default option. You can customize most behaviours overriding the supported backends, power preferences, and device description.
By default can also be configured with various environment variables:
WGPU_BACKEND
:vulkan
,dx12
,metal
,opengl
,webgpu
WGPU_POWER_PREF
:low
,high
ornone
WGPU_TRACE
: Path to a file to output a wgpu trace file.
Each instance flag also comes with an environment variable (for details see wgpu::InstanceFlags
):
WGPU_VALIDATION
: Enables validation (enabled by default in debug builds).WGPU_DEBUG
: Generate debug information in shaders and objects (enabled by default in debug builds).WGPU_ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER
: Whether wgpu should expose adapters that run on top of non-compliant adapters.WGPU_GPU_BASED_VALIDATION
: Enable GPU-based validation.
Existing(WgpuSetupExisting)
Run on an existing wgpu setup.
Implementations§
Source§impl WgpuSetup
impl WgpuSetup
Sourcepub async fn new_instance(&self) -> Instance
pub async fn new_instance(&self) -> Instance
Creates a new wgpu::Instance
or clones the existing one.
Does not store the wgpu instance, so calling this repeatedly may create a new instance every time!
Trait Implementations§
Source§impl From<WgpuSetupCreateNew> for WgpuSetup
impl From<WgpuSetupCreateNew> for WgpuSetup
Source§fn from(create_new: WgpuSetupCreateNew) -> Self
fn from(create_new: WgpuSetupCreateNew) -> Self
Converts to this type from the input type.
Source§impl From<WgpuSetupExisting> for WgpuSetup
impl From<WgpuSetupExisting> for WgpuSetup
Source§fn from(existing: WgpuSetupExisting) -> Self
fn from(existing: WgpuSetupExisting) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for WgpuSetup
impl !RefUnwindSafe for WgpuSetup
impl Send for WgpuSetup
impl Sync for WgpuSetup
impl Unpin for WgpuSetup
impl !UnwindSafe for WgpuSetup
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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.