//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::extern_protocol;
use objc2::rc::Retained;
use objc2::runtime::ProtocolObject;
use objc2_core_foundation::CFTimeInterval;
use objc2_foundation::{NSError, NSObjectProtocol};

use crate::*;

/// Defines the block signature for a callback Metal invokes to provide your app feedback after completing a workload.
///
/// You register a commit feedback block with Metal by providing an instance of ``MTL4CommitOptions`` to
/// the command queue's commit method, ``MTL4CommandQueue/commit:count:options:``. The commit options instance
/// references your commit feedback handler after you add it via its ``MTL4CommitOptions/addFeedbackHandler:``
/// method.
///
/// - Parameter commitFeedback: a commit feedback instance containing information about the workload.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4commitfeedbackhandler?language=objc)
pub type MTL4CommitFeedbackHandler =
    *mut block2::DynBlock<dyn Fn(NonNull<ProtocolObject<dyn MTL4CommitFeedback>>)>;

extern_protocol!(
    /// Describes an object containing debug information from Metal to your app after completing a workload.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4commitfeedback?language=objc)
    pub unsafe trait MTL4CommitFeedback: NSObjectProtocol {
        /// A description of an error when the GPU encounters an issue as it runs the committed command buffers.
        #[unsafe(method(error))]
        #[unsafe(method_family = none)]
        fn error(&self) -> Option<Retained<NSError>>;

        /// The host time, in seconds, when the GPU starts execution of the committed command buffers.
        #[unsafe(method(GPUStartTime))]
        #[unsafe(method_family = none)]
        fn gpu_start_time(&self) -> CFTimeInterval;

        /// The host time, in seconds, when the GPU finishes execution of the committed command buffers.
        #[unsafe(method(GPUEndTime))]
        #[unsafe(method_family = none)]
        fn gpu_end_time(&self) -> CFTimeInterval;
    }
);
