mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
refactor(dx12): extract copy_aligned in copy_texture_to_buffer
This commit is contained in:
parent
4db543cf9b
commit
ce69059fdf
@ -653,8 +653,11 @@ impl crate::CommandEncoder for super::CommandEncoder {
|
|||||||
) where
|
) where
|
||||||
T: Iterator<Item = crate::BufferTextureCopy>,
|
T: Iterator<Item = crate::BufferTextureCopy>,
|
||||||
{
|
{
|
||||||
for r in regions {
|
let copy_aligned = |this: &mut Self,
|
||||||
let list = self.list.as_ref().unwrap();
|
src: &super::Texture,
|
||||||
|
dst: &super::Buffer,
|
||||||
|
r: crate::BufferTextureCopy| {
|
||||||
|
let list = this.list.as_ref().unwrap();
|
||||||
|
|
||||||
let src_location = Direct3D12::D3D12_TEXTURE_COPY_LOCATION {
|
let src_location = Direct3D12::D3D12_TEXTURE_COPY_LOCATION {
|
||||||
pResource: unsafe { borrow_interface_temporarily(&src.resource) },
|
pResource: unsafe { borrow_interface_temporarily(&src.resource) },
|
||||||
@ -675,6 +678,10 @@ impl crate::CommandEncoder for super::CommandEncoder {
|
|||||||
unsafe {
|
unsafe {
|
||||||
list.CopyTextureRegion(&dst_location, 0, 0, 0, &src_location, Some(&src_box))
|
list.CopyTextureRegion(&dst_location, 0, 0, 0, &src_location, Some(&src_box))
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
for r in regions {
|
||||||
|
copy_aligned(this, src, dst, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user