@@ -62,13 +62,11 @@ pub struct PhysicalDeviceFeatures {
6262 /// Features provided by `VK_EXT_texture_compression_astc_hdr`, promoted to Vulkan 1.3.
6363 astc_hdr : Option < vk:: PhysicalDeviceTextureCompressionASTCHDRFeaturesEXT < ' static > > ,
6464
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+ _16bit_storage : Option < vk:: PhysicalDevice16BitStorageFeatures < ' static > > ,
7270
7371 /// Features provided by `VK_KHR_acceleration_structure`.
7472 acceleration_structure : Option < vk:: PhysicalDeviceAccelerationStructureFeaturesKHR < ' static > > ,
@@ -154,9 +152,11 @@ impl PhysicalDeviceFeatures {
154152 if let Some ( ref mut feature) = self . astc_hdr {
155153 info = info. push_next ( feature) ;
156154 }
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 . _16bit_storage {
159+ info = info. push_next ( feature) ;
160160 }
161161 if let Some ( ref mut feature) = self . zero_initialize_workgroup_memory {
162162 info = info. push_next ( feature) ;
@@ -386,14 +386,18 @@ impl PhysicalDeviceFeatures {
386386 } else {
387387 None
388388 } ,
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+ _16bit_storage : if requested_features. contains ( wgt:: Features :: SHADER_F16 ) {
395+ Some (
392396 vk:: PhysicalDevice16BitStorageFeatures :: default ( )
393397 . storage_buffer16_bit_access ( true )
394398 . storage_input_output16 ( true )
395399 . uniform_and_storage_buffer16_bit_access ( true ) ,
396- ) )
400+ )
397401 } else {
398402 None
399403 } ,
@@ -724,7 +728,8 @@ impl PhysicalDeviceFeatures {
724728 ) ;
725729 }
726730
727- if let Some ( ( ref f16_i8, ref bit16) ) = self . shader_float16 {
731+ if let ( Some ( ref f16_i8) , Some ( ref bit16) ) = ( self . shader_float16_int8 , self . _16bit_storage )
732+ {
728733 features. set (
729734 F :: SHADER_F16 ,
730735 f16_i8. shader_float16 != 0
@@ -1474,15 +1479,17 @@ impl super::InstanceShared {
14741479 . insert ( vk:: PhysicalDeviceTextureCompressionASTCHDRFeaturesEXT :: default ( ) ) ;
14751480 features2 = features2. push_next ( next) ;
14761481 }
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 ) ;
1482+ if capabilities. supports_extension ( khr:: shader_float16_int8:: NAME ) {
1483+ let next = features
1484+ . shader_float16_int8
1485+ . insert ( vk:: PhysicalDeviceShaderFloat16Int8FeaturesKHR :: default ( ) ) ;
1486+ features2 = features2. push_next ( next) ;
1487+ }
1488+ if capabilities. supports_extension ( khr:: _16bit_storage:: NAME ) {
1489+ let next = features
1490+ . _16bit_storage
1491+ . insert ( vk:: PhysicalDevice16BitStorageFeaturesKHR :: default ( ) ) ;
1492+ features2 = features2. push_next ( next) ;
14861493 }
14871494 if capabilities. supports_extension ( khr:: acceleration_structure:: NAME ) {
14881495 let next = features
0 commit comments