Module Vulkan_api.Memory

type 'a buffer = {
  1. buffer : Vulkan_types.vk_buffer;
  2. memory : Vulkan_types.vk_device_memory;
  3. size : int;
  4. elem_size : int;
  5. device : Device.t;
  6. mutable mapped_ptr : unit Ctypes.ptr option;
}
val find_memory_type : Device.t -> int -> int -> int

Find suitable memory type

val vk_whole_size : Unsigned.UInt64.t
val alloc : Device.t -> int -> ('a, 'b) Stdlib.Bigarray.kind -> 'c buffer
val alloc_custom : Device.t -> size:int -> elem_size:int -> 'a buffer
val free : 'a buffer -> unit
val device_ptr : 'a -> nativeint

Vulkan doesn't expose device pointers like CUDA. Return 0 as placeholder. Binding uses the buffer handle directly via set_arg_buffer.

val is_zero_copy : 'a -> bool

Vulkan always uses explicit transfers (vkMapMemory/memcpy), never zero-copy

val host_to_device : src:('a, 'b, 'c) Stdlib.Bigarray.Array1.t -> dst:'d buffer -> unit
val device_to_host : src:'a buffer -> dst:('b, 'c, 'd) Stdlib.Bigarray.Array1.t -> unit
val host_ptr_to_device : src_ptr:unit Ctypes_static.ptr -> byte_size:int -> dst:'a buffer -> unit
val device_to_host_ptr : src:'a buffer -> dst_ptr:unit Ctypes_static.ptr -> byte_size:int -> unit
val device_to_device : src:'a -> dst:'b -> 'c
val memset : 'a -> 'b -> 'c