diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs index 7e297421a8..141d8ba5e9 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -761,9 +761,19 @@ impl super::Device { let image = self.create_image_without_memory(desc, Some(&mut external_memory_image_info))?; + // Some external memory types require dedicated allocation + // https://docs.vulkan.org/guide/latest/extensions/external.html#_importing_memory + let mut dedicated_allocate_info = + vk::MemoryDedicatedAllocateInfo::default().image(image.raw); + let mut import_memory_info = vk::ImportMemoryWin32HandleInfoKHR::default() .handle_type(vk::ExternalMemoryHandleTypeFlags::D3D11_TEXTURE) .handle(d3d11_shared_handle.0 as _); + // TODO: We should use `push_next` instead, but currently ash does not provide this method for the `ImportMemoryWin32HandleInfoKHR` type. + #[allow(clippy::unnecessary_mut_passed)] + { + import_memory_info.p_next = <*const _>::cast(&mut dedicated_allocate_info); + } let mem_type_index = self .find_memory_type_index(