yum-mirror/VkFFT

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

Tolmachev DmitriiMetal support in VkFFTba7001c

develop
14.2 KiB357 linesraw
1//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2//
3// Metal/MTLComputePipeline.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 "MTLTypes.hpp"
30
31namespace MTL
32{
33class ComputePipelineReflection : public NS::Referencing<ComputePipelineReflection>
34{
35public:
36    static class ComputePipelineReflection* alloc();
37
38    class ComputePipelineReflection*        init();
39
40    NS::Array*                              arguments() const;
41};
42
43class ComputePipelineDescriptor : public NS::Copying<ComputePipelineDescriptor>
44{
45public:
46    static class ComputePipelineDescriptor* alloc();
47
48    class ComputePipelineDescriptor*        init();
49
50    NS::String*                             label() const;
51    void                                    setLabel(const NS::String* label);
52
53    class Function*                         computeFunction() const;
54    void                                    setComputeFunction(const class Function* computeFunction);
55
56    bool                                    threadGroupSizeIsMultipleOfThreadExecutionWidth() const;
57    void                                    setThreadGroupSizeIsMultipleOfThreadExecutionWidth(bool threadGroupSizeIsMultipleOfThreadExecutionWidth);
58
59    NS::UInteger                            maxTotalThreadsPerThreadgroup() const;
60    void                                    setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup);
61
62    class StageInputOutputDescriptor*       stageInputDescriptor() const;
63    void                                    setStageInputDescriptor(const class StageInputOutputDescriptor* stageInputDescriptor);
64
65    class PipelineBufferDescriptorArray*    buffers() const;
66
67    bool                                    supportIndirectCommandBuffers() const;
68    void                                    setSupportIndirectCommandBuffers(bool supportIndirectCommandBuffers);
69
70    NS::Array*                              insertLibraries() const;
71    void                                    setInsertLibraries(const NS::Array* insertLibraries);
72
73    NS::Array*                              preloadedLibraries() const;
74    void                                    setPreloadedLibraries(const NS::Array* preloadedLibraries);
75
76    NS::Array*                              binaryArchives() const;
77    void                                    setBinaryArchives(const NS::Array* binaryArchives);
78
79    void                                    reset();
80
81    class LinkedFunctions*                  linkedFunctions() const;
82    void                                    setLinkedFunctions(const class LinkedFunctions* linkedFunctions);
83
84    bool                                    supportAddingBinaryFunctions() const;
85    void                                    setSupportAddingBinaryFunctions(bool supportAddingBinaryFunctions);
86
87    NS::UInteger                            maxCallStackDepth() const;
88    void                                    setMaxCallStackDepth(NS::UInteger maxCallStackDepth);
89};
90
91class ComputePipelineState : public NS::Referencing<ComputePipelineState>
92{
93public:
94    NS::String*                      label() const;
95
96    class Device*                    device() const;
97
98    NS::UInteger                     maxTotalThreadsPerThreadgroup() const;
99
100    NS::UInteger                     threadExecutionWidth() const;
101
102    NS::UInteger                     staticThreadgroupMemoryLength() const;
103
104    NS::UInteger                     imageblockMemoryLength(MTL::Size imageblockDimensions);
105
106    bool                             supportIndirectCommandBuffers() const;
107
108    class FunctionHandle*            functionHandle(const class Function* function);
109
110    class ComputePipelineState*      newComputePipelineState(const NS::Array* functions, NS::Error** error);
111
112    class VisibleFunctionTable*      newVisibleFunctionTable(const class VisibleFunctionTableDescriptor* descriptor);
113
114    class IntersectionFunctionTable* newIntersectionFunctionTable(const class IntersectionFunctionTableDescriptor* descriptor);
115};
116
117}
118
119// static method: alloc
120_MTL_INLINE MTL::ComputePipelineReflection* MTL::ComputePipelineReflection::alloc()
121{
122    return NS::Object::alloc<MTL::ComputePipelineReflection>(_MTL_PRIVATE_CLS(MTLComputePipelineReflection));
123}
124
125// method: init
126_MTL_INLINE MTL::ComputePipelineReflection* MTL::ComputePipelineReflection::init()
127{
128    return NS::Object::init<MTL::ComputePipelineReflection>();
129}
130
131// property: arguments
132_MTL_INLINE NS::Array* MTL::ComputePipelineReflection::arguments() const
133{
134    return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(arguments));
135}
136
137// static method: alloc
138_MTL_INLINE MTL::ComputePipelineDescriptor* MTL::ComputePipelineDescriptor::alloc()
139{
140    return NS::Object::alloc<MTL::ComputePipelineDescriptor>(_MTL_PRIVATE_CLS(MTLComputePipelineDescriptor));
141}
142
143// method: init
144_MTL_INLINE MTL::ComputePipelineDescriptor* MTL::ComputePipelineDescriptor::init()
145{
146    return NS::Object::init<MTL::ComputePipelineDescriptor>();
147}
148
149// property: label
150_MTL_INLINE NS::String* MTL::ComputePipelineDescriptor::label() const
151{
152    return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
153}
154
155_MTL_INLINE void MTL::ComputePipelineDescriptor::setLabel(const NS::String* label)
156{
157    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
158}
159
160// property: computeFunction
161_MTL_INLINE MTL::Function* MTL::ComputePipelineDescriptor::computeFunction() const
162{
163    return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(computeFunction));
164}
165
166_MTL_INLINE void MTL::ComputePipelineDescriptor::setComputeFunction(const MTL::Function* computeFunction)
167{
168    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputeFunction_), computeFunction);
169}
170
171// property: threadGroupSizeIsMultipleOfThreadExecutionWidth
172_MTL_INLINE bool MTL::ComputePipelineDescriptor::threadGroupSizeIsMultipleOfThreadExecutionWidth() const
173{
174    return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(threadGroupSizeIsMultipleOfThreadExecutionWidth));
175}
176
177_MTL_INLINE void MTL::ComputePipelineDescriptor::setThreadGroupSizeIsMultipleOfThreadExecutionWidth(bool threadGroupSizeIsMultipleOfThreadExecutionWidth)
178{
179    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadGroupSizeIsMultipleOfThreadExecutionWidth_), threadGroupSizeIsMultipleOfThreadExecutionWidth);
180}
181
182// property: maxTotalThreadsPerThreadgroup
183_MTL_INLINE NS::UInteger MTL::ComputePipelineDescriptor::maxTotalThreadsPerThreadgroup() const
184{
185    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadsPerThreadgroup));
186}
187
188_MTL_INLINE void MTL::ComputePipelineDescriptor::setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup)
189{
190    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxTotalThreadsPerThreadgroup_), maxTotalThreadsPerThreadgroup);
191}
192
193// property: stageInputDescriptor
194_MTL_INLINE MTL::StageInputOutputDescriptor* MTL::ComputePipelineDescriptor::stageInputDescriptor() const
195{
196    return Object::sendMessage<MTL::StageInputOutputDescriptor*>(this, _MTL_PRIVATE_SEL(stageInputDescriptor));
197}
198
199_MTL_INLINE void MTL::ComputePipelineDescriptor::setStageInputDescriptor(const MTL::StageInputOutputDescriptor* stageInputDescriptor)
200{
201    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStageInputDescriptor_), stageInputDescriptor);
202}
203
204// property: buffers
205_MTL_INLINE MTL::PipelineBufferDescriptorArray* MTL::ComputePipelineDescriptor::buffers() const
206{
207    return Object::sendMessage<MTL::PipelineBufferDescriptorArray*>(this, _MTL_PRIVATE_SEL(buffers));
208}
209
210// property: supportIndirectCommandBuffers
211_MTL_INLINE bool MTL::ComputePipelineDescriptor::supportIndirectCommandBuffers() const
212{
213    return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportIndirectCommandBuffers));
214}
215
216_MTL_INLINE void MTL::ComputePipelineDescriptor::setSupportIndirectCommandBuffers(bool supportIndirectCommandBuffers)
217{
218    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportIndirectCommandBuffers_), supportIndirectCommandBuffers);
219}
220
221// property: insertLibraries
222_MTL_INLINE NS::Array* MTL::ComputePipelineDescriptor::insertLibraries() const
223{
224    return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(insertLibraries));
225}
226
227_MTL_INLINE void MTL::ComputePipelineDescriptor::setInsertLibraries(const NS::Array* insertLibraries)
228{
229    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInsertLibraries_), insertLibraries);
230}
231
232// property: preloadedLibraries
233_MTL_INLINE NS::Array* MTL::ComputePipelineDescriptor::preloadedLibraries() const
234{
235    return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(preloadedLibraries));
236}
237
238_MTL_INLINE void MTL::ComputePipelineDescriptor::setPreloadedLibraries(const NS::Array* preloadedLibraries)
239{
240    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPreloadedLibraries_), preloadedLibraries);
241}
242
243// property: binaryArchives
244_MTL_INLINE NS::Array* MTL::ComputePipelineDescriptor::binaryArchives() const
245{
246    return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(binaryArchives));
247}
248
249_MTL_INLINE void MTL::ComputePipelineDescriptor::setBinaryArchives(const NS::Array* binaryArchives)
250{
251    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBinaryArchives_), binaryArchives);
252}
253
254// method: reset
255_MTL_INLINE void MTL::ComputePipelineDescriptor::reset()
256{
257    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
258}
259
260// property: linkedFunctions
261_MTL_INLINE MTL::LinkedFunctions* MTL::ComputePipelineDescriptor::linkedFunctions() const
262{
263    return Object::sendMessage<MTL::LinkedFunctions*>(this, _MTL_PRIVATE_SEL(linkedFunctions));
264}
265
266_MTL_INLINE void MTL::ComputePipelineDescriptor::setLinkedFunctions(const MTL::LinkedFunctions* linkedFunctions)
267{
268    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLinkedFunctions_), linkedFunctions);
269}
270
271// property: supportAddingBinaryFunctions
272_MTL_INLINE bool MTL::ComputePipelineDescriptor::supportAddingBinaryFunctions() const
273{
274    return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportAddingBinaryFunctions));
275}
276
277_MTL_INLINE void MTL::ComputePipelineDescriptor::setSupportAddingBinaryFunctions(bool supportAddingBinaryFunctions)
278{
279    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportAddingBinaryFunctions_), supportAddingBinaryFunctions);
280}
281
282// property: maxCallStackDepth
283_MTL_INLINE NS::UInteger MTL::ComputePipelineDescriptor::maxCallStackDepth() const
284{
285    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxCallStackDepth));
286}
287
288_MTL_INLINE void MTL::ComputePipelineDescriptor::setMaxCallStackDepth(NS::UInteger maxCallStackDepth)
289{
290    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxCallStackDepth_), maxCallStackDepth);
291}
292
293// property: label
294_MTL_INLINE NS::String* MTL::ComputePipelineState::label() const
295{
296    return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
297}
298
299// property: device
300_MTL_INLINE MTL::Device* MTL::ComputePipelineState::device() const
301{
302    return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
303}
304
305// property: maxTotalThreadsPerThreadgroup
306_MTL_INLINE NS::UInteger MTL::ComputePipelineState::maxTotalThreadsPerThreadgroup() const
307{
308    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadsPerThreadgroup));
309}
310
311// property: threadExecutionWidth
312_MTL_INLINE NS::UInteger MTL::ComputePipelineState::threadExecutionWidth() const
313{
314    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadExecutionWidth));
315}
316
317// property: staticThreadgroupMemoryLength
318_MTL_INLINE NS::UInteger MTL::ComputePipelineState::staticThreadgroupMemoryLength() const
319{
320    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(staticThreadgroupMemoryLength));
321}
322
323// method: imageblockMemoryLengthForDimensions:
324_MTL_INLINE NS::UInteger MTL::ComputePipelineState::imageblockMemoryLength(MTL::Size imageblockDimensions)
325{
326    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(imageblockMemoryLengthForDimensions_), imageblockDimensions);
327}
328
329// property: supportIndirectCommandBuffers
330_MTL_INLINE bool MTL::ComputePipelineState::supportIndirectCommandBuffers() const
331{
332    return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportIndirectCommandBuffers));
333}
334
335// method: functionHandleWithFunction:
336_MTL_INLINE MTL::FunctionHandle* MTL::ComputePipelineState::functionHandle(const MTL::Function* function)
337{
338    return Object::sendMessage<MTL::FunctionHandle*>(this, _MTL_PRIVATE_SEL(functionHandleWithFunction_), function);
339}
340
341// method: newComputePipelineStateWithAdditionalBinaryFunctions:error:
342_MTL_INLINE MTL::ComputePipelineState* MTL::ComputePipelineState::newComputePipelineState(const NS::Array* functions, NS::Error** error)
343{
344    return Object::sendMessage<MTL::ComputePipelineState*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithAdditionalBinaryFunctions_error_), functions, error);
345}
346
347// method: newVisibleFunctionTableWithDescriptor:
348_MTL_INLINE MTL::VisibleFunctionTable* MTL::ComputePipelineState::newVisibleFunctionTable(const MTL::VisibleFunctionTableDescriptor* descriptor)
349{
350    return Object::sendMessage<MTL::VisibleFunctionTable*>(this, _MTL_PRIVATE_SEL(newVisibleFunctionTableWithDescriptor_), descriptor);
351}
352
353// method: newIntersectionFunctionTableWithDescriptor:
354_MTL_INLINE MTL::IntersectionFunctionTable* MTL::ComputePipelineState::newIntersectionFunctionTable(const MTL::IntersectionFunctionTableDescriptor* descriptor)
355{
356    return Object::sendMessage<MTL::IntersectionFunctionTable*>(this, _MTL_PRIVATE_SEL(newIntersectionFunctionTableWithDescriptor_), descriptor);
357}