Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/metal-cpp/Metal/MTLCommandQueue.hpp
21082 views
1
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
//
3
// Metal/MTLCommandQueue.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 CommandBuffer;
31
class CommandBufferDescriptor;
32
class CommandQueueDescriptor;
33
class Device;
34
class LogState;
35
class ResidencySet;
36
37
class CommandQueue : public NS::Referencing<CommandQueue>
38
{
39
public:
40
void addResidencySet(const MTL::ResidencySet* residencySet);
41
void addResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count);
42
43
CommandBuffer* commandBuffer();
44
CommandBuffer* commandBuffer(const MTL::CommandBufferDescriptor* descriptor);
45
CommandBuffer* commandBufferWithUnretainedReferences();
46
47
Device* device() const;
48
49
void insertDebugCaptureBoundary();
50
51
NS::String* label() const;
52
53
void removeResidencySet(const MTL::ResidencySet* residencySet);
54
void removeResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count);
55
56
void setLabel(const NS::String* label);
57
};
58
class CommandQueueDescriptor : public NS::Copying<CommandQueueDescriptor>
59
{
60
public:
61
static CommandQueueDescriptor* alloc();
62
63
CommandQueueDescriptor* init();
64
65
LogState* logState() const;
66
67
NS::UInteger maxCommandBufferCount() const;
68
69
void setLogState(const MTL::LogState* logState);
70
71
void setMaxCommandBufferCount(NS::UInteger maxCommandBufferCount);
72
};
73
74
}
75
_MTL_INLINE void MTL::CommandQueue::addResidencySet(const MTL::ResidencySet* residencySet)
76
{
77
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addResidencySet_), residencySet);
78
}
79
80
_MTL_INLINE void MTL::CommandQueue::addResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count)
81
{
82
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addResidencySets_count_), residencySets, count);
83
}
84
85
_MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBuffer()
86
{
87
return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBuffer));
88
}
89
90
_MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBuffer(const MTL::CommandBufferDescriptor* descriptor)
91
{
92
return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBufferWithDescriptor_), descriptor);
93
}
94
95
_MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBufferWithUnretainedReferences()
96
{
97
return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBufferWithUnretainedReferences));
98
}
99
100
_MTL_INLINE MTL::Device* MTL::CommandQueue::device() const
101
{
102
return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
103
}
104
105
_MTL_INLINE void MTL::CommandQueue::insertDebugCaptureBoundary()
106
{
107
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugCaptureBoundary));
108
}
109
110
_MTL_INLINE NS::String* MTL::CommandQueue::label() const
111
{
112
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
113
}
114
115
_MTL_INLINE void MTL::CommandQueue::removeResidencySet(const MTL::ResidencySet* residencySet)
116
{
117
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeResidencySet_), residencySet);
118
}
119
120
_MTL_INLINE void MTL::CommandQueue::removeResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count)
121
{
122
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeResidencySets_count_), residencySets, count);
123
}
124
125
_MTL_INLINE void MTL::CommandQueue::setLabel(const NS::String* label)
126
{
127
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
128
}
129
130
_MTL_INLINE MTL::CommandQueueDescriptor* MTL::CommandQueueDescriptor::alloc()
131
{
132
return NS::Object::alloc<MTL::CommandQueueDescriptor>(_MTL_PRIVATE_CLS(MTLCommandQueueDescriptor));
133
}
134
135
_MTL_INLINE MTL::CommandQueueDescriptor* MTL::CommandQueueDescriptor::init()
136
{
137
return NS::Object::init<MTL::CommandQueueDescriptor>();
138
}
139
140
_MTL_INLINE MTL::LogState* MTL::CommandQueueDescriptor::logState() const
141
{
142
return Object::sendMessage<MTL::LogState*>(this, _MTL_PRIVATE_SEL(logState));
143
}
144
145
_MTL_INLINE NS::UInteger MTL::CommandQueueDescriptor::maxCommandBufferCount() const
146
{
147
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxCommandBufferCount));
148
}
149
150
_MTL_INLINE void MTL::CommandQueueDescriptor::setLogState(const MTL::LogState* logState)
151
{
152
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLogState_), logState);
153
}
154
155
_MTL_INLINE void MTL::CommandQueueDescriptor::setMaxCommandBufferCount(NS::UInteger maxCommandBufferCount)
156
{
157
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxCommandBufferCount_), maxCommandBufferCount);
158
}
159
160