@@ -62,13 +62,11 @@ pub struct PhysicalDeviceFeatures {
62
62
/// Features provided by `VK_EXT_texture_compression_astc_hdr`, promoted to Vulkan 1.3.
63
63
astc_hdr : Option < vk:: PhysicalDeviceTextureCompressionASTCHDRFeaturesEXT < ' static > > ,
64
64
65
- /// Features provided by `VK_KHR_shader_float16_int8` (promoted to Vulkan
66
- /// 1.2) and `VK_KHR_16bit_storage` (promoted to Vulkan 1.1). We use these
67
- /// features together, or not at all.
68
- shader_float16 : Option < (
69
- vk:: PhysicalDeviceShaderFloat16Int8Features < ' static > ,
70
- vk:: PhysicalDevice16BitStorageFeatures < ' static > ,
71
- ) > ,
65
+ /// Features provided by `VK_KHR_shader_float16_int8`, promoted to Vulkan 1.2
66
+ shader_float16_int8 : Option < vk:: PhysicalDeviceShaderFloat16Int8Features < ' static > > ,
67
+
68
+ /// Features provided by `VK_KHR_16bit_storage`, promoted to Vulkan 1.1
69
+ features_16bit_storage : Option < vk:: PhysicalDevice16BitStorageFeatures < ' static > > ,
72
70
73
71
/// Features provided by `VK_KHR_acceleration_structure`.
74
72
acceleration_structure : Option < vk:: PhysicalDeviceAccelerationStructureFeaturesKHR < ' static > > ,
@@ -154,9 +152,11 @@ impl PhysicalDeviceFeatures {
154
152
if let Some ( ref mut feature) = self . astc_hdr {
155
153
info = info. push_next ( feature) ;
156
154
}
157
- if let Some ( ( ref mut f16_i8_feature, ref mut _16bit_feature) ) = self . shader_float16 {
158
- info = info. push_next ( f16_i8_feature) ;
159
- info = info. push_next ( _16bit_feature) ;
155
+ if let Some ( ref mut feature) = self . shader_float16_int8 {
156
+ info = info. push_next ( feature) ;
157
+ }
158
+ if let Some ( ref mut feature) = self . features_16bit_storage {
159
+ info = info. push_next ( feature) ;
160
160
}
161
161
if let Some ( ref mut feature) = self . zero_initialize_workgroup_memory {
162
162
info = info. push_next ( feature) ;
@@ -386,14 +386,18 @@ impl PhysicalDeviceFeatures {
386
386
} else {
387
387
None
388
388
} ,
389
- shader_float16 : if requested_features. contains ( wgt:: Features :: SHADER_F16 ) {
390
- Some ( (
391
- vk:: PhysicalDeviceShaderFloat16Int8Features :: default ( ) . shader_float16 ( true ) ,
389
+ shader_float16_int8 : if requested_features. contains ( wgt:: Features :: SHADER_F16 ) {
390
+ Some ( vk:: PhysicalDeviceShaderFloat16Int8Features :: default ( ) . shader_float16 ( true ) )
391
+ } else {
392
+ None
393
+ } ,
394
+ features_16bit_storage : if requested_features. contains ( wgt:: Features :: SHADER_F16 ) {
395
+ Some (
392
396
vk:: PhysicalDevice16BitStorageFeatures :: default ( )
393
397
. storage_buffer16_bit_access ( true )
394
398
. storage_input_output16 ( true )
395
399
. uniform_and_storage_buffer16_bit_access ( true ) ,
396
- ) )
400
+ )
397
401
} else {
398
402
None
399
403
} ,
@@ -724,7 +728,9 @@ impl PhysicalDeviceFeatures {
724
728
) ;
725
729
}
726
730
727
- if let Some ( ( ref f16_i8, ref bit16) ) = self . shader_float16 {
731
+ if let ( Some ( ref f16_i8) , Some ( ref bit16) ) =
732
+ ( self . shader_float16_int8 , self . features_16bit_storage )
733
+ {
728
734
features. set (
729
735
F :: SHADER_F16 ,
730
736
f16_i8. shader_float16 != 0
@@ -1474,15 +1480,17 @@ impl super::InstanceShared {
1474
1480
. insert ( vk:: PhysicalDeviceTextureCompressionASTCHDRFeaturesEXT :: default ( ) ) ;
1475
1481
features2 = features2. push_next ( next) ;
1476
1482
}
1477
- if capabilities. supports_extension ( khr:: shader_float16_int8:: NAME )
1478
- && capabilities. supports_extension ( khr:: _16bit_storage:: NAME )
1479
- {
1480
- let next = features. shader_float16 . insert ( (
1481
- vk:: PhysicalDeviceShaderFloat16Int8FeaturesKHR :: default ( ) ,
1482
- vk:: PhysicalDevice16BitStorageFeaturesKHR :: default ( ) ,
1483
- ) ) ;
1484
- features2 = features2. push_next ( & mut next. 0 ) ;
1485
- features2 = features2. push_next ( & mut next. 1 ) ;
1483
+ if capabilities. supports_extension ( khr:: shader_float16_int8:: NAME ) {
1484
+ let next = features
1485
+ . shader_float16_int8
1486
+ . insert ( vk:: PhysicalDeviceShaderFloat16Int8FeaturesKHR :: default ( ) ) ;
1487
+ features2 = features2. push_next ( next) ;
1488
+ }
1489
+ if capabilities. supports_extension ( khr:: _16bit_storage:: NAME ) {
1490
+ let next = features
1491
+ . features_16bit_storage
1492
+ . insert ( vk:: PhysicalDevice16BitStorageFeaturesKHR :: default ( ) ) ;
1493
+ features2 = features2. push_next ( next) ;
1486
1494
}
1487
1495
if capabilities. supports_extension ( khr:: acceleration_structure:: NAME ) {
1488
1496
let next = features
0 commit comments