yum-mirror/VkFFT

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

Tolmachev DmitriiMetal support in VkFFTba7001c

master
10.3 KiB310 linesraw
1//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2//
3// Metal/MTLSampler.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 "MTLDepthStencil.hpp"
30#include "MTLSampler.hpp"
31
32namespace MTL
33{
34_MTL_ENUM(NS::UInteger, SamplerMinMagFilter) {
35    SamplerMinMagFilterNearest = 0,
36    SamplerMinMagFilterLinear = 1,
37};
38
39_MTL_ENUM(NS::UInteger, SamplerMipFilter) {
40    SamplerMipFilterNotMipmapped = 0,
41    SamplerMipFilterNearest = 1,
42    SamplerMipFilterLinear = 2,
43};
44
45_MTL_ENUM(NS::UInteger, SamplerAddressMode) {
46    SamplerAddressModeClampToEdge = 0,
47    SamplerAddressModeMirrorClampToEdge = 1,
48    SamplerAddressModeRepeat = 2,
49    SamplerAddressModeMirrorRepeat = 3,
50    SamplerAddressModeClampToZero = 4,
51    SamplerAddressModeClampToBorderColor = 5,
52};
53
54_MTL_ENUM(NS::UInteger, SamplerBorderColor) {
55    SamplerBorderColorTransparentBlack = 0,
56    SamplerBorderColorOpaqueBlack = 1,
57    SamplerBorderColorOpaqueWhite = 2,
58};
59
60class SamplerDescriptor : public NS::Copying<SamplerDescriptor>
61{
62public:
63    static class SamplerDescriptor* alloc();
64
65    class SamplerDescriptor*        init();
66
67    MTL::SamplerMinMagFilter        minFilter() const;
68    void                            setMinFilter(MTL::SamplerMinMagFilter minFilter);
69
70    MTL::SamplerMinMagFilter        magFilter() const;
71    void                            setMagFilter(MTL::SamplerMinMagFilter magFilter);
72
73    MTL::SamplerMipFilter           mipFilter() const;
74    void                            setMipFilter(MTL::SamplerMipFilter mipFilter);
75
76    NS::UInteger                    maxAnisotropy() const;
77    void                            setMaxAnisotropy(NS::UInteger maxAnisotropy);
78
79    MTL::SamplerAddressMode         sAddressMode() const;
80    void                            setSAddressMode(MTL::SamplerAddressMode sAddressMode);
81
82    MTL::SamplerAddressMode         tAddressMode() const;
83    void                            setTAddressMode(MTL::SamplerAddressMode tAddressMode);
84
85    MTL::SamplerAddressMode         rAddressMode() const;
86    void                            setRAddressMode(MTL::SamplerAddressMode rAddressMode);
87
88    MTL::SamplerBorderColor         borderColor() const;
89    void                            setBorderColor(MTL::SamplerBorderColor borderColor);
90
91    bool                            normalizedCoordinates() const;
92    void                            setNormalizedCoordinates(bool normalizedCoordinates);
93
94    float                           lodMinClamp() const;
95    void                            setLodMinClamp(float lodMinClamp);
96
97    float                           lodMaxClamp() const;
98    void                            setLodMaxClamp(float lodMaxClamp);
99
100    bool                            lodAverage() const;
101    void                            setLodAverage(bool lodAverage);
102
103    MTL::CompareFunction            compareFunction() const;
104    void                            setCompareFunction(MTL::CompareFunction compareFunction);
105
106    bool                            supportArgumentBuffers() const;
107    void                            setSupportArgumentBuffers(bool supportArgumentBuffers);
108
109    NS::String*                     label() const;
110    void                            setLabel(const NS::String* label);
111};
112
113class SamplerState : public NS::Referencing<SamplerState>
114{
115public:
116    NS::String*   label() const;
117
118    class Device* device() const;
119};
120
121}
122
123// static method: alloc
124_MTL_INLINE MTL::SamplerDescriptor* MTL::SamplerDescriptor::alloc()
125{
126    return NS::Object::alloc<MTL::SamplerDescriptor>(_MTL_PRIVATE_CLS(MTLSamplerDescriptor));
127}
128
129// method: init
130_MTL_INLINE MTL::SamplerDescriptor* MTL::SamplerDescriptor::init()
131{
132    return NS::Object::init<MTL::SamplerDescriptor>();
133}
134
135// property: minFilter
136_MTL_INLINE MTL::SamplerMinMagFilter MTL::SamplerDescriptor::minFilter() const
137{
138    return Object::sendMessage<MTL::SamplerMinMagFilter>(this, _MTL_PRIVATE_SEL(minFilter));
139}
140
141_MTL_INLINE void MTL::SamplerDescriptor::setMinFilter(MTL::SamplerMinMagFilter minFilter)
142{
143    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMinFilter_), minFilter);
144}
145
146// property: magFilter
147_MTL_INLINE MTL::SamplerMinMagFilter MTL::SamplerDescriptor::magFilter() const
148{
149    return Object::sendMessage<MTL::SamplerMinMagFilter>(this, _MTL_PRIVATE_SEL(magFilter));
150}
151
152_MTL_INLINE void MTL::SamplerDescriptor::setMagFilter(MTL::SamplerMinMagFilter magFilter)
153{
154    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMagFilter_), magFilter);
155}
156
157// property: mipFilter
158_MTL_INLINE MTL::SamplerMipFilter MTL::SamplerDescriptor::mipFilter() const
159{
160    return Object::sendMessage<MTL::SamplerMipFilter>(this, _MTL_PRIVATE_SEL(mipFilter));
161}
162
163_MTL_INLINE void MTL::SamplerDescriptor::setMipFilter(MTL::SamplerMipFilter mipFilter)
164{
165    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMipFilter_), mipFilter);
166}
167
168// property: maxAnisotropy
169_MTL_INLINE NS::UInteger MTL::SamplerDescriptor::maxAnisotropy() const
170{
171    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxAnisotropy));
172}
173
174_MTL_INLINE void MTL::SamplerDescriptor::setMaxAnisotropy(NS::UInteger maxAnisotropy)
175{
176    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxAnisotropy_), maxAnisotropy);
177}
178
179// property: sAddressMode
180_MTL_INLINE MTL::SamplerAddressMode MTL::SamplerDescriptor::sAddressMode() const
181{
182    return Object::sendMessage<MTL::SamplerAddressMode>(this, _MTL_PRIVATE_SEL(sAddressMode));
183}
184
185_MTL_INLINE void MTL::SamplerDescriptor::setSAddressMode(MTL::SamplerAddressMode sAddressMode)
186{
187    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSAddressMode_), sAddressMode);
188}
189
190// property: tAddressMode
191_MTL_INLINE MTL::SamplerAddressMode MTL::SamplerDescriptor::tAddressMode() const
192{
193    return Object::sendMessage<MTL::SamplerAddressMode>(this, _MTL_PRIVATE_SEL(tAddressMode));
194}
195
196_MTL_INLINE void MTL::SamplerDescriptor::setTAddressMode(MTL::SamplerAddressMode tAddressMode)
197{
198    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTAddressMode_), tAddressMode);
199}
200
201// property: rAddressMode
202_MTL_INLINE MTL::SamplerAddressMode MTL::SamplerDescriptor::rAddressMode() const
203{
204    return Object::sendMessage<MTL::SamplerAddressMode>(this, _MTL_PRIVATE_SEL(rAddressMode));
205}
206
207_MTL_INLINE void MTL::SamplerDescriptor::setRAddressMode(MTL::SamplerAddressMode rAddressMode)
208{
209    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRAddressMode_), rAddressMode);
210}
211
212// property: borderColor
213_MTL_INLINE MTL::SamplerBorderColor MTL::SamplerDescriptor::borderColor() const
214{
215    return Object::sendMessage<MTL::SamplerBorderColor>(this, _MTL_PRIVATE_SEL(borderColor));
216}
217
218_MTL_INLINE void MTL::SamplerDescriptor::setBorderColor(MTL::SamplerBorderColor borderColor)
219{
220    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBorderColor_), borderColor);
221}
222
223// property: normalizedCoordinates
224_MTL_INLINE bool MTL::SamplerDescriptor::normalizedCoordinates() const
225{
226    return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(normalizedCoordinates));
227}
228
229_MTL_INLINE void MTL::SamplerDescriptor::setNormalizedCoordinates(bool normalizedCoordinates)
230{
231    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setNormalizedCoordinates_), normalizedCoordinates);
232}
233
234// property: lodMinClamp
235_MTL_INLINE float MTL::SamplerDescriptor::lodMinClamp() const
236{
237    return Object::sendMessage<float>(this, _MTL_PRIVATE_SEL(lodMinClamp));
238}
239
240_MTL_INLINE void MTL::SamplerDescriptor::setLodMinClamp(float lodMinClamp)
241{
242    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLodMinClamp_), lodMinClamp);
243}
244
245// property: lodMaxClamp
246_MTL_INLINE float MTL::SamplerDescriptor::lodMaxClamp() const
247{
248    return Object::sendMessage<float>(this, _MTL_PRIVATE_SEL(lodMaxClamp));
249}
250
251_MTL_INLINE void MTL::SamplerDescriptor::setLodMaxClamp(float lodMaxClamp)
252{
253    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLodMaxClamp_), lodMaxClamp);
254}
255
256// property: lodAverage
257_MTL_INLINE bool MTL::SamplerDescriptor::lodAverage() const
258{
259    return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(lodAverage));
260}
261
262_MTL_INLINE void MTL::SamplerDescriptor::setLodAverage(bool lodAverage)
263{
264    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLodAverage_), lodAverage);
265}
266
267// property: compareFunction
268_MTL_INLINE MTL::CompareFunction MTL::SamplerDescriptor::compareFunction() const
269{
270    return Object::sendMessage<MTL::CompareFunction>(this, _MTL_PRIVATE_SEL(compareFunction));
271}
272
273_MTL_INLINE void MTL::SamplerDescriptor::setCompareFunction(MTL::CompareFunction compareFunction)
274{
275    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCompareFunction_), compareFunction);
276}
277
278// property: supportArgumentBuffers
279_MTL_INLINE bool MTL::SamplerDescriptor::supportArgumentBuffers() const
280{
281    return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportArgumentBuffers));
282}
283
284_MTL_INLINE void MTL::SamplerDescriptor::setSupportArgumentBuffers(bool supportArgumentBuffers)
285{
286    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportArgumentBuffers_), supportArgumentBuffers);
287}
288
289// property: label
290_MTL_INLINE NS::String* MTL::SamplerDescriptor::label() const
291{
292    return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
293}
294
295_MTL_INLINE void MTL::SamplerDescriptor::setLabel(const NS::String* label)
296{
297    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
298}
299
300// property: label
301_MTL_INLINE NS::String* MTL::SamplerState::label() const
302{
303    return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
304}
305
306// property: device
307_MTL_INLINE MTL::Device* MTL::SamplerState::device() const
308{
309    return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
310}