yum-mirror/VkFFT

git clone https://git.yummers.dev/yum-mirror/VkFFT

Tolmachev DmitriiMetal support in VkFFTba7001c

develop
11.6 KiB344 linesraw
1//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2//
3// Metal/MTLVertexDescriptor.hpp
4//
5// Copyright 2020-2021 Apple Inc.
6//
7// Licensed under the Apache License, Version 2.0 (the "License");
8// you may not use this file except in compliance with the License.
9// You may obtain a copy of the License at
10//
11//     http://www.apache.org/licenses/LICENSE-2.0
12//
13// Unless required by applicable law or agreed to in writing, software
14// distributed under the License is distributed on an "AS IS" BASIS,
15// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16// See the License for the specific language governing permissions and
17// limitations under the License.
18//
19//-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
21#pragma once
22
23#include "MTLDefines.hpp"
24#include "MTLHeaderBridge.hpp"
25#include "MTLPrivate.hpp"
26
27#include <Foundation/Foundation.hpp>
28
29#include "MTLVertexDescriptor.hpp"
30
31namespace MTL
32{
33_MTL_ENUM(NS::UInteger, VertexFormat) {
34    VertexFormatInvalid = 0,
35    VertexFormatUChar2 = 1,
36    VertexFormatUChar3 = 2,
37    VertexFormatUChar4 = 3,
38    VertexFormatChar2 = 4,
39    VertexFormatChar3 = 5,
40    VertexFormatChar4 = 6,
41    VertexFormatUChar2Normalized = 7,
42    VertexFormatUChar3Normalized = 8,
43    VertexFormatUChar4Normalized = 9,
44    VertexFormatChar2Normalized = 10,
45    VertexFormatChar3Normalized = 11,
46    VertexFormatChar4Normalized = 12,
47    VertexFormatUShort2 = 13,
48    VertexFormatUShort3 = 14,
49    VertexFormatUShort4 = 15,
50    VertexFormatShort2 = 16,
51    VertexFormatShort3 = 17,
52    VertexFormatShort4 = 18,
53    VertexFormatUShort2Normalized = 19,
54    VertexFormatUShort3Normalized = 20,
55    VertexFormatUShort4Normalized = 21,
56    VertexFormatShort2Normalized = 22,
57    VertexFormatShort3Normalized = 23,
58    VertexFormatShort4Normalized = 24,
59    VertexFormatHalf2 = 25,
60    VertexFormatHalf3 = 26,
61    VertexFormatHalf4 = 27,
62    VertexFormatFloat = 28,
63    VertexFormatFloat2 = 29,
64    VertexFormatFloat3 = 30,
65    VertexFormatFloat4 = 31,
66    VertexFormatInt = 32,
67    VertexFormatInt2 = 33,
68    VertexFormatInt3 = 34,
69    VertexFormatInt4 = 35,
70    VertexFormatUInt = 36,
71    VertexFormatUInt2 = 37,
72    VertexFormatUInt3 = 38,
73    VertexFormatUInt4 = 39,
74    VertexFormatInt1010102Normalized = 40,
75    VertexFormatUInt1010102Normalized = 41,
76    VertexFormatUChar4Normalized_BGRA = 42,
77    VertexFormatUChar = 45,
78    VertexFormatChar = 46,
79    VertexFormatUCharNormalized = 47,
80    VertexFormatCharNormalized = 48,
81    VertexFormatUShort = 49,
82    VertexFormatShort = 50,
83    VertexFormatUShortNormalized = 51,
84    VertexFormatShortNormalized = 52,
85    VertexFormatHalf = 53,
86};
87
88_MTL_ENUM(NS::UInteger, VertexStepFunction) {
89    VertexStepFunctionConstant = 0,
90    VertexStepFunctionPerVertex = 1,
91    VertexStepFunctionPerInstance = 2,
92    VertexStepFunctionPerPatch = 3,
93    VertexStepFunctionPerPatchControlPoint = 4,
94};
95
96class VertexBufferLayoutDescriptor : public NS::Copying<VertexBufferLayoutDescriptor>
97{
98public:
99    static class VertexBufferLayoutDescriptor* alloc();
100
101    class VertexBufferLayoutDescriptor*        init();
102
103    NS::UInteger                               stride() const;
104    void                                       setStride(NS::UInteger stride);
105
106    MTL::VertexStepFunction                    stepFunction() const;
107    void                                       setStepFunction(MTL::VertexStepFunction stepFunction);
108
109    NS::UInteger                               stepRate() const;
110    void                                       setStepRate(NS::UInteger stepRate);
111};
112
113class VertexBufferLayoutDescriptorArray : public NS::Referencing<VertexBufferLayoutDescriptorArray>
114{
115public:
116    static class VertexBufferLayoutDescriptorArray* alloc();
117
118    class VertexBufferLayoutDescriptorArray*        init();
119
120    class VertexBufferLayoutDescriptor*             object(NS::UInteger index);
121
122    void                                            setObject(const class VertexBufferLayoutDescriptor* bufferDesc, NS::UInteger index);
123};
124
125class VertexAttributeDescriptor : public NS::Copying<VertexAttributeDescriptor>
126{
127public:
128    static class VertexAttributeDescriptor* alloc();
129
130    class VertexAttributeDescriptor*        init();
131
132    MTL::VertexFormat                       format() const;
133    void                                    setFormat(MTL::VertexFormat format);
134
135    NS::UInteger                            offset() const;
136    void                                    setOffset(NS::UInteger offset);
137
138    NS::UInteger                            bufferIndex() const;
139    void                                    setBufferIndex(NS::UInteger bufferIndex);
140};
141
142class VertexAttributeDescriptorArray : public NS::Referencing<VertexAttributeDescriptorArray>
143{
144public:
145    static class VertexAttributeDescriptorArray* alloc();
146
147    class VertexAttributeDescriptorArray*        init();
148
149    class VertexAttributeDescriptor*             object(NS::UInteger index);
150
151    void                                         setObject(const class VertexAttributeDescriptor* attributeDesc, NS::UInteger index);
152};
153
154class VertexDescriptor : public NS::Copying<VertexDescriptor>
155{
156public:
157    static class VertexDescriptor*           alloc();
158
159    class VertexDescriptor*                  init();
160
161    static class VertexDescriptor*           vertexDescriptor();
162
163    class VertexBufferLayoutDescriptorArray* layouts() const;
164
165    class VertexAttributeDescriptorArray*    attributes() const;
166
167    void                                     reset();
168};
169
170}
171
172// static method: alloc
173_MTL_INLINE MTL::VertexBufferLayoutDescriptor* MTL::VertexBufferLayoutDescriptor::alloc()
174{
175    return NS::Object::alloc<MTL::VertexBufferLayoutDescriptor>(_MTL_PRIVATE_CLS(MTLVertexBufferLayoutDescriptor));
176}
177
178// method: init
179_MTL_INLINE MTL::VertexBufferLayoutDescriptor* MTL::VertexBufferLayoutDescriptor::init()
180{
181    return NS::Object::init<MTL::VertexBufferLayoutDescriptor>();
182}
183
184// property: stride
185_MTL_INLINE NS::UInteger MTL::VertexBufferLayoutDescriptor::stride() const
186{
187    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(stride));
188}
189
190_MTL_INLINE void MTL::VertexBufferLayoutDescriptor::setStride(NS::UInteger stride)
191{
192    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStride_), stride);
193}
194
195// property: stepFunction
196_MTL_INLINE MTL::VertexStepFunction MTL::VertexBufferLayoutDescriptor::stepFunction() const
197{
198    return Object::sendMessage<MTL::VertexStepFunction>(this, _MTL_PRIVATE_SEL(stepFunction));
199}
200
201_MTL_INLINE void MTL::VertexBufferLayoutDescriptor::setStepFunction(MTL::VertexStepFunction stepFunction)
202{
203    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStepFunction_), stepFunction);
204}
205
206// property: stepRate
207_MTL_INLINE NS::UInteger MTL::VertexBufferLayoutDescriptor::stepRate() const
208{
209    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(stepRate));
210}
211
212_MTL_INLINE void MTL::VertexBufferLayoutDescriptor::setStepRate(NS::UInteger stepRate)
213{
214    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStepRate_), stepRate);
215}
216
217// static method: alloc
218_MTL_INLINE MTL::VertexBufferLayoutDescriptorArray* MTL::VertexBufferLayoutDescriptorArray::alloc()
219{
220    return NS::Object::alloc<MTL::VertexBufferLayoutDescriptorArray>(_MTL_PRIVATE_CLS(MTLVertexBufferLayoutDescriptorArray));
221}
222
223// method: init
224_MTL_INLINE MTL::VertexBufferLayoutDescriptorArray* MTL::VertexBufferLayoutDescriptorArray::init()
225{
226    return NS::Object::init<MTL::VertexBufferLayoutDescriptorArray>();
227}
228
229// method: objectAtIndexedSubscript:
230_MTL_INLINE MTL::VertexBufferLayoutDescriptor* MTL::VertexBufferLayoutDescriptorArray::object(NS::UInteger index)
231{
232    return Object::sendMessage<MTL::VertexBufferLayoutDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), index);
233}
234
235// method: setObject:atIndexedSubscript:
236_MTL_INLINE void MTL::VertexBufferLayoutDescriptorArray::setObject(const MTL::VertexBufferLayoutDescriptor* bufferDesc, NS::UInteger index)
237{
238    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), bufferDesc, index);
239}
240
241// static method: alloc
242_MTL_INLINE MTL::VertexAttributeDescriptor* MTL::VertexAttributeDescriptor::alloc()
243{
244    return NS::Object::alloc<MTL::VertexAttributeDescriptor>(_MTL_PRIVATE_CLS(MTLVertexAttributeDescriptor));
245}
246
247// method: init
248_MTL_INLINE MTL::VertexAttributeDescriptor* MTL::VertexAttributeDescriptor::init()
249{
250    return NS::Object::init<MTL::VertexAttributeDescriptor>();
251}
252
253// property: format
254_MTL_INLINE MTL::VertexFormat MTL::VertexAttributeDescriptor::format() const
255{
256    return Object::sendMessage<MTL::VertexFormat>(this, _MTL_PRIVATE_SEL(format));
257}
258
259_MTL_INLINE void MTL::VertexAttributeDescriptor::setFormat(MTL::VertexFormat format)
260{
261    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFormat_), format);
262}
263
264// property: offset
265_MTL_INLINE NS::UInteger MTL::VertexAttributeDescriptor::offset() const
266{
267    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(offset));
268}
269
270_MTL_INLINE void MTL::VertexAttributeDescriptor::setOffset(NS::UInteger offset)
271{
272    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOffset_), offset);
273}
274
275// property: bufferIndex
276_MTL_INLINE NS::UInteger MTL::VertexAttributeDescriptor::bufferIndex() const
277{
278    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(bufferIndex));
279}
280
281_MTL_INLINE void MTL::VertexAttributeDescriptor::setBufferIndex(NS::UInteger bufferIndex)
282{
283    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBufferIndex_), bufferIndex);
284}
285
286// static method: alloc
287_MTL_INLINE MTL::VertexAttributeDescriptorArray* MTL::VertexAttributeDescriptorArray::alloc()
288{
289    return NS::Object::alloc<MTL::VertexAttributeDescriptorArray>(_MTL_PRIVATE_CLS(MTLVertexAttributeDescriptorArray));
290}
291
292// method: init
293_MTL_INLINE MTL::VertexAttributeDescriptorArray* MTL::VertexAttributeDescriptorArray::init()
294{
295    return NS::Object::init<MTL::VertexAttributeDescriptorArray>();
296}
297
298// method: objectAtIndexedSubscript:
299_MTL_INLINE MTL::VertexAttributeDescriptor* MTL::VertexAttributeDescriptorArray::object(NS::UInteger index)
300{
301    return Object::sendMessage<MTL::VertexAttributeDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), index);
302}
303
304// method: setObject:atIndexedSubscript:
305_MTL_INLINE void MTL::VertexAttributeDescriptorArray::setObject(const MTL::VertexAttributeDescriptor* attributeDesc, NS::UInteger index)
306{
307    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attributeDesc, index);
308}
309
310// static method: alloc
311_MTL_INLINE MTL::VertexDescriptor* MTL::VertexDescriptor::alloc()
312{
313    return NS::Object::alloc<MTL::VertexDescriptor>(_MTL_PRIVATE_CLS(MTLVertexDescriptor));
314}
315
316// method: init
317_MTL_INLINE MTL::VertexDescriptor* MTL::VertexDescriptor::init()
318{
319    return NS::Object::init<MTL::VertexDescriptor>();
320}
321
322// static method: vertexDescriptor
323_MTL_INLINE MTL::VertexDescriptor* MTL::VertexDescriptor::vertexDescriptor()
324{
325    return Object::sendMessage<MTL::VertexDescriptor*>(_MTL_PRIVATE_CLS(MTLVertexDescriptor), _MTL_PRIVATE_SEL(vertexDescriptor));
326}
327
328// property: layouts
329_MTL_INLINE MTL::VertexBufferLayoutDescriptorArray* MTL::VertexDescriptor::layouts() const
330{
331    return Object::sendMessage<MTL::VertexBufferLayoutDescriptorArray*>(this, _MTL_PRIVATE_SEL(layouts));
332}
333
334// property: attributes
335_MTL_INLINE MTL::VertexAttributeDescriptorArray* MTL::VertexDescriptor::attributes() const
336{
337    return Object::sendMessage<MTL::VertexAttributeDescriptorArray*>(this, _MTL_PRIVATE_SEL(attributes));
338}
339
340// method: reset
341_MTL_INLINE void MTL::VertexDescriptor::reset()
342{
343    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
344}