Commit 7de3fde 1 parent 7c75ac7 commit 7de3fde Copy full SHA for 7de3fde
File tree 4 files changed +22
-8
lines changed
4 files changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -776,6 +776,11 @@ impl PhysicalDeviceFeatures {
776
776
caps. supports_extension ( google:: display_timing:: NAME ) ,
777
777
) ;
778
778
779
+ features. set (
780
+ F :: VULKAN_EXTERNAL_MEMORY_WIN32 ,
781
+ caps. supports_extension ( khr:: external_memory_win32:: NAME ) ,
782
+ ) ;
783
+
779
784
( features, dl_flags)
780
785
}
781
786
@@ -1554,9 +1559,6 @@ impl super::Instance {
1554
1559
. is_some_and ( |ext| ext. shader_zero_initialize_workgroup_memory == vk:: TRUE ) ,
1555
1560
image_format_list : phd_capabilities. device_api_version >= vk:: API_VERSION_1_2
1556
1561
|| phd_capabilities. supports_extension ( khr:: image_format_list:: NAME ) ,
1557
- #[ cfg( windows) ]
1558
- external_memory_win32 : phd_capabilities
1559
- . supports_extension ( khr:: external_memory_win32:: NAME ) ,
1560
1562
} ;
1561
1563
let capabilities = crate :: Capabilities {
1562
1564
limits : phd_capabilities. to_wgpu_limits ( ) ,
Original file line number Diff line number Diff line change @@ -786,7 +786,7 @@ impl super::Device {
786
786
787
787
/// # Safety
788
788
///
789
- /// - Vulkan 1.1+ (or VK_KHR_external_memory )
789
+ /// - Vulkan (with VK_KHR_external_memory_win32 )
790
790
/// - The `d3d11_shared_handle` must be valid and respecting `desc`
791
791
/// - `VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT` flag is used because we need to hold a reference to the handle
792
792
#[ cfg( windows) ]
@@ -795,8 +795,12 @@ impl super::Device {
795
795
d3d11_shared_handle : windows:: Win32 :: Foundation :: HANDLE ,
796
796
desc : & crate :: TextureDescriptor ,
797
797
) -> Result < super :: Texture , crate :: DeviceError > {
798
- if !self . shared . private_caps . external_memory_win32 {
799
- log:: error!( "VK_KHR_external_memory extension is required" ) ;
798
+ if !self
799
+ . shared
800
+ . features
801
+ . contains ( wgt:: Features :: VULKAN_EXTERNAL_MEMORY_WIN32 )
802
+ {
803
+ log:: error!( "Vulkan driver does not support VK_KHR_external_memory_win32" ) ;
800
804
return Err ( crate :: DeviceError :: ResourceCreationFailed ) ;
801
805
}
802
806
Original file line number Diff line number Diff line change @@ -532,8 +532,6 @@ struct PrivateCapabilities {
532
532
robust_image_access2 : bool ,
533
533
zero_initialize_workgroup_memory : bool ,
534
534
image_format_list : bool ,
535
- #[ cfg( windows) ]
536
- external_memory_win32 : bool ,
537
535
}
538
536
539
537
bitflags:: bitflags!(
Original file line number Diff line number Diff line change @@ -942,6 +942,16 @@ bitflags::bitflags! {
942
942
/// [VK_GOOGLE_display_timing]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_GOOGLE_display_timing.html
943
943
/// [`Surface::as_hal()`]: https://docs.rs/wgpu/latest/wgpu/struct.Surface.html#method.as_hal
944
944
const VULKAN_GOOGLE_DISPLAY_TIMING = 1 << 62 ;
945
+
946
+ /// Allows using the [VK_KHR_external_memory_win32] Vulkan extension.
947
+ ///
948
+ /// Supported platforms:
949
+ /// - Vulkan (with [VK_KHR_external_memory_win32])
950
+ ///
951
+ /// This is a native only feature.
952
+ ///
953
+ /// [VK_KHR_external_memory_win32]: https://registry.khronos.org/vulkan/specs/latest/man/html/VK_KHR_external_memory_win32.html
954
+ const VULKAN_EXTERNAL_MEMORY_WIN32 = 1 << 63 ;
945
955
}
946
956
}
947
957
You can’t perform that action at this time.
0 commit comments