Metal.LogStateContainer for shader log messages. See MTLLogState.
A container for shader log messages. See MTLLogState.
val sexp_of_t : t -> Sexplib0.Sexp.tval on_device_with_descriptor : Device.t -> LogStateDescriptor.t -> tCreates a log state object using the specified descriptor. See newLogStateWithDescriptor:error:.
type log_entry = {sub_system : string option;category : string option;level : LogLevel.t;message : string;}One shader log message, as Metal delivered it.
Messages captured by a native handler, waiting for drain_log_buffer.
val add_buffered_log_handler : t -> log_bufferAdds a native handler block (see addLogHandler:) that copies every message into a C-side buffer, and returns that buffer. Metal calls log handlers on its own dispatch threads; this handler never runs OCaml code there, so it is safe whatever the host thread is doing. Read the messages from the host with drain_log_buffer, typically after waiting for the command buffers that log. The buffer is unbounded between drains. Once the returned handle is collected, later messages are dropped.
val drain_log_buffer : log_buffer -> log_entry list * intRemoves and returns the messages buffered since the previous drain, in the order Metal delivered them, together with the number of messages dropped in that span because memory could not be allocated for them. Thread-safe with respect to Metal's handler calls: a message delivered during a drain appears in this drain or in the next one, exactly once.
val add_log_handler :
t ->
(sub_system:string option ->
category:string option ->
level:LogLevel.t ->
message:string ->
unit) ->
unitAdds a handler block to process log messages. See addLogHandler:.
Prefer add_buffered_log_handler. The OCaml handler runs on a thread Metal owns, entering the OCaml runtime from there, so it can stall behind (or deadlock with) a host thread blocked in a Metal call. It is not marked deprecated so that a client built with alerts as errors keeps compiling against this release.