Struct wgpu_hal::vulkan::adapter::PhysicalDeviceFeatures
source · pub struct PhysicalDeviceFeatures {Show 16 fields
core: PhysicalDeviceFeatures,
pub(super) descriptor_indexing: Option<PhysicalDeviceDescriptorIndexingFeaturesEXT<'static>>,
imageless_framebuffer: Option<PhysicalDeviceImagelessFramebufferFeaturesKHR<'static>>,
timeline_semaphore: Option<PhysicalDeviceTimelineSemaphoreFeaturesKHR<'static>>,
image_robustness: Option<PhysicalDeviceImageRobustnessFeaturesEXT<'static>>,
robustness2: Option<PhysicalDeviceRobustness2FeaturesEXT<'static>>,
multiview: Option<PhysicalDeviceMultiviewFeaturesKHR<'static>>,
sampler_ycbcr_conversion: Option<PhysicalDeviceSamplerYcbcrConversionFeatures<'static>>,
astc_hdr: Option<PhysicalDeviceTextureCompressionASTCHDRFeaturesEXT<'static>>,
shader_float16: Option<(PhysicalDeviceShaderFloat16Int8Features<'static>, PhysicalDevice16BitStorageFeatures<'static>)>,
acceleration_structure: Option<PhysicalDeviceAccelerationStructureFeaturesKHR<'static>>,
buffer_device_address: Option<PhysicalDeviceBufferDeviceAddressFeaturesKHR<'static>>,
ray_query: Option<PhysicalDeviceRayQueryFeaturesKHR<'static>>,
zero_initialize_workgroup_memory: Option<PhysicalDeviceZeroInitializeWorkgroupMemoryFeatures<'static>>,
shader_atomic_int64: Option<PhysicalDeviceShaderAtomicInt64Features<'static>>,
subgroup_size_control: Option<PhysicalDeviceSubgroupSizeControlFeatures<'static>>,
}
Expand description
Features supported by a vk::PhysicalDevice
and its extensions.
This is used in two phases:
-
When enumerating adapters, this represents the features offered by the adapter.
Instance::expose_adapter
callsvkGetPhysicalDeviceFeatures2
(orvkGetPhysicalDeviceFeatures
if that is not available) to collect this information about theVkPhysicalDevice
represented by thewgpu_hal::ExposedAdapter
. -
When opening a device, this represents the features we would like to enable. At
wgpu_hal::Device
construction time,PhysicalDeviceFeatures::from_extensions_and_requested_features
constructs an value of this type indicating which Vulkan features to enable, based on thewgpu_types::Features
requested.
Fields§
§core: PhysicalDeviceFeatures
Basic Vulkan 1.0 features.
descriptor_indexing: Option<PhysicalDeviceDescriptorIndexingFeaturesEXT<'static>>
Features provided by VK_EXT_descriptor_indexing
, promoted to Vulkan 1.2.
imageless_framebuffer: Option<PhysicalDeviceImagelessFramebufferFeaturesKHR<'static>>
Features provided by VK_KHR_imageless_framebuffer
, promoted to Vulkan 1.2.
timeline_semaphore: Option<PhysicalDeviceTimelineSemaphoreFeaturesKHR<'static>>
Features provided by VK_KHR_timeline_semaphore
, promoted to Vulkan 1.2
image_robustness: Option<PhysicalDeviceImageRobustnessFeaturesEXT<'static>>
Features provided by VK_EXT_image_robustness
, promoted to Vulkan 1.3
robustness2: Option<PhysicalDeviceRobustness2FeaturesEXT<'static>>
Features provided by VK_EXT_robustness2
.
multiview: Option<PhysicalDeviceMultiviewFeaturesKHR<'static>>
Features provided by VK_KHR_multiview
, promoted to Vulkan 1.1.
sampler_ycbcr_conversion: Option<PhysicalDeviceSamplerYcbcrConversionFeatures<'static>>
Features provided by VK_KHR_sampler_ycbcr_conversion
, promoted to Vulkan 1.1.
astc_hdr: Option<PhysicalDeviceTextureCompressionASTCHDRFeaturesEXT<'static>>
Features provided by VK_EXT_texture_compression_astc_hdr
, promoted to Vulkan 1.3.
shader_float16: Option<(PhysicalDeviceShaderFloat16Int8Features<'static>, PhysicalDevice16BitStorageFeatures<'static>)>
Features provided by VK_KHR_shader_float16_int8
(promoted to Vulkan
1.2) and VK_KHR_16bit_storage
(promoted to Vulkan 1.1). We use these
features together, or not at all.
acceleration_structure: Option<PhysicalDeviceAccelerationStructureFeaturesKHR<'static>>
Features provided by VK_KHR_acceleration_structure
.
buffer_device_address: Option<PhysicalDeviceBufferDeviceAddressFeaturesKHR<'static>>
Features provided by VK_KHR_buffer_device_address
, promoted to Vulkan 1.2.
We only use this feature for
Features::EXPERIMENTAL_RAY_TRACING_ACCELERATION_STRUCTURE
, which requires
VK_KHR_acceleration_structure
, which depends on
VK_KHR_buffer_device_address
, so Instance::expose_adapter
only
bothers to check if VK_KHR_acceleration_structure
is available,
leaving this None
.
However, we do populate this when creating a device if
Features::EXPERIMENTAL_RAY_TRACING_ACCELERATION_STRUCTURE
is requested.
ray_query: Option<PhysicalDeviceRayQueryFeaturesKHR<'static>>
Features provided by VK_KHR_ray_query
,
Vulkan requires that the feature be present if the VK_KHR_ray_query
extension is present, so Instance::expose_adapter
doesn’t bother retrieving
this from vkGetPhysicalDeviceFeatures2
.
However, we do populate this when creating a device if ray tracing is requested.
zero_initialize_workgroup_memory: Option<PhysicalDeviceZeroInitializeWorkgroupMemoryFeatures<'static>>
Features provided by VK_KHR_zero_initialize_workgroup_memory
, promoted
to Vulkan 1.3.
shader_atomic_int64: Option<PhysicalDeviceShaderAtomicInt64Features<'static>>
Features provided by VK_KHR_shader_atomic_int64
, promoted to Vulkan 1.2.
subgroup_size_control: Option<PhysicalDeviceSubgroupSizeControlFeatures<'static>>
Features provided by VK_EXT_subgroup_size_control
, promoted to Vulkan 1.3.
Implementations§
source§impl PhysicalDeviceFeatures
impl PhysicalDeviceFeatures
sourcepub fn add_to_device_create<'a>(
&'a mut self,
info: DeviceCreateInfo<'a>,
) -> DeviceCreateInfo<'a>
pub fn add_to_device_create<'a>( &'a mut self, info: DeviceCreateInfo<'a>, ) -> DeviceCreateInfo<'a>
Add the members of self
into info.enabled_features
and its p_next
chain.
sourcefn from_extensions_and_requested_features(
device_api_version: u32,
enabled_extensions: &[&'static CStr],
requested_features: Features,
downlevel_flags: DownlevelFlags,
private_caps: &PrivateCapabilities,
) -> Self
fn from_extensions_and_requested_features( device_api_version: u32, enabled_extensions: &[&'static CStr], requested_features: Features, downlevel_flags: DownlevelFlags, private_caps: &PrivateCapabilities, ) -> Self
Create a PhysicalDeviceFeatures
that can be used to create a logical
device.
Return a PhysicalDeviceFeatures
value capturing all the Vulkan
features needed for the given Features
, DownlevelFlags
, and
PrivateCapabilities
. You can use the returned value’s
add_to_device_create
method to configure a
vk::DeviceCreateInfo
to build a logical device providing those
features.
To ensure that the returned value is able to select all the Vulkan
features needed to express requested_features
, downlevel_flags
, and
private_caps
:
-
The given
enabled_extensions
set must include all the extensions selected byAdapter::required_device_extensions
when passedfeatures
. -
The given
device_api_version
must be the Vulkan API version of the physical device we will use to create the logical device.
sourcefn to_wgpu(
&self,
instance: &Instance,
phd: PhysicalDevice,
caps: &PhysicalDeviceProperties,
) -> (Features, DownlevelFlags)
fn to_wgpu( &self, instance: &Instance, phd: PhysicalDevice, caps: &PhysicalDeviceProperties, ) -> (Features, DownlevelFlags)
Compute the wgpu Features
and DownlevelFlags
supported by a physical device.
Given self
, together with the instance and physical device it was
built from, and a caps
also built from those, determine which wgpu
features and downlevel flags the device can support.