File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -903,6 +903,11 @@ impl PhysicalDeviceProperties {
903903 if requested_features. contains ( wgt:: Features :: TEXTURE_FORMAT_NV12 ) {
904904 extensions. push ( khr:: sampler_ycbcr_conversion:: NAME ) ;
905905 }
906+
907+ // Optional `VK_KHR_external_memory_win32`
908+ if self . supports_extension ( khr:: external_memory_win32:: NAME ) {
909+ extensions. push ( khr:: external_memory_win32:: NAME ) ;
910+ }
906911 }
907912
908913 if self . device_api_version < vk:: API_VERSION_1_2 {
@@ -1539,6 +1544,8 @@ impl super::Instance {
15391544 } ) ,
15401545 image_format_list : phd_capabilities. device_api_version >= vk:: API_VERSION_1_2
15411546 || phd_capabilities. supports_extension ( khr:: image_format_list:: NAME ) ,
1547+ external_memory_win32 : phd_capabilities. device_api_version >= vk:: API_VERSION_1_1
1548+ || phd_capabilities. supports_extension ( khr:: external_memory_win32:: NAME ) ,
15421549 } ;
15431550 let capabilities = crate :: Capabilities {
15441551 limits : phd_capabilities. to_wgpu_limits ( ) ,
Original file line number Diff line number Diff line change @@ -800,13 +800,19 @@ impl super::Device {
800800 }
801801
802802 /// # Safety
803- /// The `d3d11_shared_handle` must be valid and respecting `desc`.
803+ ///
804+ /// - Vulkan 1.1+ (or VK_KHR_external_memory)
805+ /// - The `d3d11_shared_handle` must be valid and respecting `desc`
804806 #[ cfg( windows) ]
805807 pub unsafe fn texture_from_d3d11_shared_handle (
806808 & self ,
807809 d3d11_shared_handle : * mut std:: ffi:: c_void ,
808810 desc : & crate :: TextureDescriptor ,
809811 ) -> Result < super :: Texture , crate :: DeviceError > {
812+ if !self . shared . private_caps . external_memory_win32 {
813+ return Err ( crate :: DeviceError :: ResourceCreationFailed ) ;
814+ }
815+
810816 let mut external_memory_image_info = vk:: ExternalMemoryImageCreateInfo :: default ( )
811817 . handle_types ( vk:: ExternalMemoryHandleTypeFlags :: D3D11_TEXTURE_KMT ) ;
812818
Original file line number Diff line number Diff line change @@ -526,6 +526,7 @@ struct PrivateCapabilities {
526526 robust_image_access2 : bool ,
527527 zero_initialize_workgroup_memory : bool ,
528528 image_format_list : bool ,
529+ external_memory_win32 : bool ,
529530}
530531
531532bitflags:: bitflags!(
You can’t perform that action at this time.
0 commit comments