Features
Features advertise additional functionality which can be enabled in the API. If a feature is supported by a physical device, it must be enabled when creating a VkDevice in order to use its associated functionality with that VkDevice. If a feature is unsupported, that functionality cannot be used with that VkDevice.
Features are reported via the basic VkPhysicalDeviceFeatures
structure, as well as the extensible structure
VkPhysicalDeviceFeatures2, which was added in the
VK_KHR_get_physical_device_properties2 extension and included in
Vulkan 1.1.
When new features are added in future Vulkan versions or extensions, each
extension should introduce one new feature structure, if needed.
This structure can be added to the pNext chain of the
VkPhysicalDeviceFeatures2 structure.
For convenience, new core versions of Vulkan may introduce new unified feature structures for features promoted from extensions. At the same time, the extension’s original feature structure (if any) is also promoted to the core API, and is an alias of the extension’s structure. This results in multiple names for the same feature: in the original extension’s feature structure and the promoted structure alias, in the unified feature structure. When a feature was implicitly supported and enabled in the extension, but an explicit name was added during promotion, then the extension itself acts as an alias for the feature as listed in the table below.
All aliases of the same feature in the core API must be reported consistently: either all must be reported as supported, or none of them. When a promoted extension is available, any corresponding feature aliases must be supported.
| Extension | Feature(s) |
|---|
Fine-grained features used by a logical device must be enabled at
VkDevice creation time.
If a feature is enabled that the physical device does not support,
VkDevice creation will fail and return
VK_ERROR_FEATURE_NOT_PRESENT.
The fine-grained features are enabled by passing a pointer to the
VkPhysicalDeviceFeatures structure via the pEnabledFeatures
member of the VkDeviceCreateInfo structure that is passed into the
vkCreateDevice call.
If a member of pEnabledFeatures is VK_TRUE or VK_FALSE,
then the device will be created with the indicated feature enabled or
disabled, respectively.
Features can also be enabled by using the VkPhysicalDeviceFeatures2
structure.
If an application wishes to enable all features supported by a device, it
can simply pass in the VkPhysicalDeviceFeatures structure that was
previously returned by vkGetPhysicalDeviceFeatures.
To disable an individual feature, the application can set the desired
member to VK_FALSE in the same structure.
Setting pEnabledFeatures to NULL
and not including a VkPhysicalDeviceFeatures2 in the pNext chain
of VkDeviceCreateInfo
is equivalent to setting all members of the structure to VK_FALSE.
Some features, such as robustBufferAccess, may incur a runtime
performance cost.
Application writers should carefully consider the implications of enabling
all supported features.
Feature Requirements
All Vulkan graphics implementations must support the following features:
{generated}/featurerequirements.adoc
* VK_KHR_fragment_shading_rate if the
primitiveFragmentShadingRateMeshShader feature is supported.
* VK_EXT_transform_feedback, if the
extendedDynamicState3RasterizationStream feature is supported.
* VK_EXT_conservative_rasterization extension, if the
extendedDynamicState3ConservativeRasterizationMode feature is
supported.
* VK_EXT_conservative_rasterization extension, if the
extendedDynamicState3ExtraPrimitiveOverestimationSize feature is
supported.
* VK_EXT_sample_locations extension, if the
extendedDynamicState3SampleLocationsEnable feature is supported.
* VK_EXT_blend_operation_advanced extension, if the
extendedDynamicState3ColorBlendAdvanced feature is supported.
* VK_EXT_provoking_vertex, if the
extendedDynamicState3ProvokingVertexMode feature is supported.
* Vulkan 1.4 or the VK_KHR_line_rasterization extension or the
VK_EXT_line_rasterization extension, if the
extendedDynamicState3LineRasterizationMode feature is supported.
* VK_KHR_line_rasterization or VK_EXT_line_rasterization
extension, if the extendedDynamicState3LineStippleEnable feature is supported.
* VK_EXT_depth_clip_control, if the
extendedDynamicState3DepthClipNegativeOneToOne feature is
supported.
* VK_NV_clip_space_w_scaling extension, if the
extendedDynamicState3ViewportWScalingEnable feature is
supported.
* VK_NV_viewport_swizzle extension, if the
extendedDynamicState3ViewportSwizzle feature is supported.
* VK_NV_fragment_coverage_to_color extension, if the
extendedDynamicState3CoverageToColorEnable feature is supported.
* VK_NV_fragment_coverage_to_color extension, if the
extendedDynamicState3CoverageToColorLocation feature is
supported.
* VK_NV_framebuffer_mixed_samples extension, if the
extendedDynamicState3CoverageModulationMode feature is
supported.
* VK_NV_framebuffer_mixed_samples extension, if the
extendedDynamicState3CoverageModulationTableEnable feature is
supported.
* VK_NV_framebuffer_mixed_samples extension, if the
extendedDynamicState3CoverageModulationTable feature is
supported.
* VK_NV_coverage_reduction_mode, if the
extendedDynamicState3CoverageReductionMode feature is supported.
* VK_NV_representative_fragment_test, if the
extendedDynamicState3RepresentativeFragmentTestEnable feature is
supported.
* VK_NV_shading_rate_image, if the
extendedDynamicState3ShadingRateImageEnable feature is
supported.
All other features defined in the Specification are optional.