Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/metal-cpp/Metal/MTL4Counters.hpp
21155 views
1
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
//
3
// Metal/MTL4Counters.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
#include <cstdint>
28
29
#include <cstdint>
30
31
namespace MTL4
32
{
33
class CounterHeapDescriptor;
34
_MTL_ENUM(NS::Integer, CounterHeapType) {
35
CounterHeapTypeInvalid,
36
CounterHeapTypeTimestamp,
37
};
38
39
_MTL_ENUM(NS::Integer, TimestampGranularity) {
40
TimestampGranularityRelaxed = 0,
41
TimestampGranularityPrecise = 1,
42
};
43
44
struct TimestampHeapEntry
45
{
46
uint64_t timestamp;
47
} _MTL_PACKED;
48
49
class CounterHeapDescriptor : public NS::Copying<CounterHeapDescriptor>
50
{
51
public:
52
static CounterHeapDescriptor* alloc();
53
54
NS::UInteger count() const;
55
56
CounterHeapDescriptor* init();
57
58
void setCount(NS::UInteger count);
59
60
void setType(MTL4::CounterHeapType type);
61
CounterHeapType type() const;
62
};
63
class CounterHeap : public NS::Referencing<CounterHeap>
64
{
65
public:
66
NS::UInteger count() const;
67
void invalidateCounterRange(NS::Range range);
68
69
NS::String* label() const;
70
71
NS::Data* resolveCounterRange(NS::Range range);
72
73
void setLabel(const NS::String* label);
74
75
CounterHeapType type() const;
76
};
77
78
}
79
80
_MTL_INLINE MTL4::CounterHeapDescriptor* MTL4::CounterHeapDescriptor::alloc()
81
{
82
return NS::Object::alloc<MTL4::CounterHeapDescriptor>(_MTL_PRIVATE_CLS(MTL4CounterHeapDescriptor));
83
}
84
85
_MTL_INLINE NS::UInteger MTL4::CounterHeapDescriptor::count() const
86
{
87
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(count));
88
}
89
90
_MTL_INLINE MTL4::CounterHeapDescriptor* MTL4::CounterHeapDescriptor::init()
91
{
92
return NS::Object::init<MTL4::CounterHeapDescriptor>();
93
}
94
95
_MTL_INLINE void MTL4::CounterHeapDescriptor::setCount(NS::UInteger count)
96
{
97
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCount_), count);
98
}
99
100
_MTL_INLINE void MTL4::CounterHeapDescriptor::setType(MTL4::CounterHeapType type)
101
{
102
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setType_), type);
103
}
104
105
_MTL_INLINE MTL4::CounterHeapType MTL4::CounterHeapDescriptor::type() const
106
{
107
return Object::sendMessage<MTL4::CounterHeapType>(this, _MTL_PRIVATE_SEL(type));
108
}
109
110
_MTL_INLINE NS::UInteger MTL4::CounterHeap::count() const
111
{
112
return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(count));
113
}
114
115
_MTL_INLINE void MTL4::CounterHeap::invalidateCounterRange(NS::Range range)
116
{
117
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(invalidateCounterRange_), range);
118
}
119
120
_MTL_INLINE NS::String* MTL4::CounterHeap::label() const
121
{
122
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
123
}
124
125
_MTL_INLINE NS::Data* MTL4::CounterHeap::resolveCounterRange(NS::Range range)
126
{
127
return Object::sendMessage<NS::Data*>(this, _MTL_PRIVATE_SEL(resolveCounterRange_), range);
128
}
129
130
_MTL_INLINE void MTL4::CounterHeap::setLabel(const NS::String* label)
131
{
132
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
133
}
134
135
_MTL_INLINE MTL4::CounterHeapType MTL4::CounterHeap::type() const
136
{
137
return Object::sendMessage<MTL4::CounterHeapType>(this, _MTL_PRIVATE_SEL(type));
138
}
139
140