yum-mirror/VkFFT

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

Tolmachev DmitriiMetal support in VkFFTba7001c

master
9.0 KiB282 linesraw
1//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2//
3// Metal/MTLHeap.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 "MTLHeap.hpp"
30#include "MTLResource.hpp"
31
32namespace MTL
33{
34_MTL_ENUM(NS::Integer, HeapType) {
35    HeapTypeAutomatic = 0,
36    HeapTypePlacement = 1,
37    HeapTypeSparse = 2,
38};
39
40class HeapDescriptor : public NS::Copying<HeapDescriptor>
41{
42public:
43    static class HeapDescriptor* alloc();
44
45    class HeapDescriptor*        init();
46
47    NS::UInteger                 size() const;
48    void                         setSize(NS::UInteger size);
49
50    MTL::StorageMode             storageMode() const;
51    void                         setStorageMode(MTL::StorageMode storageMode);
52
53    MTL::CPUCacheMode            cpuCacheMode() const;
54    void                         setCpuCacheMode(MTL::CPUCacheMode cpuCacheMode);
55
56    MTL::HazardTrackingMode      hazardTrackingMode() const;
57    void                         setHazardTrackingMode(MTL::HazardTrackingMode hazardTrackingMode);
58
59    MTL::ResourceOptions         resourceOptions() const;
60    void                         setResourceOptions(MTL::ResourceOptions resourceOptions);
61
62    MTL::HeapType                type() const;
63    void                         setType(MTL::HeapType type);
64};
65
66class Heap : public NS::Referencing<Heap>
67{
68public:
69    NS::String*             label() const;
70    void                    setLabel(const NS::String* label);
71
72    class Device*           device() const;
73
74    MTL::StorageMode        storageMode() const;
75
76    MTL::CPUCacheMode       cpuCacheMode() const;
77
78    MTL::HazardTrackingMode hazardTrackingMode() const;
79
80    MTL::ResourceOptions    resourceOptions() const;
81
82    NS::UInteger            size() const;
83
84    NS::UInteger            usedSize() const;
85
86    NS::UInteger            currentAllocatedSize() const;
87
88    NS::UInteger            maxAvailableSize(NS::UInteger alignment);
89
90    class Buffer*           newBuffer(NS::UInteger length, MTL::ResourceOptions options);
91
92    class Texture*          newTexture(const class TextureDescriptor* desc);
93
94    MTL::PurgeableState     setPurgeableState(MTL::PurgeableState state);
95
96    MTL::HeapType           type() const;
97
98    class Buffer*           newBuffer(NS::UInteger length, MTL::ResourceOptions options, NS::UInteger offset);
99
100    class Texture*          newTexture(const class TextureDescriptor* descriptor, NS::UInteger offset);
101};
102
103}
104
105// static method: alloc
106_MTL_INLINE MTL::HeapDescriptor* MTL::HeapDescriptor::alloc()
107{
108    return NS::Object::alloc<MTL::HeapDescriptor>(_MTL_PRIVATE_CLS(MTLHeapDescriptor));
109}
110
111// method: init
112_MTL_INLINE MTL::HeapDescriptor* MTL::HeapDescriptor::init()
113{
114    return NS::Object::init<MTL::HeapDescriptor>();
115}
116
117// property: size
118_MTL_INLINE NS::UInteger MTL::HeapDescriptor::size() const
119{
120    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(size));
121}
122
123_MTL_INLINE void MTL::HeapDescriptor::setSize(NS::UInteger size)
124{
125    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSize_), size);
126}
127
128// property: storageMode
129_MTL_INLINE MTL::StorageMode MTL::HeapDescriptor::storageMode() const
130{
131    return Object::sendMessage<MTL::StorageMode>(this, _MTL_PRIVATE_SEL(storageMode));
132}
133
134_MTL_INLINE void MTL::HeapDescriptor::setStorageMode(MTL::StorageMode storageMode)
135{
136    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStorageMode_), storageMode);
137}
138
139// property: cpuCacheMode
140_MTL_INLINE MTL::CPUCacheMode MTL::HeapDescriptor::cpuCacheMode() const
141{
142    return Object::sendMessage<MTL::CPUCacheMode>(this, _MTL_PRIVATE_SEL(cpuCacheMode));
143}
144
145_MTL_INLINE void MTL::HeapDescriptor::setCpuCacheMode(MTL::CPUCacheMode cpuCacheMode)
146{
147    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCpuCacheMode_), cpuCacheMode);
148}
149
150// property: hazardTrackingMode
151_MTL_INLINE MTL::HazardTrackingMode MTL::HeapDescriptor::hazardTrackingMode() const
152{
153    return Object::sendMessage<MTL::HazardTrackingMode>(this, _MTL_PRIVATE_SEL(hazardTrackingMode));
154}
155
156_MTL_INLINE void MTL::HeapDescriptor::setHazardTrackingMode(MTL::HazardTrackingMode hazardTrackingMode)
157{
158    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setHazardTrackingMode_), hazardTrackingMode);
159}
160
161// property: resourceOptions
162_MTL_INLINE MTL::ResourceOptions MTL::HeapDescriptor::resourceOptions() const
163{
164    return Object::sendMessage<MTL::ResourceOptions>(this, _MTL_PRIVATE_SEL(resourceOptions));
165}
166
167_MTL_INLINE void MTL::HeapDescriptor::setResourceOptions(MTL::ResourceOptions resourceOptions)
168{
169    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setResourceOptions_), resourceOptions);
170}
171
172// property: type
173_MTL_INLINE MTL::HeapType MTL::HeapDescriptor::type() const
174{
175    return Object::sendMessage<MTL::HeapType>(this, _MTL_PRIVATE_SEL(type));
176}
177
178_MTL_INLINE void MTL::HeapDescriptor::setType(MTL::HeapType type)
179{
180    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setType_), type);
181}
182
183// property: label
184_MTL_INLINE NS::String* MTL::Heap::label() const
185{
186    return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
187}
188
189_MTL_INLINE void MTL::Heap::setLabel(const NS::String* label)
190{
191    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
192}
193
194// property: device
195_MTL_INLINE MTL::Device* MTL::Heap::device() const
196{
197    return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
198}
199
200// property: storageMode
201_MTL_INLINE MTL::StorageMode MTL::Heap::storageMode() const
202{
203    return Object::sendMessage<MTL::StorageMode>(this, _MTL_PRIVATE_SEL(storageMode));
204}
205
206// property: cpuCacheMode
207_MTL_INLINE MTL::CPUCacheMode MTL::Heap::cpuCacheMode() const
208{
209    return Object::sendMessage<MTL::CPUCacheMode>(this, _MTL_PRIVATE_SEL(cpuCacheMode));
210}
211
212// property: hazardTrackingMode
213_MTL_INLINE MTL::HazardTrackingMode MTL::Heap::hazardTrackingMode() const
214{
215    return Object::sendMessage<MTL::HazardTrackingMode>(this, _MTL_PRIVATE_SEL(hazardTrackingMode));
216}
217
218// property: resourceOptions
219_MTL_INLINE MTL::ResourceOptions MTL::Heap::resourceOptions() const
220{
221    return Object::sendMessage<MTL::ResourceOptions>(this, _MTL_PRIVATE_SEL(resourceOptions));
222}
223
224// property: size
225_MTL_INLINE NS::UInteger MTL::Heap::size() const
226{
227    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(size));
228}
229
230// property: usedSize
231_MTL_INLINE NS::UInteger MTL::Heap::usedSize() const
232{
233    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(usedSize));
234}
235
236// property: currentAllocatedSize
237_MTL_INLINE NS::UInteger MTL::Heap::currentAllocatedSize() const
238{
239    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(currentAllocatedSize));
240}
241
242// method: maxAvailableSizeWithAlignment:
243_MTL_INLINE NS::UInteger MTL::Heap::maxAvailableSize(NS::UInteger alignment)
244{
245    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxAvailableSizeWithAlignment_), alignment);
246}
247
248// method: newBufferWithLength:options:
249_MTL_INLINE MTL::Buffer* MTL::Heap::newBuffer(NS::UInteger length, MTL::ResourceOptions options)
250{
251    return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithLength_options_), length, options);
252}
253
254// method: newTextureWithDescriptor:
255_MTL_INLINE MTL::Texture* MTL::Heap::newTexture(const MTL::TextureDescriptor* desc)
256{
257    return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newTextureWithDescriptor_), desc);
258}
259
260// method: setPurgeableState:
261_MTL_INLINE MTL::PurgeableState MTL::Heap::setPurgeableState(MTL::PurgeableState state)
262{
263    return Object::sendMessage<MTL::PurgeableState>(this, _MTL_PRIVATE_SEL(setPurgeableState_), state);
264}
265
266// property: type
267_MTL_INLINE MTL::HeapType MTL::Heap::type() const
268{
269    return Object::sendMessage<MTL::HeapType>(this, _MTL_PRIVATE_SEL(type));
270}
271
272// method: newBufferWithLength:options:offset:
273_MTL_INLINE MTL::Buffer* MTL::Heap::newBuffer(NS::UInteger length, MTL::ResourceOptions options, NS::UInteger offset)
274{
275    return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithLength_options_offset_), length, options, offset);
276}
277
278// method: newTextureWithDescriptor:offset:
279_MTL_INLINE MTL::Texture* MTL::Heap::newTexture(const MTL::TextureDescriptor* descriptor, NS::UInteger offset)
280{
281    return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newTextureWithDescriptor_offset_), descriptor, offset);
282}