Skip to main content

jay_ash/extensions/nv/
copy_memory_indirect.rs

1//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_NV_copy_memory_indirect.html>
2
3use crate::vk;
4
5impl crate::nv::copy_memory_indirect::Device {
6    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdCopyMemoryIndirectNV.html>
7    ///
8    /// `copy_buffer_address` is a buffer device address which is a pointer to an array of
9    /// `copy_count` number of [`vk::CopyMemoryIndirectCommandNV`] structures containing the copy
10    /// parameters, each `stride` bytes apart.
11    #[inline]
12    pub unsafe fn cmd_copy_memory_indirect(
13        &self,
14        command_buffer: vk::CommandBuffer,
15        copy_buffer_address: vk::DeviceAddress,
16        copy_count: u32,
17        stride: u32,
18    ) {
19        unsafe {
20            (self.fp.cmd_copy_memory_indirect_nv)(
21                command_buffer,
22                copy_buffer_address,
23                copy_count,
24                stride,
25            )
26        }
27    }
28
29    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdCopyMemoryToImageIndirectNV.html>
30    ///
31    /// `copy_buffer_address` is a buffer device address which is a pointer to an array of
32    /// `image_subresources.len()` number of [`vk::CopyMemoryToImageIndirectCommandNV`] structures
33    /// containing the copy parameters, each `stride` bytes apart.
34    #[inline]
35    pub unsafe fn cmd_copy_memory_to_image_indirect(
36        &self,
37        command_buffer: vk::CommandBuffer,
38        copy_buffer_address: vk::DeviceAddress,
39        stride: u32,
40        dst_image: vk::Image,
41        dst_image_layout: vk::ImageLayout,
42        image_subresources: &[vk::ImageSubresourceLayers],
43    ) {
44        unsafe {
45            (self.fp.cmd_copy_memory_to_image_indirect_nv)(
46                command_buffer,
47                copy_buffer_address,
48                image_subresources.len() as u32,
49                stride,
50                dst_image,
51                dst_image_layout,
52                image_subresources.as_ptr(),
53            )
54        }
55    }
56}