Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/metal-cpp/Metal/MTL4ArgumentTable.hpp
21117 views
1
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
//
3
// Metal/MTL4ArgumentTable.hpp
4
//
5
// Copyright 2020-2025 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 "../Foundation/Foundation.hpp"
24
#include "MTLDefines.hpp"
25
#include "MTLGPUAddress.hpp"
26
#include "MTLHeaderBridge.hpp"
27
#include "MTLPrivate.hpp"
28
#include "MTLTypes.hpp"
29
30
namespace MTL
31
{
32
class Device;
33
}
34
35
namespace MTL4
36
{
37
class ArgumentTableDescriptor : public NS::Copying<ArgumentTableDescriptor>
38
{
39
public:
40
static ArgumentTableDescriptor* alloc();
41
42
ArgumentTableDescriptor* init();
43
bool initializeBindings() const;
44
45
NS::String* label() const;
46
47
NS::UInteger maxBufferBindCount() const;
48
49
NS::UInteger maxSamplerStateBindCount() const;
50
51
NS::UInteger maxTextureBindCount() const;
52
53
void setInitializeBindings(bool initializeBindings);
54
55
void setLabel(const NS::String* label);
56
57
void setMaxBufferBindCount(NS::UInteger maxBufferBindCount);
58
59
void setMaxSamplerStateBindCount(NS::UInteger maxSamplerStateBindCount);
60
61
void setMaxTextureBindCount(NS::UInteger maxTextureBindCount);
62
63
void setSupportAttributeStrides(bool supportAttributeStrides);
64
bool supportAttributeStrides() const;
65
};
66
class ArgumentTable : public NS::Referencing<ArgumentTable>
67
{
68
public:
69
MTL::Device* device() const;
70
71
NS::String* label() const;
72
73
void setAddress(MTL::GPUAddress gpuAddress, NS::UInteger bindingIndex);
74
void setAddress(MTL::GPUAddress gpuAddress, NS::UInteger stride, NS::UInteger bindingIndex);
75
76
void setResource(MTL::ResourceID resourceID, NS::UInteger bindingIndex);
77
78
void setSamplerState(MTL::ResourceID resourceID, NS::UInteger bindingIndex);
79
80
void setTexture(MTL::ResourceID resourceID, NS::UInteger bindingIndex);
81
};
82
83
}
84
_MTL_INLINE MTL4::ArgumentTableDescriptor* MTL4::ArgumentTableDescriptor::alloc()
85
{
86
return NS::Object::alloc<MTL4::ArgumentTableDescriptor>(_MTL_PRIVATE_CLS(MTL4ArgumentTableDescriptor));
87
}
88
89
_MTL_INLINE MTL4::ArgumentTableDescriptor* MTL4::ArgumentTableDescriptor::init()
90
{
91
return NS::Object::init<MTL4::ArgumentTableDescriptor>();
92
}
93
94
_MTL_INLINE bool MTL4::ArgumentTableDescriptor::initializeBindings() const
95
{
96
return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(initializeBindings));
97
}
98
99
_MTL_INLINE NS::String* MTL4::ArgumentTableDescriptor::label() const
100
{
101
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
102
}
103
104
_MTL_INLINE NS::UInteger MTL4::ArgumentTableDescriptor::maxBufferBindCount() const
105
{
106
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxBufferBindCount));
107
}
108
109
_MTL_INLINE NS::UInteger MTL4::ArgumentTableDescriptor::maxSamplerStateBindCount() const
110
{
111
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxSamplerStateBindCount));
112
}
113
114
_MTL_INLINE NS::UInteger MTL4::ArgumentTableDescriptor::maxTextureBindCount() const
115
{
116
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTextureBindCount));
117
}
118
119
_MTL_INLINE void MTL4::ArgumentTableDescriptor::setInitializeBindings(bool initializeBindings)
120
{
121
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInitializeBindings_), initializeBindings);
122
}
123
124
_MTL_INLINE void MTL4::ArgumentTableDescriptor::setLabel(const NS::String* label)
125
{
126
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
127
}
128
129
_MTL_INLINE void MTL4::ArgumentTableDescriptor::setMaxBufferBindCount(NS::UInteger maxBufferBindCount)
130
{
131
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxBufferBindCount_), maxBufferBindCount);
132
}
133
134
_MTL_INLINE void MTL4::ArgumentTableDescriptor::setMaxSamplerStateBindCount(NS::UInteger maxSamplerStateBindCount)
135
{
136
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxSamplerStateBindCount_), maxSamplerStateBindCount);
137
}
138
139
_MTL_INLINE void MTL4::ArgumentTableDescriptor::setMaxTextureBindCount(NS::UInteger maxTextureBindCount)
140
{
141
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxTextureBindCount_), maxTextureBindCount);
142
}
143
144
_MTL_INLINE void MTL4::ArgumentTableDescriptor::setSupportAttributeStrides(bool supportAttributeStrides)
145
{
146
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportAttributeStrides_), supportAttributeStrides);
147
}
148
149
_MTL_INLINE bool MTL4::ArgumentTableDescriptor::supportAttributeStrides() const
150
{
151
return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportAttributeStrides));
152
}
153
154
_MTL_INLINE MTL::Device* MTL4::ArgumentTable::device() const
155
{
156
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
157
}
158
159
_MTL_INLINE NS::String* MTL4::ArgumentTable::label() const
160
{
161
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
162
}
163
164
_MTL_INLINE void MTL4::ArgumentTable::setAddress(MTL::GPUAddress gpuAddress, NS::UInteger bindingIndex)
165
{
166
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAddress_atIndex_), gpuAddress, bindingIndex);
167
}
168
169
_MTL_INLINE void MTL4::ArgumentTable::setAddress(MTL::GPUAddress gpuAddress, NS::UInteger stride, NS::UInteger bindingIndex)
170
{
171
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAddress_attributeStride_atIndex_), gpuAddress, stride, bindingIndex);
172
}
173
174
_MTL_INLINE void MTL4::ArgumentTable::setResource(MTL::ResourceID resourceID, NS::UInteger bindingIndex)
175
{
176
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setResource_atBufferIndex_), resourceID, bindingIndex);
177
}
178
179
_MTL_INLINE void MTL4::ArgumentTable::setSamplerState(MTL::ResourceID resourceID, NS::UInteger bindingIndex)
180
{
181
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerState_atIndex_), resourceID, bindingIndex);
182
}
183
184
_MTL_INLINE void MTL4::ArgumentTable::setTexture(MTL::ResourceID resourceID, NS::UInteger bindingIndex)
185
{
186
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTexture_atIndex_), resourceID, bindingIndex);
187
}
188
189