Module Metal.Buffer

Represents a block of untyped memory accessible by the GPU. See MTLBuffer.

type t
val sexp_of_t : t -> Sexplib0.Sexp.t
val super : t -> Resource.t
val on_device : Device.t -> length:int -> ResourceOptions.t -> t
val on_device_with_bytes : Device.t -> bytes:unit Ctypes.ptr -> length:int -> ResourceOptions.t -> t

Creates a buffer and initializes its contents by copying from a pointer.

val on_device_with_bytes_no_copy : Device.t -> bytes:unit Ctypes.ptr -> length:int -> ?deallocator:(unit -> unit) -> ResourceOptions.t -> t

Creates a buffer that wraps existing memory without copying.

val length : t -> int

Gets the length of the buffer in bytes.

val contents : t -> unit Ctypes.ptr

Gets a pointer to the buffer's contents (requires appropriate storage/cache mode and synchronization).

val did_modify_range : t -> Range.t -> unit

Informs Metal that a range of a managed buffer was modified by the CPU. This is not needed for shared buffers (NOTE: validation layer will report an error).

val add_debug_marker : t -> marker:string -> Range.t -> unit
val remove_all_debug_markers : t -> unit
val get_gpu_address : t -> Unsigned.ULLong.t

Gets the GPU virtual address of the buffer.