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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::Foundation::*;
use crate::Metal::*;

extern_protocol!(
    pub unsafe trait MTLIndirectRenderCommand: NSObjectProtocol {
        #[method(setRenderPipelineState:)]
        unsafe fn setRenderPipelineState(
            &self,
            pipeline_state: &ProtocolObject<dyn MTLRenderPipelineState>,
        );

        #[method(setVertexBuffer:offset:atIndex:)]
        unsafe fn setVertexBuffer_offset_atIndex(
            &self,
            buffer: &ProtocolObject<dyn MTLBuffer>,
            offset: NSUInteger,
            index: NSUInteger,
        );

        #[method(setFragmentBuffer:offset:atIndex:)]
        unsafe fn setFragmentBuffer_offset_atIndex(
            &self,
            buffer: &ProtocolObject<dyn MTLBuffer>,
            offset: NSUInteger,
            index: NSUInteger,
        );

        #[method(drawPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:)]
        unsafe fn drawPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_instanceCount_baseInstance_tessellationFactorBuffer_tessellationFactorBufferOffset_tessellationFactorBufferInstanceStride(
            &self,
            number_of_patch_control_points: NSUInteger,
            patch_start: NSUInteger,
            patch_count: NSUInteger,
            patch_index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
            patch_index_buffer_offset: NSUInteger,
            instance_count: NSUInteger,
            base_instance: NSUInteger,
            buffer: &ProtocolObject<dyn MTLBuffer>,
            offset: NSUInteger,
            instance_stride: NSUInteger,
        );

        #[method(drawIndexedPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:)]
        unsafe fn drawIndexedPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_controlPointIndexBuffer_controlPointIndexBufferOffset_instanceCount_baseInstance_tessellationFactorBuffer_tessellationFactorBufferOffset_tessellationFactorBufferInstanceStride(
            &self,
            number_of_patch_control_points: NSUInteger,
            patch_start: NSUInteger,
            patch_count: NSUInteger,
            patch_index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
            patch_index_buffer_offset: NSUInteger,
            control_point_index_buffer: &ProtocolObject<dyn MTLBuffer>,
            control_point_index_buffer_offset: NSUInteger,
            instance_count: NSUInteger,
            base_instance: NSUInteger,
            buffer: &ProtocolObject<dyn MTLBuffer>,
            offset: NSUInteger,
            instance_stride: NSUInteger,
        );

        #[method(drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance:)]
        unsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount_baseInstance(
            &self,
            primitive_type: MTLPrimitiveType,
            vertex_start: NSUInteger,
            vertex_count: NSUInteger,
            instance_count: NSUInteger,
            base_instance: NSUInteger,
        );

        #[method(drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:)]
        unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferOffset_instanceCount_baseVertex_baseInstance(
            &self,
            primitive_type: MTLPrimitiveType,
            index_count: NSUInteger,
            index_type: MTLIndexType,
            index_buffer: &ProtocolObject<dyn MTLBuffer>,
            index_buffer_offset: NSUInteger,
            instance_count: NSUInteger,
            base_vertex: NSInteger,
            base_instance: NSUInteger,
        );

        #[method(reset)]
        unsafe fn reset(&self);
    }

    unsafe impl ProtocolType for dyn MTLIndirectRenderCommand {}
);

extern_protocol!(
    pub unsafe trait MTLIndirectComputeCommand: NSObjectProtocol {
        #[method(setComputePipelineState:)]
        unsafe fn setComputePipelineState(
            &self,
            pipeline_state: &ProtocolObject<dyn MTLComputePipelineState>,
        );

        #[method(setKernelBuffer:offset:atIndex:)]
        unsafe fn setKernelBuffer_offset_atIndex(
            &self,
            buffer: &ProtocolObject<dyn MTLBuffer>,
            offset: NSUInteger,
            index: NSUInteger,
        );

        #[method(concurrentDispatchThreadgroups:threadsPerThreadgroup:)]
        unsafe fn concurrentDispatchThreadgroups_threadsPerThreadgroup(
            &self,
            threadgroups_per_grid: MTLSize,
            threads_per_threadgroup: MTLSize,
        );

        #[method(concurrentDispatchThreads:threadsPerThreadgroup:)]
        unsafe fn concurrentDispatchThreads_threadsPerThreadgroup(
            &self,
            threads_per_grid: MTLSize,
            threads_per_threadgroup: MTLSize,
        );

        #[method(setBarrier)]
        unsafe fn setBarrier(&self);

        #[method(clearBarrier)]
        unsafe fn clearBarrier(&self);

        #[method(setImageblockWidth:height:)]
        unsafe fn setImageblockWidth_height(&self, width: NSUInteger, height: NSUInteger);

        #[method(reset)]
        unsafe fn reset(&self);

        #[method(setThreadgroupMemoryLength:atIndex:)]
        unsafe fn setThreadgroupMemoryLength_atIndex(&self, length: NSUInteger, index: NSUInteger);

        #[method(setStageInRegion:)]
        unsafe fn setStageInRegion(&self, region: MTLRegion);
    }

    unsafe impl ProtocolType for dyn MTLIndirectComputeCommand {}
);