Skip to main content

TierCaps

Struct TierCaps 

Source
pub struct TierCaps {
Show 15 fields pub downlevel_flags: DownlevelFlags, pub adapter_name: String, pub backend: Backend, pub max_texture_dimension_2d: u32, pub max_texture_array_layers: u32, pub max_bind_groups: u32, pub max_uniform_buffer_binding_size: u32, pub min_uniform_buffer_offset_alignment: u32, pub max_vertex_attributes: u32, pub has_storage_buffers: bool, pub has_timestamp_query: bool, pub transient_saves_memory: bool, pub atlas_format: TextureFormat, pub resource_texture_dim: u32, pub downlevel_profile: DownlevelProfile,
}
Expand description

Plain-data adapter capabilities the GPU crate’s device/pipeline/atlas decisions are built over. Constructed from a real wgpu::Adapter via TierCaps::probe, or by hand in host tests via TierCaps::fake.

Fields§

§downlevel_flags: DownlevelFlags

The adapter’s wgpu::DownlevelCapabilities::flags.

§adapter_name: String

The adapter’s wgpu::AdapterInfo::name, used only for diagnostics.

§backend: Backend

The adapter’s wgpu::AdapterInfo::backend.

§max_texture_dimension_2d: u32

The adapter’s wgpu::Limits::max_texture_dimension_2d, clamped down to wgpu::Limits::downlevel_webgl2_defaults().max_texture_dimension_2d when Self::downlevel_profile is DownlevelProfile::WebGl2.

§max_texture_array_layers: u32

The adapter’s wgpu::Limits::max_texture_array_layers, clamped the same way as Self::max_texture_dimension_2d.

§max_bind_groups: u32

The adapter’s wgpu::Limits::max_bind_groups, clamped the same way as Self::max_texture_dimension_2d.

§max_uniform_buffer_binding_size: u32

The adapter’s wgpu::Limits::max_uniform_buffer_binding_size, saturated into a u32 (the field is u64 on wgpu::Limits; no adapter this workspace targets reports a value anywhere near u32::MAX) and clamped the same way as Self::max_texture_dimension_2d.

§min_uniform_buffer_offset_alignment: u32

The adapter’s wgpu::Limits::min_uniform_buffer_offset_alignment, raised to wgpu::Limits::downlevel_webgl2_defaults().min_uniform_buffer_offset_alignment (256) when Self::downlevel_profile is DownlevelProfile::WebGl2 and the adapter reports a looser (smaller) value — an alignment requirement is a floor, so it is only ever raised, never lowered.

§max_vertex_attributes: u32

The adapter’s wgpu::Limits::max_vertex_attributes, clamped the same way as Self::max_texture_dimension_2d.

§has_storage_buffers: bool

Whether the adapter supports storage buffers at all (wgpu::Limits::max_storage_buffers_per_shader_stage > 0) — forced false whenever Self::downlevel_profile is DownlevelProfile::WebGl2, since the GLES-3.0/WebGL2 downlevel default limits report zero storage buffers per shader stage.

§has_timestamp_query: bool

Whether the adapter exposes wgpu::Features::TIMESTAMP_QUERY.

§transient_saves_memory: bool

The adapter’s wgpu::AdapterInfo::transient_saves_memory — whether adding wgpu::TextureUsages::TRANSIENT_ATTACHMENT to a texture (which itself requires wgpu::StoreOp::Discard) reduces memory usage on this adapter.

wgpu reports this as Option<bool>, where None means “the adapter does not say” (only the web backend, which no frust shell targets). Self::probe folds None to false: an unknown answer must not buy the transient flag, since it is a memory optimization with a hard clear/discard precondition and no upside when the driver ignores it.

§atlas_format: TextureFormat

The texture format a texture atlas is backed by.

§resource_texture_dim: u32

The texture dimension a pooled/atlas resource texture is sized against: min(max_texture_dimension_2d, 4096) against the (possibly already WebGL2-clamped) Self::max_texture_dimension_2d, so a very generous desktop adapter’s real ceiling never drives an oversized allocation.

§downlevel_profile: DownlevelProfile

Whether this adapter’s usable limits are the full native set or clamped to the GLES-3.0/WebGL2 downlevel defaults.

Implementations§

Source§

impl TierCaps

Source

pub fn probe(adapter: &Adapter) -> Self

Probes a real wgpu::Adapter for the capabilities this crate’s device/pipeline/atlas decisions are built over. Synchronous: every value it reads (get_info, get_downlevel_capabilities, limits, features) is available before device creation.

When the resolved DownlevelProfile is DownlevelProfile::WebGl2 — a real wgpu::Backend::Gl adapter, or FRUST_ENGINE_DOWNLEVEL=1 rehearsing it against a desktop backend — the probed limits are run through clamp_to_webgl2_defaults and storage buffers are forced off, so the override actually rehearses the downlevel shape instead of only relabelling desktop values.

Source

pub fn fake(profile: DownlevelProfile) -> Self

Builds synthetic caps for the given DownlevelProfile with no wgpu::Adapter at all — the host-test counterpart to Self::probe.

Full mirrors wgpu::Limits::defaults()’s desktop values (backend Vulkan, max_texture_dimension_2d 8192, storage buffers present); WebGl2 mirrors wgpu::Limits::downlevel_webgl2_defaults() (backend Gl, max_texture_dimension_2d 2048, no storage buffers).

Trait Implementations§

Source§

impl Clone for TierCaps

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TierCaps

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for TierCaps

Source§

impl PartialEq for TierCaps

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TierCaps

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,