Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/metal-cpp/QuartzCore/CAMetalLayer.hpp
21059 views
1
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
//
3
// QuartzCore/CAMetalDrawable.hpp
4
//
5
// Copyright 2020-2024 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
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
24
25
#include "../Metal/MTLPixelFormat.hpp"
26
#include "../Metal/MTLTexture.hpp"
27
#include "../Metal/MTLResidencySet.hpp"
28
#include "../Foundation/NSTypes.hpp"
29
#include <CoreGraphics/CGGeometry.h>
30
#include <CoreGraphics/CGColorSpace.h>
31
32
#include "CADefines.hpp"
33
#include "CAMetalDrawable.hpp"
34
#include "CAPrivate.hpp"
35
36
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
37
38
namespace CA
39
{
40
41
class MetalLayer : public NS::Referencing<MetalLayer>
42
{
43
public:
44
static class MetalLayer* layer();
45
46
MTL::Device* device() const;
47
void setDevice(MTL::Device* device);
48
49
MTL::PixelFormat pixelFormat() const;
50
void setPixelFormat(MTL::PixelFormat pixelFormat);
51
52
bool framebufferOnly() const;
53
void setFramebufferOnly(bool framebufferOnly);
54
55
CGSize drawableSize() const;
56
void setDrawableSize(CGSize drawableSize);
57
58
class MetalDrawable* nextDrawable();
59
60
NS::UInteger maximumDrawableCount() const;
61
void setMaximumDrawableCount(NS::UInteger maximumDrawableCount);
62
63
bool displaySyncEnabled() const;
64
void setDisplaySyncEnabled(bool displaySyncEnabled);
65
66
CGColorSpaceRef colorspace() const;
67
void setColorspace(CGColorSpaceRef colorspace);
68
69
bool allowsNextDrawableTimeout() const;
70
void setAllowsNextDrawableTimeout(bool allowsNextDrawableTimeout);
71
72
MTL::ResidencySet* residencySet() const;
73
};
74
} // namespace CA
75
76
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
77
_CA_INLINE CA::MetalLayer* CA::MetalLayer::layer()
78
{
79
return Object::sendMessage<CA::MetalLayer*>(_CA_PRIVATE_CLS(CAMetalLayer), _CA_PRIVATE_SEL(layer));
80
}
81
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
82
83
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
84
85
_CA_INLINE MTL::Device* CA::MetalLayer::device() const
86
{
87
return Object::sendMessage<MTL::Device*>(this, _CA_PRIVATE_SEL(device));
88
}
89
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
90
91
_CA_INLINE void CA::MetalLayer::setDevice(MTL::Device* device)
92
{
93
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setDevice_), device);
94
}
95
96
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
97
98
_CA_INLINE MTL::PixelFormat CA::MetalLayer::pixelFormat() const
99
{
100
return Object::sendMessage<MTL::PixelFormat>(this,
101
_CA_PRIVATE_SEL(pixelFormat));
102
}
103
104
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
105
106
_CA_INLINE void CA::MetalLayer::setPixelFormat(MTL::PixelFormat pixelFormat)
107
{
108
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setPixelFormat_),
109
pixelFormat);
110
}
111
112
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
113
114
_CA_INLINE bool CA::MetalLayer::framebufferOnly() const
115
{
116
return Object::sendMessage<bool>(this, _CA_PRIVATE_SEL(framebufferOnly));
117
}
118
119
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
120
121
_CA_INLINE void CA::MetalLayer::setFramebufferOnly(bool framebufferOnly)
122
{
123
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setFramebufferOnly_),
124
framebufferOnly);
125
}
126
127
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
128
129
_CA_INLINE CGSize CA::MetalLayer::drawableSize() const
130
{
131
return Object::sendMessage<CGSize>(this, _CA_PRIVATE_SEL(drawableSize));
132
}
133
134
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
135
136
_CA_INLINE void CA::MetalLayer::setDrawableSize(CGSize drawableSize)
137
{
138
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setDrawableSize_),
139
drawableSize);
140
}
141
142
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
143
144
_CA_INLINE CA::MetalDrawable* CA::MetalLayer::nextDrawable()
145
{
146
return Object::sendMessage<MetalDrawable*>(this,
147
_CA_PRIVATE_SEL(nextDrawable));
148
}
149
150
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
151
152
_CA_INLINE NS::UInteger CA::MetalLayer::maximumDrawableCount() const
153
{
154
return Object::sendMessage<NS::UInteger>(this,
155
_CA_PRIVATE_SEL(maximumDrawableCount));
156
}
157
158
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
159
160
_CA_INLINE void CA::MetalLayer::setMaximumDrawableCount(NS::UInteger maximumDrawableCount)
161
{
162
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setMaximumDrawableCount_),
163
maximumDrawableCount);
164
}
165
166
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
167
168
_CA_INLINE bool CA::MetalLayer::displaySyncEnabled() const
169
{
170
return Object::sendMessage<bool>(this, _CA_PRIVATE_SEL(displaySyncEnabled));
171
}
172
173
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
174
175
_CA_INLINE void CA::MetalLayer::setDisplaySyncEnabled(bool displaySyncEnabled)
176
{
177
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setDisplaySyncEnabled_),
178
displaySyncEnabled);
179
}
180
181
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
182
183
_CA_INLINE CGColorSpaceRef CA::MetalLayer::colorspace() const
184
{
185
return Object::sendMessage<CGColorSpaceRef>(this, _CA_PRIVATE_SEL(colorspace));
186
}
187
188
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
189
190
_CA_INLINE void CA::MetalLayer::setColorspace(CGColorSpaceRef colorspace)
191
{
192
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setColorspace_),
193
colorspace);
194
}
195
196
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
197
198
_CA_INLINE bool CA::MetalLayer::allowsNextDrawableTimeout() const
199
{
200
return Object::sendMessage<bool>(this, _CA_PRIVATE_SEL(allowsNextDrawableTimeout));
201
}
202
203
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
204
205
_CA_INLINE void CA::MetalLayer::setAllowsNextDrawableTimeout(bool allowsNextDrawableTimeout)
206
{
207
return Object::sendMessage<void>(this, _CA_PRIVATE_SEL(setAllowsNextDrawableTimeout_),
208
allowsNextDrawableTimeout);
209
}
210
211
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
212
213
_CA_INLINE MTL::ResidencySet* CA::MetalLayer::residencySet() const
214
{
215
return Object::sendMessage<MTL::ResidencySet*>(this, _CA_PRIVATE_SEL(residencySet) );
216
}
217
218