yum-mirror/VkFFT

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

Tolmachev DmitriiMetal support in VkFFTba7001c

develop
5.1 KiB178 linesraw
1//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2//
3// Metal/MTLResource.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 "MTLResource.hpp"
30
31namespace MTL
32{
33_MTL_ENUM(NS::UInteger, PurgeableState) {
34    PurgeableStateKeepCurrent = 1,
35    PurgeableStateNonVolatile = 2,
36    PurgeableStateVolatile = 3,
37    PurgeableStateEmpty = 4,
38};
39
40_MTL_ENUM(NS::UInteger, CPUCacheMode) {
41    CPUCacheModeDefaultCache = 0,
42    CPUCacheModeWriteCombined = 1,
43};
44
45_MTL_ENUM(NS::UInteger, StorageMode) {
46    StorageModeShared = 0,
47    StorageModeManaged = 1,
48    StorageModePrivate = 2,
49    StorageModeMemoryless = 3,
50};
51
52_MTL_ENUM(NS::UInteger, HazardTrackingMode) {
53    HazardTrackingModeDefault = 0,
54    HazardTrackingModeUntracked = 1,
55    HazardTrackingModeTracked = 2,
56};
57
58_MTL_OPTIONS(NS::UInteger, ResourceOptions) {
59    ResourceStorageModeShared = 0,
60    ResourceHazardTrackingModeDefault = 0,
61    ResourceCPUCacheModeDefaultCache = 0,
62    ResourceOptionCPUCacheModeDefault = 0,
63    ResourceCPUCacheModeWriteCombined = 1,
64    ResourceOptionCPUCacheModeWriteCombined = 1,
65    ResourceStorageModeManaged = 16,
66    ResourceStorageModePrivate = 32,
67    ResourceStorageModeMemoryless = 48,
68    ResourceHazardTrackingModeUntracked = 256,
69    ResourceHazardTrackingModeTracked = 512,
70};
71
72class Resource : public NS::Referencing<Resource>
73{
74public:
75    NS::String*             label() const;
76    void                    setLabel(const NS::String* label);
77
78    class Device*           device() const;
79
80    MTL::CPUCacheMode       cpuCacheMode() const;
81
82    MTL::StorageMode        storageMode() const;
83
84    MTL::HazardTrackingMode hazardTrackingMode() const;
85
86    MTL::ResourceOptions    resourceOptions() const;
87
88    MTL::PurgeableState     setPurgeableState(MTL::PurgeableState state);
89
90    class Heap*             heap() const;
91
92    NS::UInteger            heapOffset() const;
93
94    NS::UInteger            allocatedSize() const;
95
96    void                    makeAliasable();
97
98    bool                    isAliasable();
99};
100
101}
102
103// property: label
104_MTL_INLINE NS::String* MTL::Resource::label() const
105{
106    return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
107}
108
109_MTL_INLINE void MTL::Resource::setLabel(const NS::String* label)
110{
111    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
112}
113
114// property: device
115_MTL_INLINE MTL::Device* MTL::Resource::device() const
116{
117    return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
118}
119
120// property: cpuCacheMode
121_MTL_INLINE MTL::CPUCacheMode MTL::Resource::cpuCacheMode() const
122{
123    return Object::sendMessage<MTL::CPUCacheMode>(this, _MTL_PRIVATE_SEL(cpuCacheMode));
124}
125
126// property: storageMode
127_MTL_INLINE MTL::StorageMode MTL::Resource::storageMode() const
128{
129    return Object::sendMessage<MTL::StorageMode>(this, _MTL_PRIVATE_SEL(storageMode));
130}
131
132// property: hazardTrackingMode
133_MTL_INLINE MTL::HazardTrackingMode MTL::Resource::hazardTrackingMode() const
134{
135    return Object::sendMessage<MTL::HazardTrackingMode>(this, _MTL_PRIVATE_SEL(hazardTrackingMode));
136}
137
138// property: resourceOptions
139_MTL_INLINE MTL::ResourceOptions MTL::Resource::resourceOptions() const
140{
141    return Object::sendMessage<MTL::ResourceOptions>(this, _MTL_PRIVATE_SEL(resourceOptions));
142}
143
144// method: setPurgeableState:
145_MTL_INLINE MTL::PurgeableState MTL::Resource::setPurgeableState(MTL::PurgeableState state)
146{
147    return Object::sendMessage<MTL::PurgeableState>(this, _MTL_PRIVATE_SEL(setPurgeableState_), state);
148}
149
150// property: heap
151_MTL_INLINE MTL::Heap* MTL::Resource::heap() const
152{
153    return Object::sendMessage<MTL::Heap*>(this, _MTL_PRIVATE_SEL(heap));
154}
155
156// property: heapOffset
157_MTL_INLINE NS::UInteger MTL::Resource::heapOffset() const
158{
159    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(heapOffset));
160}
161
162// property: allocatedSize
163_MTL_INLINE NS::UInteger MTL::Resource::allocatedSize() const
164{
165    return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(allocatedSize));
166}
167
168// method: makeAliasable
169_MTL_INLINE void MTL::Resource::makeAliasable()
170{
171    Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(makeAliasable));
172}
173
174// method: isAliasable
175_MTL_INLINE bool MTL::Resource::isAliasable()
176{
177    return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isAliasable));
178}