pub struct InstanceDescriptor {
pub backends: Backends,
pub flags: InstanceFlags,
pub memory_budget_thresholds: MemoryBudgetThresholds,
pub backend_options: BackendOptions,
}Expand description
Options for creating an instance.
If you want to allow control of instance settings via environment variables, call either
InstanceDescriptor::from_env_or_default() or InstanceDescriptor::with_env(). Each type
within this descriptor has its own equivalent methods, so you can select which options you want
to expose to influence from the environment.
Fields§
§backends: BackendsWhich Backends to enable.
Backends::BROWSER_WEBGPU has an additional effect:
If it is set and a navigator.gpu
object is present, this instance will only be able to create WebGPU adapters.
⚠️ On some browsers this check is insufficient to determine whether WebGPU is supported,
as the browser may define the navigator.gpu object, but be unable to create any WebGPU adapters.
For targeting both WebGPU & WebGL, it is recommended to use crate::util::new_instance_with_webgpu_detection.
If you instead want to force use of WebGL, either disable the webgpu compile-time feature
or don’t include the Backends::BROWSER_WEBGPU flag in this field.
If it is set and WebGPU support is not detected, the instance will use wgpu-core
to create adapters, meaning that if the webgl feature is enabled, it is able to create
a WebGL adapter.
flags: InstanceFlagsFlags to tune the behavior of the instance.
memory_budget_thresholds: MemoryBudgetThresholdsMemory budget thresholds used by some backends.
backend_options: BackendOptionsOptions the control the behavior of specific backends.
Implementations§
Source§impl InstanceDescriptor
impl InstanceDescriptor
Sourcepub fn from_env_or_default() -> InstanceDescriptor
pub fn from_env_or_default() -> InstanceDescriptor
Choose instance options entirely from environment variables.
This is equivalent to calling from_env on every field.
Sourcepub fn with_env(self) -> InstanceDescriptor
pub fn with_env(self) -> InstanceDescriptor
Takes the given options, modifies them based on the environment variables, and returns the result.
This is equivalent to calling with_env on every field.
Trait Implementations§
Source§impl Clone for InstanceDescriptor
impl Clone for InstanceDescriptor
Source§fn clone(&self) -> InstanceDescriptor
fn clone(&self) -> InstanceDescriptor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more