1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//! 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;
    }
);

#[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(supportRayTracing)]
        pub unsafe fn supportRayTracing(&self) -> bool;

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

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>, Shared>;

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

    unsafe impl ProtocolType for dyn MTLIndirectCommandBuffer {}
);