Module Sarek_vulkan.Vulkan_api_transfer

Ranged host<->device copies (specs/vulkan-async-api.md).

Every copy completes before it returns. It first completes the device's pending launches (Vulkan_api_device.drain_pending), so it never lands under a kernel still using the buffer and always sees what a kernel wrote; a copy issued before a launch is visible to it (the launch is recorded after the copy has finished).

Three paths, by where the host bytes and the device bytes live:

module Device = Vulkan_api_device
module Memory = Vulkan_api_memory
module Host = Vulkan_api_host
val total_bytes : 'a Memory.buffer -> int
val advance : unit Ctypes.ptr -> int -> unit Ctypes.ptr
val record_copy : Vulkan_types.vk_command_buffer Ctypes.structure Ctypes_static.ptr -> src:Vulkan_types.vk_buffer -> src_offset:int -> dst:Vulkan_types.vk_buffer -> dst_offset:int -> byte_size:int -> unit
val dma_min_bytes : int

Host-to-device into a MAPPED buffer from a pinned range: below this many bytes a memcpy beats the submission and fence wait of a DMA copy (4 MiB: 19.0 vs 16.7 GB/s; 16 MiB: 19.0 vs 21.6 GB/s; RX 7900 XTX, H7 bench).

val with_staging : ?cached:bool -> Memory.Device.t -> byte_size:int -> usage:int -> (Vulkan_types.vk_buffer -> unit Ctypes_static.ptr -> 'a) -> 'a
val check_range : what:string -> 'a Memory.buffer -> off:int -> byte_size:int -> unit
val host_to_device_staged : 'a Memory.buffer -> src_ptr:unit Ctypes_static.ptr -> dst_offset:int -> byte_size:int -> unit
val device_to_host_staged : 'a Memory.buffer -> dst_ptr:unit Ctypes_static.ptr -> src_offset:int -> byte_size:int -> unit
val host_to_device_dma : 'a Memory.buffer -> import:Vulkan_types.vk_buffer -> src_offset:int -> dst_offset:int -> byte_size:int -> unit
val device_to_host_dma : 'a Memory.buffer -> import:Vulkan_types.vk_buffer -> src_offset:int -> dst_offset:int -> byte_size:int -> unit
val host_to_device : src_ptr:nativeint -> dst:'a Memory.buffer -> dst_offset:int -> byte_size:int -> unit

byte_size bytes from raw host address src_ptr to dst_offset of dst.

val device_to_host : src:'a Memory.buffer -> src_offset:int -> dst_ptr:nativeint -> byte_size:int -> unit

byte_size bytes from src_offset of src to raw host address dst_ptr.