pub struct Features { /* private fields */ }
Expand description
Features that are not guaranteed to be supported.
These are either part of the webgpu standard, or are extension features supported by wgpu when targeting native.
If you want to use a feature, you need to first verify that the adapter supports the feature. If the adapter does not support the feature, requesting a device with it enabled will panic.
Implementations§
Source§impl Features
impl Features
Sourcepub const MAPPABLE_PRIMARY_BUFFERS: Features
pub const MAPPABLE_PRIMARY_BUFFERS: Features
Webgpu only allows the MAP_READ and MAP_WRITE buffer usage to be matched with COPY_DST and COPY_SRC respectively. This removes this requirement.
This is only beneficial on systems that share memory between CPU and GPU. If enabled on a system that doesn’t, this can severely hinder performance. Only use if you understand the consequences.
Supported platforms:
- All
This is a native only feature.
Sourcepub const SAMPLED_TEXTURE_BINDING_ARRAY: Features
pub const SAMPLED_TEXTURE_BINDING_ARRAY: Features
Allows the user to create uniform arrays of sampled textures in shaders:
eg. uniform texture2D textures[10]
.
This capability allows them to exist and to be indexed by compile time constant values.
Supported platforms:
- DX12
- Metal (with MSL 2.0+ on macOS 10.13+)
- Vulkan
This is a native only feature.
Sourcepub const SAMPLED_TEXTURE_ARRAY_DYNAMIC_INDEXING: Features
pub const SAMPLED_TEXTURE_ARRAY_DYNAMIC_INDEXING: Features
Allows shaders to index sampled texture arrays with dynamically uniform values:
eg. texture_array[uniform_value]
This capability means the hardware will also support SAMPLED_TEXTURE_BINDING_ARRAY.
Supported platforms:
- DX12
- Metal (with MSL 2.0+ on macOS 10.13+)
- Vulkan’s shaderSampledImageArrayDynamicIndexing feature
This is a native only feature.
Sourcepub const SAMPLED_TEXTURE_ARRAY_NON_UNIFORM_INDEXING: Features
pub const SAMPLED_TEXTURE_ARRAY_NON_UNIFORM_INDEXING: Features
Allows shaders to index sampled texture arrays with dynamically non-uniform values:
eg. texture_array[vertex_data]
In order to use this capability, the corresponding GLSL extension must be enabled like so:
#extension GL_EXT_nonuniform_qualifier : require
HLSL does not need any extension.
This capability means the hardware will also support SAMPLED_TEXTURE_ARRAY_DYNAMIC_INDEXING and SAMPLED_TEXTURE_BINDING_ARRAY.
Supported platforms:
- DX12
- Metal (with MSL 2.0+ on macOS 10.13+)
- Vulkan 1.2+ (or VK_EXT_descriptor_indexing)’s shaderSampledImageArrayNonUniformIndexing feature)
This is a native only feature.
Sourcepub const UNSIZED_BINDING_ARRAY: Features
pub const UNSIZED_BINDING_ARRAY: Features
Allows the user to create unsized uniform arrays of bindings:
eg. uniform texture2D textures[]
.
If this capability is supported, SAMPLED_TEXTURE_ARRAY_NON_UNIFORM_INDEXING is very likely to also be supported
Supported platforms:
- DX12
- Vulkan 1.2+ (or VK_EXT_descriptor_indexing)’s runtimeDescriptorArray feature
This is a native only feature.
Sourcepub const MULTI_DRAW_INDIRECT: Features
pub const MULTI_DRAW_INDIRECT: Features
Allows the user to call [RenderPass::multi_draw_indirect
] and [RenderPass::multi_draw_indexed_indirect
].
Allows multiple indirect calls to be dispatched from a single buffer.
Supported platforms:
- DX12
- Metal
- Vulkan
This is a native only feature.
Sourcepub const MULTI_DRAW_INDIRECT_COUNT: Features
pub const MULTI_DRAW_INDIRECT_COUNT: Features
Allows the user to call [RenderPass::multi_draw_indirect_count
] and [RenderPass::multi_draw_indexed_indirect_count
].
This allows the use of a buffer containing the actual number of draw calls.
Supported platforms:
- DX12
- Vulkan 1.2+ (or VK_KHR_draw_indirect_count)
This is a native only feature.
Sourcepub const ALL_WEBGPU: Features
pub const ALL_WEBGPU: Features
Features which are part of the upstream webgpu standard
Sourcepub const ALL_NATIVE: Features
pub const ALL_NATIVE: Features
Features that are only available when targeting native (not web)
Sourcepub fn from_bits(bits: u64) -> Option<Features>
pub fn from_bits(bits: u64) -> Option<Features>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
Sourcepub const fn from_bits_truncate(bits: u64) -> Features
pub const fn from_bits_truncate(bits: u64) -> Features
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
Sourcepub const unsafe fn from_bits_unchecked(bits: u64) -> Features
pub const unsafe fn from_bits_unchecked(bits: u64) -> Features
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
Sourcepub const fn intersects(&self, other: Features) -> bool
pub const fn intersects(&self, other: Features) -> bool
Returns true
if there are flags common to both self
and other
.
Trait Implementations§
Source§impl BitAndAssign for Features
impl BitAndAssign for Features
Source§fn bitand_assign(&mut self, other: Features)
fn bitand_assign(&mut self, other: Features)
Disables all flags disabled in the set.
Source§impl BitOrAssign for Features
impl BitOrAssign for Features
Source§fn bitor_assign(&mut self, other: Features)
fn bitor_assign(&mut self, other: Features)
Adds the set of flags.
Source§impl BitXorAssign for Features
impl BitXorAssign for Features
Source§fn bitxor_assign(&mut self, other: Features)
fn bitxor_assign(&mut self, other: Features)
Toggles the set of flags.
Source§impl<'de> Deserialize<'de> for Features
impl<'de> Deserialize<'de> for Features
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Features, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Features, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Extend<Features> for Features
impl Extend<Features> for Features
Source§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = Features>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = Features>,
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 FromIterator<Features> for Features
impl FromIterator<Features> for Features
Source§impl Ord for Features
impl Ord for Features
Source§impl PartialOrd for Features
impl PartialOrd for Features
Source§impl Serialize for Features
impl Serialize for Features
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl SubAssign for Features
impl SubAssign for Features
Source§fn sub_assign(&mut self, other: Features)
fn sub_assign(&mut self, other: Features)
Disables all flags enabled in the set.