mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Fix texture_from_d3d11_shared_handle compatibility on AMD/Nvidia GPUs (#7782)
* wrapper dedicated allocate info * comment on why p_next is set manually
This commit is contained in:
parent
f96ac55aa4
commit
65337894f6
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user