icrate 0.1.2

Bindings to Apple's frameworks
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::Foundation::*;
use crate::Metal::*;

ns_options!(
    #[underlying(NSUInteger)]
    pub enum MTLIndirectCommandType {
        MTLIndirectCommandTypeDraw = 1 << 0,
        MTLIndirectCommandTypeDrawIndexed = 1 << 1,
        MTLIndirectCommandTypeDrawPatches = 1 << 2,
        MTLIndirectCommandTypeDrawIndexedPatches = 1 << 3,
        MTLIndirectCommandTypeConcurrentDispatch = 1 << 5,
        MTLIndirectCommandTypeConcurrentDispatchThreads = 1 << 6,
    }
);

extern_struct!(
    #[encoding_name("?")]
    pub struct MTLIndirectCommandBufferExecutionRange {
        pub location: u32,
        pub length: u32,
    }
);

inline_fn!(
    pub unsafe fn MTLIndirectCommandBufferExecutionRangeMake(
        location: u32,
        length: u32,
    ) -> MTLIndirectCommandBufferExecutionRange {
        todo!()
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "Metal_MTLIndirectCommandBufferDescriptor")]
    pub struct MTLIndirectCommandBufferDescriptor;

    #[cfg(feature = "Metal_MTLIndirectCommandBufferDescriptor")]
    unsafe impl ClassType for MTLIndirectCommandBufferDescriptor {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "Metal_MTLIndirectCommandBufferDescriptor")]
unsafe impl NSCopying for MTLIndirectCommandBufferDescriptor {}

#[cfg(feature = "Metal_MTLIndirectCommandBufferDescriptor")]
unsafe impl NSObjectProtocol for MTLIndirectCommandBufferDescriptor {}

extern_methods!(
    #[cfg(feature = "Metal_MTLIndirectCommandBufferDescriptor")]
    unsafe impl MTLIndirectCommandBufferDescriptor {
        #[method(commandTypes)]
        pub fn commandTypes(&self) -> MTLIndirectCommandType;

        #[method(setCommandTypes:)]
        pub fn setCommandTypes(&self, command_types: MTLIndirectCommandType);

        #[method(inheritPipelineState)]
        pub fn inheritPipelineState(&self) -> bool;

        #[method(setInheritPipelineState:)]
        pub fn setInheritPipelineState(&self, inherit_pipeline_state: bool);

        #[method(inheritBuffers)]
        pub fn inheritBuffers(&self) -> bool;

        #[method(setInheritBuffers:)]
        pub fn setInheritBuffers(&self, inherit_buffers: bool);

        #[method(maxVertexBufferBindCount)]
        pub fn maxVertexBufferBindCount(&self) -> NSUInteger;

        #[method(setMaxVertexBufferBindCount:)]
        pub fn setMaxVertexBufferBindCount(&self, max_vertex_buffer_bind_count: NSUInteger);

        #[method(maxFragmentBufferBindCount)]
        pub fn maxFragmentBufferBindCount(&self) -> NSUInteger;

        #[method(setMaxFragmentBufferBindCount:)]
        pub fn setMaxFragmentBufferBindCount(&self, max_fragment_buffer_bind_count: NSUInteger);

        #[method(maxKernelBufferBindCount)]
        pub fn maxKernelBufferBindCount(&self) -> NSUInteger;

        #[method(setMaxKernelBufferBindCount:)]
        pub fn setMaxKernelBufferBindCount(&self, max_kernel_buffer_bind_count: NSUInteger);

        #[method(maxKernelThreadgroupMemoryBindCount)]
        pub unsafe fn maxKernelThreadgroupMemoryBindCount(&self) -> NSUInteger;

        #[method(setMaxKernelThreadgroupMemoryBindCount:)]
        pub unsafe fn setMaxKernelThreadgroupMemoryBindCount(
            &self,
            max_kernel_threadgroup_memory_bind_count: NSUInteger,
        );

        #[method(supportRayTracing)]
        pub unsafe fn supportRayTracing(&self) -> bool;

        #[method(setSupportRayTracing:)]
        pub unsafe fn setSupportRayTracing(&self, support_ray_tracing: bool);

        #[method(supportDynamicAttributeStride)]
        pub unsafe fn supportDynamicAttributeStride(&self) -> bool;

        #[method(setSupportDynamicAttributeStride:)]
        pub unsafe fn setSupportDynamicAttributeStride(
            &self,
            support_dynamic_attribute_stride: bool,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "Metal_MTLIndirectCommandBufferDescriptor")]
    unsafe impl MTLIndirectCommandBufferDescriptor {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);

extern_protocol!(
    pub unsafe trait MTLIndirectCommandBuffer: MTLResource {
        #[method(size)]
        fn size(&self) -> NSUInteger;

        #[method(gpuResourceID)]
        unsafe fn gpuResourceID(&self) -> MTLResourceID;

        #[method(resetWithRange:)]
        unsafe fn resetWithRange(&self, range: NSRange);

        #[method_id(@__retain_semantics Other indirectRenderCommandAtIndex:)]
        unsafe fn indirectRenderCommandAtIndex(
            &self,
            command_index: NSUInteger,
        ) -> Id<ProtocolObject<dyn MTLIndirectRenderCommand>>;

        #[method_id(@__retain_semantics Other indirectComputeCommandAtIndex:)]
        unsafe fn indirectComputeCommandAtIndex(
            &self,
            command_index: NSUInteger,
        ) -> Id<ProtocolObject<dyn MTLIndirectComputeCommand>>;
    }

    unsafe impl ProtocolType for dyn MTLIndirectCommandBuffer {}
);