pub struct GpuFeatures(/* private fields */);Expand description
GPU features that can be requested or required.
These map to common wgpu features that are useful for rendering applications.
Use GpuFeatures::to_wgpu() to convert to wgpu::Features.
Implementations§
Source§impl GpuFeatures
impl GpuFeatures
Sourcepub const INDIRECT_FIRST_INSTANCE: Self
pub const INDIRECT_FIRST_INSTANCE: Self
Allows the use of first_instance parameter in indirect draw calls.
Required for GPU-driven rendering with indirect buffers.
Sourcepub const MULTI_DRAW_INDIRECT_COUNT: Self
pub const MULTI_DRAW_INDIRECT_COUNT: Self
Allows multi_draw_indirect_count for GPU-driven draw count.
In wgpu 27+, multi_draw_indirect() requires no feature flag
(only DownlevelFlags::INDIRECT_EXECUTION), but the count variant
(multi_draw_indirect_count) requires this feature.
Sourcepub const PUSH_CONSTANTS: Self
pub const PUSH_CONSTANTS: Self
Allows push constants in shaders for small, frequently updated data. More efficient than uniform buffers for small amounts of per-draw data.
Sourcepub const TEXTURE_COMPRESSION_BC: Self
pub const TEXTURE_COMPRESSION_BC: Self
BC texture compression (DXT1, DXT3, DXT5). Common on desktop platforms, reduces texture memory usage.
Sourcepub const DEPTH_CLIP_CONTROL: Self
pub const DEPTH_CLIP_CONTROL: Self
Allows disabling depth clipping in the rasterizer. Useful for certain shadow mapping techniques.
Sourcepub const SHADER_F16: Self
pub const SHADER_F16: Self
16-bit floating point support in shaders. Can improve performance on some GPUs for certain workloads.
Sourcepub const INDIRECT_FIRST_VERTEX: Self
pub const INDIRECT_FIRST_VERTEX: Self
Allows non-zero first_vertex and first_instance in indirect draw calls.
Note: This is a subset of INDIRECT_FIRST_INSTANCE on some platforms.
Sourcepub const POLYGON_MODE_LINE: Self
pub const POLYGON_MODE_LINE: Self
Polygon mode: line (wireframe rendering).
Sourcepub const POLYGON_MODE_POINT: Self
pub const POLYGON_MODE_POINT: Self
Polygon mode: point.
Sourcepub const CONSERVATIVE_RASTERIZATION: Self
pub const CONSERVATIVE_RASTERIZATION: Self
Conservative rasterization for better triangle coverage.
Sourcepub const TEXTURE_BINDING_ARRAY: Self
pub const TEXTURE_BINDING_ARRAY: Self
Texture binding arrays (bindless textures). Enables more flexible texture access patterns in shaders.
Sourcepub const BUFFER_BINDING_ARRAY: Self
pub const BUFFER_BINDING_ARRAY: Self
Sampled texture and storage buffer binding arrays.
Sourcepub const STORAGE_RESOURCE_BINDING_ARRAY: Self
pub const STORAGE_RESOURCE_BINDING_ARRAY: Self
Storage resource binding arrays with dynamic indexing.
Sourcepub const PARTIALLY_BOUND_BINDING_ARRAY: Self
pub const PARTIALLY_BOUND_BINDING_ARRAY: Self
Partially bound binding arrays. Allows leaving some array slots unbound.
Sourcepub const FLOAT32_FILTERABLE: Self
pub const FLOAT32_FILTERABLE: Self
32-bit floating point texture filtering.
Sourcepub const RG11B10UFLOAT_RENDERABLE: Self
pub const RG11B10UFLOAT_RENDERABLE: Self
RG11B10 unsigned floating point render target format.
Sourcepub const BGRA8UNORM_STORAGE: Self
pub const BGRA8UNORM_STORAGE: Self
BGRA8 unorm storage texture support.
Sourcepub const TIMESTAMP_QUERY: Self
pub const TIMESTAMP_QUERY: Self
Timestamp queries for GPU profiling.
Allows measuring GPU execution time with high precision.
Alone, this only allows timestamp writes on pass definition
(via timestamp_writes in render/compute pass descriptors).
Sourcepub const TIMESTAMP_QUERY_INSIDE_ENCODERS: Self
pub const TIMESTAMP_QUERY_INSIDE_ENCODERS: Self
Allows timestamp write commands at arbitrary points within command encoders.
Implies TIMESTAMP_QUERY is supported.
Required by wgpu-profiler for scopes on command encoders.
Sourcepub const TIMESTAMP_QUERY_INSIDE_PASSES: Self
pub const TIMESTAMP_QUERY_INSIDE_PASSES: Self
Allows timestamp write commands at arbitrary points within render/compute passes.
Implies TIMESTAMP_QUERY and TIMESTAMP_QUERY_INSIDE_ENCODERS are supported.
Required by wgpu-profiler for scopes on render/compute passes.
Sourcepub const SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING: Self
pub const SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING: Self
Non-uniform indexing of sampled texture and storage buffer binding arrays.
Required for dynamic indexing into binding_array<texture_2d<f32>> with
values that are not uniform across a draw call (e.g., per-instance texture index).
Source§impl GpuFeatures
impl GpuFeatures
Sourcepub const fn bits(&self) -> u32
pub const fn bits(&self) -> u32
Get the underlying bits value.
The returned value is exactly the bits set in this flags value.
Sourcepub const fn from_bits(bits: u32) -> Option<Self>
pub const fn from_bits(bits: u32) -> Option<Self>
Convert from a bits value.
This method will return None if any unknown bits are set.
Sourcepub const fn from_bits_truncate(bits: u32) -> Self
pub const fn from_bits_truncate(bits: u32) -> Self
Convert from a bits value, unsetting any unknown bits.
Sourcepub const fn from_bits_retain(bits: u32) -> Self
pub const fn from_bits_retain(bits: u32) -> Self
Convert from a bits value exactly.
Sourcepub fn from_name(name: &str) -> Option<Self>
pub fn from_name(name: &str) -> Option<Self>
Get a flags value with the bits of a flag with the given name set.
This method will return None if name is empty or doesn’t
correspond to any named flag.
Sourcepub const fn intersects(&self, other: Self) -> bool
pub const fn intersects(&self, other: Self) -> bool
Whether any set bits in a source flags value are also set in a target flags value.
Sourcepub const fn contains(&self, other: Self) -> bool
pub const fn contains(&self, other: Self) -> bool
Whether all set bits in a source flags value are also set in a target flags value.
Sourcepub fn remove(&mut self, other: Self)
pub fn remove(&mut self, other: Self)
The intersection of a source flags value with the complement of a target flags
value (&!).
This method is not equivalent to self & !other when other has unknown bits set.
remove won’t truncate other, but the ! operator will.
Sourcepub fn toggle(&mut self, other: Self)
pub fn toggle(&mut self, other: Self)
The bitwise exclusive-or (^) of the bits in two flags values.
Sourcepub fn set(&mut self, other: Self, value: bool)
pub fn set(&mut self, other: Self, value: bool)
Call insert when value is true or remove when value is false.
Sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
The bitwise and (&) of the bits in two flags values.
Sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
The bitwise or (|) of the bits in two flags values.
Sourcepub const fn difference(self, other: Self) -> Self
pub const fn difference(self, other: Self) -> Self
The intersection of a source flags value with the complement of a target flags
value (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
Sourcepub const fn symmetric_difference(self, other: Self) -> Self
pub const fn symmetric_difference(self, other: Self) -> Self
The bitwise exclusive-or (^) of the bits in two flags values.
Sourcepub const fn complement(self) -> Self
pub const fn complement(self) -> Self
The bitwise negation (!) of the bits in a flags value, truncating the result.
Source§impl GpuFeatures
impl GpuFeatures
Sourcepub const fn iter(&self) -> Iter<GpuFeatures>
pub const fn iter(&self) -> Iter<GpuFeatures>
Yield a set of contained flags values.
Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value.
Sourcepub const fn iter_names(&self) -> IterNames<GpuFeatures>
pub const fn iter_names(&self) -> IterNames<GpuFeatures>
Yield a set of contained named flags values.
This method is like iter, except only yields bits in contained named flags.
Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
Source§impl GpuFeatures
impl GpuFeatures
Sourcepub fn from_wgpu(features: Features) -> Self
pub fn from_wgpu(features: Features) -> Self
Convert from wgpu::Features to GpuFeatures.
Note: Only features that have a corresponding GpuFeatures flag will be included.
Sourcepub fn check_support(self, adapter: &Adapter) -> FeatureSupportResult
pub fn check_support(self, adapter: &Adapter) -> FeatureSupportResult
Check if all the specified features are supported by the adapter.
Trait Implementations§
Source§impl Binary for GpuFeatures
impl Binary for GpuFeatures
Source§impl BitAnd for GpuFeatures
impl BitAnd for GpuFeatures
Source§impl BitAndAssign for GpuFeatures
impl BitAndAssign for GpuFeatures
Source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
The bitwise and (&) of the bits in two flags values.
Source§impl BitOr for GpuFeatures
impl BitOr for GpuFeatures
Source§fn bitor(self, other: GpuFeatures) -> Self
fn bitor(self, other: GpuFeatures) -> Self
The bitwise or (|) of the bits in two flags values.
Source§type Output = GpuFeatures
type Output = GpuFeatures
| operator.Source§impl BitOrAssign for GpuFeatures
impl BitOrAssign for GpuFeatures
Source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
The bitwise or (|) of the bits in two flags values.
Source§impl BitXor for GpuFeatures
impl BitXor for GpuFeatures
Source§impl BitXorAssign for GpuFeatures
impl BitXorAssign for GpuFeatures
Source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
The bitwise exclusive-or (^) of the bits in two flags values.
Source§impl Clone for GpuFeatures
impl Clone for GpuFeatures
Source§fn clone(&self) -> GpuFeatures
fn clone(&self) -> GpuFeatures
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GpuFeatures
impl Debug for GpuFeatures
Source§impl Default for GpuFeatures
impl Default for GpuFeatures
Source§impl Extend<GpuFeatures> for GpuFeatures
impl Extend<GpuFeatures> for GpuFeatures
Source§fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
The bitwise or (|) of the bits in each flags value.
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl Flags for GpuFeatures
impl Flags for GpuFeatures
Source§const FLAGS: &'static [Flag<GpuFeatures>]
const FLAGS: &'static [Flag<GpuFeatures>]
Source§fn from_bits_retain(bits: u32) -> GpuFeatures
fn from_bits_retain(bits: u32) -> GpuFeatures
Source§fn contains_unknown_bits(&self) -> bool
fn contains_unknown_bits(&self) -> bool
true if any unknown bits are set.Source§fn from_bits_truncate(bits: Self::Bits) -> Self
fn from_bits_truncate(bits: Self::Bits) -> Self
Source§fn from_name(name: &str) -> Option<Self>
fn from_name(name: &str) -> Option<Self>
Source§fn iter_names(&self) -> IterNames<Self>
fn iter_names(&self) -> IterNames<Self>
Source§fn iter_defined_names() -> IterDefinedNames<Self>
fn iter_defined_names() -> IterDefinedNames<Self>
Self::FLAGS.Source§fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
Source§fn contains(&self, other: Self) -> boolwhere
Self: Sized,
fn contains(&self, other: Self) -> boolwhere
Self: Sized,
Source§fn insert(&mut self, other: Self)where
Self: Sized,
fn insert(&mut self, other: Self)where
Self: Sized,
|) of the bits in two flags values.Source§fn remove(&mut self, other: Self)where
Self: Sized,
fn remove(&mut self, other: Self)where
Self: Sized,
&!). Read moreSource§fn toggle(&mut self, other: Self)where
Self: Sized,
fn toggle(&mut self, other: Self)where
Self: Sized,
^) of the bits in two flags values.Source§fn intersection(self, other: Self) -> Self
fn intersection(self, other: Self) -> Self
&) of the bits in two flags values.Source§fn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
&!). Read moreSource§fn symmetric_difference(self, other: Self) -> Self
fn symmetric_difference(self, other: Self) -> Self
^) of the bits in two flags values.Source§fn complement(self) -> Self
fn complement(self) -> Self
!) of the bits in a flags value, truncating the result.Source§impl FromIterator<GpuFeatures> for GpuFeatures
impl FromIterator<GpuFeatures> for GpuFeatures
Source§fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
The bitwise or (|) of the bits in each flags value.
Source§impl Hash for GpuFeatures
impl Hash for GpuFeatures
Source§impl IntoIterator for GpuFeatures
impl IntoIterator for GpuFeatures
Source§impl LowerHex for GpuFeatures
impl LowerHex for GpuFeatures
Source§impl Not for GpuFeatures
impl Not for GpuFeatures
Source§impl Octal for GpuFeatures
impl Octal for GpuFeatures
Source§impl PartialEq for GpuFeatures
impl PartialEq for GpuFeatures
Source§impl PublicFlags for GpuFeatures
impl PublicFlags for GpuFeatures
Source§impl Sub for GpuFeatures
impl Sub for GpuFeatures
Source§fn sub(self, other: Self) -> Self
fn sub(self, other: Self) -> Self
The intersection of a source flags value with the complement of a target flags value (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
Source§type Output = GpuFeatures
type Output = GpuFeatures
- operator.Source§impl SubAssign for GpuFeatures
impl SubAssign for GpuFeatures
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
The intersection of a source flags value with the complement of a target flags value (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
Source§impl UpperHex for GpuFeatures
impl UpperHex for GpuFeatures
impl Copy for GpuFeatures
impl Eq for GpuFeatures
impl StructuralPartialEq for GpuFeatures
Auto Trait Implementations§
impl Freeze for GpuFeatures
impl RefUnwindSafe for GpuFeatures
impl Send for GpuFeatures
impl Sync for GpuFeatures
impl Unpin for GpuFeatures
impl UnwindSafe for GpuFeatures
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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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