Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/metal-cpp/Metal/MTL4PipelineState.hpp
21345 views
1
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
//
3
// Metal/MTL4PipelineState.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 "MTLPipeline.hpp"
27
#include "MTLPrivate.hpp"
28
29
namespace MTL4
30
{
31
class PipelineDescriptor;
32
class PipelineOptions;
33
_MTL_ENUM(NS::Integer, AlphaToOneState) {
34
AlphaToOneStateDisabled = 0,
35
AlphaToOneStateEnabled = 1,
36
};
37
38
_MTL_ENUM(NS::Integer, AlphaToCoverageState) {
39
AlphaToCoverageStateDisabled = 0,
40
AlphaToCoverageStateEnabled = 1,
41
};
42
43
_MTL_ENUM(NS::Integer, BlendState) {
44
BlendStateDisabled = 0,
45
BlendStateEnabled = 1,
46
BlendStateUnspecialized = 2,
47
};
48
49
_MTL_ENUM(NS::Integer, IndirectCommandBufferSupportState) {
50
IndirectCommandBufferSupportStateDisabled = 0,
51
IndirectCommandBufferSupportStateEnabled = 1,
52
};
53
54
_MTL_OPTIONS(NS::UInteger, ShaderReflection) {
55
ShaderReflectionNone = 0,
56
ShaderReflectionBindingInfo = 1,
57
ShaderReflectionBufferTypeInfo = 1 << 1,
58
};
59
60
class PipelineOptions : public NS::Copying<PipelineOptions>
61
{
62
public:
63
static PipelineOptions* alloc();
64
65
PipelineOptions* init();
66
67
void setShaderReflection(MTL4::ShaderReflection shaderReflection);
68
69
void setShaderValidation(MTL::ShaderValidation shaderValidation);
70
71
ShaderReflection shaderReflection() const;
72
73
MTL::ShaderValidation shaderValidation() const;
74
};
75
class PipelineDescriptor : public NS::Copying<PipelineDescriptor>
76
{
77
public:
78
static PipelineDescriptor* alloc();
79
80
PipelineDescriptor* init();
81
82
NS::String* label() const;
83
84
PipelineOptions* options() const;
85
86
void setLabel(const NS::String* label);
87
88
void setOptions(const MTL4::PipelineOptions* options);
89
};
90
91
}
92
_MTL_INLINE MTL4::PipelineOptions* MTL4::PipelineOptions::alloc()
93
{
94
return NS::Object::alloc<MTL4::PipelineOptions>(_MTL_PRIVATE_CLS(MTL4PipelineOptions));
95
}
96
97
_MTL_INLINE MTL4::PipelineOptions* MTL4::PipelineOptions::init()
98
{
99
return NS::Object::init<MTL4::PipelineOptions>();
100
}
101
102
_MTL_INLINE void MTL4::PipelineOptions::setShaderReflection(MTL4::ShaderReflection shaderReflection)
103
{
104
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setShaderReflection_), shaderReflection);
105
}
106
107
_MTL_INLINE void MTL4::PipelineOptions::setShaderValidation(MTL::ShaderValidation shaderValidation)
108
{
109
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setShaderValidation_), shaderValidation);
110
}
111
112
_MTL_INLINE MTL4::ShaderReflection MTL4::PipelineOptions::shaderReflection() const
113
{
114
return Object::sendMessage<MTL4::ShaderReflection>(this, _MTL_PRIVATE_SEL(shaderReflection));
115
}
116
117
_MTL_INLINE MTL::ShaderValidation MTL4::PipelineOptions::shaderValidation() const
118
{
119
return Object::sendMessage<MTL::ShaderValidation>(this, _MTL_PRIVATE_SEL(shaderValidation));
120
}
121
122
_MTL_INLINE MTL4::PipelineDescriptor* MTL4::PipelineDescriptor::alloc()
123
{
124
return NS::Object::alloc<MTL4::PipelineDescriptor>(_MTL_PRIVATE_CLS(MTL4PipelineDescriptor));
125
}
126
127
_MTL_INLINE MTL4::PipelineDescriptor* MTL4::PipelineDescriptor::init()
128
{
129
return NS::Object::init<MTL4::PipelineDescriptor>();
130
}
131
132
_MTL_INLINE NS::String* MTL4::PipelineDescriptor::label() const
133
{
134
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
135
}
136
137
_MTL_INLINE MTL4::PipelineOptions* MTL4::PipelineDescriptor::options() const
138
{
139
return Object::sendMessage<MTL4::PipelineOptions*>(this, _MTL_PRIVATE_SEL(options));
140
}
141
142
_MTL_INLINE void MTL4::PipelineDescriptor::setLabel(const NS::String* label)
143
{
144
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
145
}
146
147
_MTL_INLINE void MTL4::PipelineDescriptor::setOptions(const MTL4::PipelineOptions* options)
148
{
149
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOptions_), options);
150
}
151
152