pub enum DeviceTier {
WebGpu,
Native,
WebGl2,
}Expand description
How much of the WebGPU baseline to ask a device for.
A device is requested with a set of limits, so the tier is what decides how
large a device the frame has to work within. Self::WebGpu is the
baseline every WebGPU implementation guarantees, and is the default, so a
frame asks for no more than it has to and runs wherever the API does.
Self::WebGl2 reproduces a WebGL2 device’s shape on hardware that is
capable of much more, which is the only way to exercise the paths a browser
takes from a machine that has storage buffers and base_vertex; it is
Self::WebGpu with
downlevel_webgl2_defaults as
its floor.
Self::from_env reads the tier from UNLIT3D_DEVICE_TIER, so a test run
can pick the tier without recompiling.
Variants§
WebGpu
The limits the WebGPU baseline guarantees, lowered where the adapter offers even less. The default.
Native
The adapter’s own limits, which on a desktop backend are its full capabilities rather than the baseline’s floor.
WebGl2
WebGL2’s limits and capabilities.
Implementations§
Source§impl DeviceTier
impl DeviceTier
Sourcepub const ALL: &'static [DeviceTier]
pub const ALL: &'static [DeviceTier]
Sourcepub fn from_env() -> DeviceTier
pub fn from_env() -> DeviceTier
The tier named by UNLIT3D_DEVICE_TIER, or Self::WebGpu when it is
unset.
The value is parsed by FromStr, so an unrecognized one — a
typo like webgl — panics rather than silently selecting the default.
Running the wrong tier is the failure this variable exists to prevent:
it would pass while exercising none of the paths under test, which is
worse than not running.
§Panics
If the variable is set to a value that names no tier.
Sourcepub fn limits(self, adapter_limits: &Limits) -> Limits
pub fn limits(self, adapter_limits: &Limits) -> Limits
The limits to request from an adapter whose own limits are
adapter_limits.
Self::Native asks for the adapter’s own limits, and so can.
Self::WebGpu asks for the baseline’s guaranteed values, which is
what keeps the device the frame is recorded against within reach of
every implementation — but an adapter may offer less than the baseline,
an adapter narrowed to a browser’s WebGL2 most of all, and a request
above what the adapter supports is refused outright. Every other limit
is therefore lowered to the adapter’s, which leaves a compliant
adapter’s request exactly the baseline and lets a weaker one through on
its own terms.
Both narrowed tiers keep the adapter’s texture resolution: a tier is a floor, and lowering the texture sizes below what the adapter has would test a device smaller than any browser ships.
Sourcepub fn capabilities(self) -> DeviceCapabilities
pub fn capabilities(self) -> DeviceCapabilities
The capabilities a device of this tier has.
Independent of the adapter: the tier is the set of flags, and a forced tier has to report what the real device of that tier would.
Sourcepub fn capabilities_of(self, adapter: &Adapter) -> DeviceCapabilities
pub fn capabilities_of(self, adapter: &Adapter) -> DeviceCapabilities
The capabilities a device of this tier ends up with.
A narrowed tier is a request, so what it can rely on is the tier’s own capabilities intersected with what the adapter really reports: a forced WebGL2 tier is only as capable as WebGL2, and an adapter that is even more limited is only as capable as itself.
The WebGPU baseline is a floor every implementation claims to meet, so
for Self::WebGpu the intersection is whatever the adapter reports —
which is also what Self::Native yields, since a tier narrowed by
limits does not change the adapter’s flags.
Trait Implementations§
Source§impl Clone for DeviceTier
impl Clone for DeviceTier
Source§fn clone(&self) -> DeviceTier
fn clone(&self) -> DeviceTier
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DeviceTier
Source§impl Debug for DeviceTier
impl Debug for DeviceTier
Source§impl Default for DeviceTier
impl Default for DeviceTier
Source§fn default() -> DeviceTier
fn default() -> DeviceTier
Source§impl Display for DeviceTier
impl Display for DeviceTier
impl Eq for DeviceTier
Source§impl FromStr for DeviceTier
impl FromStr for DeviceTier
Source§impl PartialEq for DeviceTier
impl PartialEq for DeviceTier
impl StructuralPartialEq for DeviceTier
Auto Trait Implementations§
impl Forget for DeviceTier
impl Freeze for DeviceTier
impl RefUnwindSafe for DeviceTier
impl Send for DeviceTier
impl Sync for DeviceTier
impl Unpin for DeviceTier
impl UnsafeUnpin for DeviceTier
impl UnwindSafe for DeviceTier
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more