@@ -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
} ,
@@ -717,7 +721,9 @@ impl PhysicalDeviceFeatures {
717
721
) ;
718
722
}
719
723
720
- if let Some ( ( ref f16_i8, ref bit16) ) = self . shader_float16 {
724
+ if let ( Some ( ref f16_i8) , Some ( ref bit16) ) =
725
+ ( self . shader_float16_int8 , self . features_16bit_storage )
726
+ {
721
727
features. set (
722
728
F :: SHADER_F16 ,
723
729
f16_i8. shader_float16 != 0
@@ -1467,15 +1473,17 @@ impl super::InstanceShared {
1467
1473
. insert ( vk:: PhysicalDeviceTextureCompressionASTCHDRFeaturesEXT :: default ( ) ) ;
1468
1474
features2 = features2. push_next ( next) ;
1469
1475
}
1470
- if capabilities. supports_extension ( khr:: shader_float16_int8:: NAME )
1471
- && capabilities. supports_extension ( khr:: _16bit_storage:: NAME )
1472
- {
1473
- let next = features. shader_float16 . insert ( (
1474
- vk:: PhysicalDeviceShaderFloat16Int8FeaturesKHR :: default ( ) ,
1475
- vk:: PhysicalDevice16BitStorageFeaturesKHR :: default ( ) ,
1476
- ) ) ;
1477
- features2 = features2. push_next ( & mut next. 0 ) ;
1478
- features2 = features2. push_next ( & mut next. 1 ) ;
1476
+ if capabilities. supports_extension ( khr:: shader_float16_int8:: NAME ) {
1477
+ let next = features
1478
+ . shader_float16_int8
1479
+ . insert ( vk:: PhysicalDeviceShaderFloat16Int8FeaturesKHR :: default ( ) ) ;
1480
+ features2 = features2. push_next ( next) ;
1481
+ }
1482
+ if capabilities. supports_extension ( khr:: _16bit_storage:: NAME ) {
1483
+ let next = features
1484
+ . features_16bit_storage
1485
+ . insert ( vk:: PhysicalDevice16BitStorageFeaturesKHR :: default ( ) ) ;
1486
+ features2 = features2. push_next ( next) ;
1479
1487
}
1480
1488
if capabilities. supports_extension ( khr:: acceleration_structure:: NAME ) {
1481
1489
let next = features
0 commit comments