Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/metal-cpp/Metal/MTLCommandEncoder.hpp
21066 views
1
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
//
3
// Metal/MTLCommandEncoder.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 "MTLHeaderBridge.hpp"
26
#include "MTLPrivate.hpp"
27
28
namespace MTL
29
{
30
class Device;
31
32
_MTL_OPTIONS(NS::UInteger, ResourceUsage) {
33
ResourceUsageRead = 1,
34
ResourceUsageWrite = 1 << 1,
35
ResourceUsageSample = 1 << 2,
36
};
37
38
_MTL_OPTIONS(NS::UInteger, BarrierScope) {
39
BarrierScopeBuffers = 1,
40
BarrierScopeTextures = 1 << 1,
41
BarrierScopeRenderTargets = 1 << 2,
42
};
43
44
_MTL_OPTIONS(NS::UInteger, Stages) {
45
StageVertex = 1,
46
StageFragment = 1 << 1,
47
StageTile = 1 << 2,
48
StageObject = 1 << 3,
49
StageMesh = 1 << 4,
50
StageResourceState = 1 << 26,
51
StageDispatch = 1 << 27,
52
StageBlit = 1 << 28,
53
StageAccelerationStructure = 1 << 29,
54
StageMachineLearning = 1 << 30,
55
StageAll = 9223372036854775807,
56
};
57
58
class CommandEncoder : public NS::Referencing<CommandEncoder>
59
{
60
public:
61
void barrierAfterQueueStages(MTL::Stages afterQueueStages, MTL::Stages beforeStages);
62
63
Device* device() const;
64
65
void endEncoding();
66
67
void insertDebugSignpost(const NS::String* string);
68
69
NS::String* label() const;
70
71
void popDebugGroup();
72
73
void pushDebugGroup(const NS::String* string);
74
75
void setLabel(const NS::String* label);
76
};
77
78
}
79
_MTL_INLINE void MTL::CommandEncoder::barrierAfterQueueStages(MTL::Stages afterQueueStages, MTL::Stages beforeStages)
80
{
81
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(barrierAfterQueueStages_beforeStages_), afterQueueStages, beforeStages);
82
}
83
84
_MTL_INLINE MTL::Device* MTL::CommandEncoder::device() const
85
{
86
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
87
}
88
89
_MTL_INLINE void MTL::CommandEncoder::endEncoding()
90
{
91
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(endEncoding));
92
}
93
94
_MTL_INLINE void MTL::CommandEncoder::insertDebugSignpost(const NS::String* string)
95
{
96
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugSignpost_), string);
97
}
98
99
_MTL_INLINE NS::String* MTL::CommandEncoder::label() const
100
{
101
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
102
}
103
104
_MTL_INLINE void MTL::CommandEncoder::popDebugGroup()
105
{
106
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));
107
}
108
109
_MTL_INLINE void MTL::CommandEncoder::pushDebugGroup(const NS::String* string)
110
{
111
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);
112
}
113
114
_MTL_INLINE void MTL::CommandEncoder::setLabel(const NS::String* label)
115
{
116
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
117
}
118
119