Module Metal.CommandBuffer

A container for encoded commands that the GPU executes. See MTLCommandBuffer.

type t
val sexp_of_t : t -> Sexplib0.Sexp.t
val set_label : t -> string -> unit
val get_label : t -> string
val get_device : t -> Device.t
val get_command_queue : t -> CommandQueue.t
val get_retained_references : t -> bool

Checks if the buffer retains references to its resources.

val on_queue : CommandQueue.t -> t
val on_queue_with_unretained_references : CommandQueue.t -> t

Creates a command buffer that does not retain references to its resources.

val enqueue : t -> unit

Adds the command buffer to the end of the command queue.

val commit : t -> unit

Commits the command buffer for execution as soon as possible.

val add_scheduled_handler : t -> (t -> unit) -> unit

Registers a block to be called when the buffer is scheduled.

val add_completed_handler : t -> (t -> unit) -> unit

Registers a block to be called when the buffer finishes execution.

val wait_until_scheduled : t -> unit

Blocks the calling thread until the buffer is scheduled.

val wait_until_completed : t -> unit

Blocks the calling thread until the buffer finishes execution.

module Status : sig ... end

The execution status of the command buffer. See MTLCommandBufferStatus.

val get_status : t -> Status.t
val get_error : t -> string option

Gets the error object if the status is Error, otherwise None.

val get_gpu_start_time : t -> float

Gets the host time (seconds) when the GPU started executing the buffer.

val get_gpu_end_time : t -> float

Gets the host time (seconds) when the GPU finished executing the buffer.

val encode_wait_for_event : t -> Event.t -> Unsigned.ULLong.t -> unit
val encode_signal_event : t -> Event.t -> Unsigned.ULLong.t -> unit
val push_debug_group : t -> string -> unit
val pop_debug_group : t -> unit