@@ -40,6 +40,9 @@ pub struct PhysicalDeviceFeatures {
40
40
/// Basic Vulkan 1.0 features.
41
41
core : vk:: PhysicalDeviceFeatures ,
42
42
43
+ /// Vulkan 1.2 features.
44
+ vulkan12 : Option < vk:: PhysicalDeviceVulkan12Features < ' static > > ,
45
+
43
46
/// Features provided by `VK_EXT_descriptor_indexing`, promoted to Vulkan 1.2.
44
47
pub ( super ) descriptor_indexing :
45
48
Option < vk:: PhysicalDeviceDescriptorIndexingFeaturesEXT < ' static > > ,
@@ -136,6 +139,9 @@ impl PhysicalDeviceFeatures {
136
139
mut info : vk:: DeviceCreateInfo < ' a > ,
137
140
) -> vk:: DeviceCreateInfo < ' a > {
138
141
info = info. enabled_features ( & self . core ) ;
142
+ if let Some ( ref mut feature) = self . vulkan12 {
143
+ info = info. push_next ( feature) ;
144
+ }
139
145
if let Some ( ref mut feature) = self . descriptor_indexing {
140
146
info = info. push_next ( feature) ;
141
147
}
@@ -316,6 +322,14 @@ impl PhysicalDeviceFeatures {
316
322
. geometry_shader ( requested_features. contains ( wgt:: Features :: SHADER_PRIMITIVE_INDEX ) )
317
323
. depth_clamp ( requested_features. contains ( wgt:: Features :: DEPTH_CLIP_CONTROL ) )
318
324
. dual_src_blend ( requested_features. contains ( wgt:: Features :: DUAL_SOURCE_BLENDING ) ) ,
325
+ vulkan12 : if device_api_version >= vk:: API_VERSION_1_2 {
326
+ Some (
327
+ vk:: PhysicalDeviceVulkan12Features :: default ( )
328
+ . shader_int8 ( private_caps. shader_int8 ) ,
329
+ )
330
+ } else {
331
+ None
332
+ } ,
319
333
descriptor_indexing : if requested_features. intersects ( INDEXING_FEATURES ) {
320
334
Some (
321
335
vk:: PhysicalDeviceDescriptorIndexingFeaturesEXT :: default ( )
@@ -1390,6 +1404,13 @@ impl super::InstanceShared {
1390
1404
let core = vk:: PhysicalDeviceFeatures :: default ( ) ;
1391
1405
let mut features2 = vk:: PhysicalDeviceFeatures2KHR :: default ( ) . features ( core) ;
1392
1406
1407
+ if capabilities. device_api_version >= vk:: API_VERSION_1_2 {
1408
+ let next = features
1409
+ . vulkan12
1410
+ . insert ( vk:: PhysicalDeviceVulkan12Features :: default ( ) ) ;
1411
+ features2 = features2. push_next ( next) ;
1412
+ }
1413
+
1393
1414
// `VK_KHR_multiview` is promoted to 1.1
1394
1415
if capabilities. device_api_version >= vk:: API_VERSION_1_1
1395
1416
|| capabilities. supports_extension ( khr:: multiview:: NAME )
@@ -1714,6 +1735,9 @@ impl super::Instance {
1714
1735
shader_integer_dot_product : phd_features
1715
1736
. shader_integer_dot_product
1716
1737
. is_some_and ( |ext| ext. shader_integer_dot_product != 0 ) ,
1738
+ shader_int8 : phd_features
1739
+ . vulkan12
1740
+ . is_some_and ( |features| features. shader_int8 != 0 ) ,
1717
1741
} ;
1718
1742
let capabilities = crate :: Capabilities {
1719
1743
limits : phd_capabilities. to_wgpu_limits ( ) ,
@@ -2015,6 +2039,10 @@ impl super::Adapter {
2015
2039
spv:: Capability :: DotProductKHR ,
2016
2040
] ) ;
2017
2041
}
2042
+ if self . private_caps . shader_int8 {
2043
+ // See <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPhysicalDeviceVulkan12Features.html#features-shaderInt8>.
2044
+ capabilities. extend ( & [ spv:: Capability :: Int8 ] ) ;
2045
+ }
2018
2046
spv:: Options {
2019
2047
lang_version : match self . phd_capabilities . device_api_version {
2020
2048
// Use maximum supported SPIR-V version according to
0 commit comments