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 calls vkGetPhysicalDeviceFeatures2 (or vkGetPhysicalDeviceFeatures if that is not available) to collect this information about the VkPhysicalDevice represented by the wgpu_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 the wgpu_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

source

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.

source

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 by Adapter::required_device_extensions when passed features.

  • The given device_api_version must be the Vulkan API version of the physical device we will use to create the logical device.

source

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.

source

fn all_features_supported( features: &Features, implications: &[(Features, Bool32)], ) -> bool

Trait Implementations§

source§

impl Debug for PhysicalDeviceFeatures

source§

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

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

impl Default for PhysicalDeviceFeatures

source§

fn default() -> PhysicalDeviceFeatures

Returns the “default value” for a type. Read more

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<T> Downcast<T> for T

source§

fn downcast(&self) -> &T

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, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

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

source§

impl<T> WasmNotSendSync for T

source§

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