| Flutter Impeller |

formats_mtl.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #pragma once
6
7 #include <Metal/Metal.h>
8
9 #include <optional>
10
11 #include "flutter/fml/macros.h"
12 #include "impeller/base/validation.h"
13 #include "impeller/core/formats.h"
14 #include "impeller/core/texture_descriptor.h"
15 #include "impeller/geometry/color.h"
16
17 namespace impeller {
18
19 class RenderTarget;
20
21 constexpr PixelFormat FromMTLPixelFormat(MTLPixelFormat format) {
22 switch (format) {
23 case MTLPixelFormatInvalid:
24 return PixelFormat::kUnknown;
25 case MTLPixelFormatBGRA8Unorm:
26 return PixelFormat::kB8G8R8A8UNormInt;
27 case MTLPixelFormatBGRA8Unorm_sRGB:
28 return PixelFormat::kB8G8R8A8UNormIntSRGB;
29 case MTLPixelFormatRGBA8Unorm:
30 return PixelFormat::kR8G8B8A8UNormInt;
31 case MTLPixelFormatRGBA8Unorm_sRGB:
32 return PixelFormat::kR8G8B8A8UNormIntSRGB;
33 case MTLPixelFormatRGBA32Float:
34 return PixelFormat::kR32G32B32A32Float;
35 case MTLPixelFormatRGBA16Float:
36 return PixelFormat::kR16G16B16A16Float;
37 case MTLPixelFormatStencil8:
38 return PixelFormat::kS8UInt;
39 #if !FML_OS_IOS
40 case MTLPixelFormatDepth24Unorm_Stencil8:
41 return PixelFormat::kD24UnormS8Uint;
42 #endif // FML_OS_IOS
43 case MTLPixelFormatDepth32Float_Stencil8:
44 return PixelFormat::kD32FloatS8UInt;
45 case MTLPixelFormatBGR10_XR_sRGB:
46 return PixelFormat::kB10G10R10XRSRGB;
47 case MTLPixelFormatBGR10_XR:
48 return PixelFormat::kB10G10R10XR;
49 case MTLPixelFormatBGRA10_XR:
50 return PixelFormat::kB10G10R10A10XR;
51 default:
52 return PixelFormat::kUnknown;
53 }
54 return PixelFormat::kUnknown;
55 }
56
57 /// Safe accessor for MTLPixelFormatDepth24Unorm_Stencil8.
58 /// Returns PixelFormat::kUnknown if MTLPixelFormatDepth24Unorm_Stencil8 isn't
59 /// supported.
60 MTLPixelFormat SafeMTLPixelFormatDepth24Unorm_Stencil8();
61
62 /// Safe accessor for MTLPixelFormatBGR10_XR_sRGB.
63 /// Returns PixelFormat::kUnknown if MTLPixelFormatBGR10_XR_sRGB isn't
64 /// supported.
65 MTLPixelFormat SafeMTLPixelFormatBGR10_XR_sRGB();
66
67 /// Safe accessor for MTLPixelFormatBGR10_XR.
68 /// Returns PixelFormat::kUnknown if MTLPixelFormatBGR10_XR isn't supported.
69 MTLPixelFormat SafeMTLPixelFormatBGR10_XR();
70
71 /// Safe accessor for MTLPixelFormatBGRA10_XR.
72 /// Returns PixelFormat::kUnknown if MTLPixelFormatBGR10_XR isn't supported.
73 MTLPixelFormat SafeMTLPixelFormatBGRA10_XR();
74
75 constexpr MTLPixelFormat ToMTLPixelFormat(PixelFormat format) {
76 switch (format) {
77 case PixelFormat::kUnknown:
78 return MTLPixelFormatInvalid;
79 case PixelFormat::kA8UNormInt:
80 return MTLPixelFormatA8Unorm;
81 case PixelFormat::kR8UNormInt:
82 return MTLPixelFormatR8Unorm;
83 case PixelFormat::kR8G8UNormInt:
84 return MTLPixelFormatRG8Unorm;
85 case PixelFormat::kB8G8R8A8UNormInt:
86 return MTLPixelFormatBGRA8Unorm;
87 case PixelFormat::kB8G8R8A8UNormIntSRGB:
88 return MTLPixelFormatBGRA8Unorm_sRGB;
89 case PixelFormat::kR8G8B8A8UNormInt:
90 return MTLPixelFormatRGBA8Unorm;
91 case PixelFormat::kR8G8B8A8UNormIntSRGB:
92 return MTLPixelFormatRGBA8Unorm_sRGB;
93 case PixelFormat::kR32G32B32A32Float:
94 return MTLPixelFormatRGBA32Float;
95 case PixelFormat::kR16G16B16A16Float:
96 return MTLPixelFormatRGBA16Float;
97 case PixelFormat::kS8UInt:
98 return MTLPixelFormatStencil8;
99 case PixelFormat::kD24UnormS8Uint:
100 return SafeMTLPixelFormatDepth24Unorm_Stencil8();
101 case PixelFormat::kD32FloatS8UInt:
102 return MTLPixelFormatDepth32Float_Stencil8;
103 case PixelFormat::kB10G10R10XRSRGB:
104 return SafeMTLPixelFormatBGR10_XR_sRGB();
105 case PixelFormat::kB10G10R10XR:
106 return SafeMTLPixelFormatBGR10_XR();
107 case PixelFormat::kB10G10R10A10XR:
108 return SafeMTLPixelFormatBGRA10_XR();
109 }
110 return MTLPixelFormatInvalid;
111 };
112
113 constexpr MTLBlendFactor ToMTLBlendFactor(BlendFactor type) {
114 switch (type) {
115 case BlendFactor::kZero:
116 return MTLBlendFactorZero;
117 case BlendFactor::kOne:
118 return MTLBlendFactorOne;
119 case BlendFactor::kSourceColor:
120 return MTLBlendFactorSourceColor;
121 case BlendFactor::kOneMinusSourceColor:
122 return MTLBlendFactorOneMinusSourceColor;
123 case BlendFactor::kSourceAlpha:
124 return MTLBlendFactorSourceAlpha;
125 case BlendFactor::kOneMinusSourceAlpha:
126 return MTLBlendFactorOneMinusSourceAlpha;
127 case BlendFactor::kDestinationColor:
128 return MTLBlendFactorDestinationColor;
129 case BlendFactor::kOneMinusDestinationColor:
130 return MTLBlendFactorOneMinusDestinationColor;
131 case BlendFactor::kDestinationAlpha:
132 return MTLBlendFactorDestinationAlpha;
133 case BlendFactor::kOneMinusDestinationAlpha:
134 return MTLBlendFactorOneMinusDestinationAlpha;
135 case BlendFactor::kSourceAlphaSaturated:
136 return MTLBlendFactorSourceAlphaSaturated;
137 case BlendFactor::kBlendColor:
138 return MTLBlendFactorBlendColor;
139 case BlendFactor::kOneMinusBlendColor:
140 return MTLBlendFactorOneMinusBlendColor;
141 case BlendFactor::kBlendAlpha:
142 return MTLBlendFactorBlendAlpha;
143 case BlendFactor::kOneMinusBlendAlpha:
144 return MTLBlendFactorOneMinusBlendAlpha;
145 }
146 return MTLBlendFactorZero;
147 };
148
149 constexpr MTLPrimitiveType ToMTLPrimitiveType(PrimitiveType type) {
150 switch (type) {
151 case PrimitiveType::kTriangle:
152 return MTLPrimitiveTypeTriangle;
153 case PrimitiveType::kTriangleStrip:
154 return MTLPrimitiveTypeTriangleStrip;
155 case PrimitiveType::kLine:
156 return MTLPrimitiveTypeLine;
157 case PrimitiveType::kLineStrip:
158 return MTLPrimitiveTypeLineStrip;
159 case PrimitiveType::kPoint:
160 return MTLPrimitiveTypePoint;
161 }
162 return MTLPrimitiveTypePoint;
163 }
164
165 constexpr MTLTriangleFillMode ToMTLTriangleFillMode(PolygonMode mode) {
166 switch (mode) {
167 case PolygonMode::kFill:
168 return MTLTriangleFillModeFill;
169 case PolygonMode::kLine:
170 return MTLTriangleFillModeLines;
171 }
172 return MTLTriangleFillModeFill;
173 }
174
175 constexpr MTLIndexType ToMTLIndexType(IndexType type) {
176 switch (type) {
177 case IndexType::k16bit:
178 return MTLIndexTypeUInt16;
179 default:
180 return MTLIndexTypeUInt32;
181 }
182 }
183
184 constexpr MTLCullMode ToMTLCullMode(CullMode mode) {
185 switch (mode) {
186 case CullMode::kNone:
187 return MTLCullModeNone;
188 case CullMode::kBackFace:
189 return MTLCullModeBack;
190 case CullMode::kFrontFace:
191 return MTLCullModeFront;
192 }
193 return MTLCullModeNone;
194 }
195
196 constexpr MTLBlendOperation ToMTLBlendOperation(BlendOperation type) {
197 switch (type) {
198 case BlendOperation::kAdd:
199 return MTLBlendOperationAdd;
200 case BlendOperation::kSubtract:
201 return MTLBlendOperationSubtract;
202 case BlendOperation::kReverseSubtract:
203 return MTLBlendOperationReverseSubtract;
204 }
205 return MTLBlendOperationAdd;
206 };
207
208 constexpr MTLColorWriteMask ToMTLColorWriteMask(
209 std::underlying_type_t<ColorWriteMask> type) {
210 using UnderlyingType = decltype(type);
211
212 MTLColorWriteMask mask = MTLColorWriteMaskNone;
213
214 if (type & static_cast<UnderlyingType>(ColorWriteMask::kRed)) {
215 mask |= MTLColorWriteMaskRed;
216 }
217
218 if (type & static_cast<UnderlyingType>(ColorWriteMask::kGreen)) {
219 mask |= MTLColorWriteMaskGreen;
220 }
221
222 if (type & static_cast<UnderlyingType>(ColorWriteMask::kBlue)) {
223 mask |= MTLColorWriteMaskBlue;
224 }
225
226 if (type & static_cast<UnderlyingType>(ColorWriteMask::kAlpha)) {
227 mask |= MTLColorWriteMaskAlpha;
228 }
229
230 return mask;
231 };
232
233 constexpr MTLCompareFunction ToMTLCompareFunction(CompareFunction func) {
234 switch (func) {
235 case CompareFunction::kNever:
236 return MTLCompareFunctionNever;
237 case CompareFunction::kLess:
238 return MTLCompareFunctionLess;
239 case CompareFunction::kEqual:
240 return MTLCompareFunctionEqual;
241 case CompareFunction::kLessEqual:
242 return MTLCompareFunctionLessEqual;
243 case CompareFunction::kGreater:
244 return MTLCompareFunctionGreater;
245 case CompareFunction::kNotEqual:
246 return MTLCompareFunctionNotEqual;
247 case CompareFunction::kGreaterEqual:
248 return MTLCompareFunctionGreaterEqual;
249 case CompareFunction::kAlways:
250 return MTLCompareFunctionAlways;
251 }
252 return MTLCompareFunctionAlways;
253 };
254
255 constexpr MTLStencilOperation ToMTLStencilOperation(StencilOperation op) {
256 switch (op) {
257 case StencilOperation::kKeep:
258 return MTLStencilOperationKeep;
259 case StencilOperation::kZero:
260 return MTLStencilOperationZero;
261 case StencilOperation::kSetToReferenceValue:
262 return MTLStencilOperationReplace;
263 case StencilOperation::kIncrementClamp:
264 return MTLStencilOperationIncrementClamp;
265 case StencilOperation::kDecrementClamp:
266 return MTLStencilOperationDecrementClamp;
267 case StencilOperation::kInvert:
268 return MTLStencilOperationInvert;
269 case StencilOperation::kIncrementWrap:
270 return MTLStencilOperationIncrementWrap;
271 case StencilOperation::kDecrementWrap:
272 return MTLStencilOperationDecrementWrap;
273 }
274 return MTLStencilOperationKeep;
275 };
276
277 constexpr MTLLoadAction ToMTLLoadAction(LoadAction action) {
278 switch (action) {
279 case LoadAction::kDontCare:
280 return MTLLoadActionDontCare;
281 case LoadAction::kLoad:
282 return MTLLoadActionLoad;
283 case LoadAction::kClear:
284 return MTLLoadActionClear;
285 }
286
287 return MTLLoadActionDontCare;
288 }
289
290 constexpr LoadAction FromMTLLoadAction(MTLLoadAction action) {
291 switch (action) {
292 case MTLLoadActionDontCare:
293 return LoadAction::kDontCare;
294 case MTLLoadActionLoad:
295 return LoadAction::kLoad;
296 case MTLLoadActionClear:
297 return LoadAction::kClear;
298 default:
299 break;
300 }
301
302 return LoadAction::kDontCare;
303 }
304
305 constexpr MTLStoreAction ToMTLStoreAction(StoreAction action) {
306 switch (action) {
307 case StoreAction::kDontCare:
308 return MTLStoreActionDontCare;
309 case StoreAction::kStore:
310 return MTLStoreActionStore;
311 case StoreAction::kMultisampleResolve:
312 return MTLStoreActionMultisampleResolve;
313 case StoreAction::kStoreAndMultisampleResolve:
314 return MTLStoreActionStoreAndMultisampleResolve;
315 }
316 return MTLStoreActionDontCare;
317 }
318
319 constexpr StoreAction FromMTLStoreAction(MTLStoreAction action) {
320 switch (action) {
321 case MTLStoreActionDontCare:
322 return StoreAction::kDontCare;
323 case MTLStoreActionStore:
324 return StoreAction::kStore;
325 case MTLStoreActionMultisampleResolve:
326 return StoreAction::kMultisampleResolve;
327 case MTLStoreActionStoreAndMultisampleResolve:
328 return StoreAction::kStoreAndMultisampleResolve;
329 default:
330 break;
331 }
332 return StoreAction::kDontCare;
333 }
334
335 constexpr MTLSamplerMinMagFilter ToMTLSamplerMinMagFilter(MinMagFilter filter) {
336 switch (filter) {
337 case MinMagFilter::kNearest:
338 return MTLSamplerMinMagFilterNearest;
339 case MinMagFilter::kLinear:
340 return MTLSamplerMinMagFilterLinear;
341 }
342 return MTLSamplerMinMagFilterNearest;
343 }
344
345 constexpr MTLSamplerMipFilter ToMTLSamplerMipFilter(MipFilter filter) {
346 switch (filter) {
347 case MipFilter::kNearest:
348 return MTLSamplerMipFilterNearest;
349 case MipFilter::kLinear:
350 return MTLSamplerMipFilterLinear;
351 }
352 return MTLSamplerMipFilterNotMipmapped;
353 }
354
355 constexpr MTLSamplerAddressMode ToMTLSamplerAddressMode(
356 SamplerAddressMode mode) {
357 switch (mode) {
358 case SamplerAddressMode::kClampToEdge:
359 return MTLSamplerAddressModeClampToEdge;
360 case SamplerAddressMode::kRepeat:
361 return MTLSamplerAddressModeRepeat;
362 case SamplerAddressMode::kMirror:
363 return MTLSamplerAddressModeMirrorRepeat;
364 case SamplerAddressMode::kDecal:
365 return MTLSamplerAddressModeClampToZero;
366 }
367 return MTLSamplerAddressModeClampToEdge;
368 }
369
370 inline MTLClearColor ToMTLClearColor(const Color& color) {
371 return MTLClearColorMake(color.red, color.green, color.blue, color.alpha);
372 }
373
374 constexpr MTLTextureType ToMTLTextureType(TextureType type) {
375 switch (type) {
376 case TextureType::kTexture2D:
377 return MTLTextureType2D;
378 case TextureType::kTexture2DMultisample:
379 return MTLTextureType2DMultisample;
380 case TextureType::kTextureCube:
381 return MTLTextureTypeCube;
382 case TextureType::kTextureExternalOES:
383 VALIDATION_LOG
384 << "kTextureExternalOES can not be used with the Metal backend.";
385 }
386 return MTLTextureType2D;
387 }
388
389 MTLRenderPipelineColorAttachmentDescriptor*
390 ToMTLRenderPipelineColorAttachmentDescriptor(
391 ColorAttachmentDescriptor descriptor);
392
393 MTLDepthStencilDescriptor* ToMTLDepthStencilDescriptor(
394 std::optional<DepthAttachmentDescriptor> depth,
395 std::optional<StencilAttachmentDescriptor> front,
396 std::optional<StencilAttachmentDescriptor> back);
397
398 MTLTextureDescriptor* ToMTLTextureDescriptor(const TextureDescriptor& desc);
399
400 } // namespace impeller
impeller::PixelFormat::kB8G8R8A8UNormIntSRGB
@ kB8G8R8A8UNormIntSRGB
impeller::StoreAction::kMultisampleResolve
@ kMultisampleResolve
impeller::TextureType::kTextureExternalOES
@ kTextureExternalOES
impeller::LoadAction::kLoad
@ kLoad
impeller::ToMTLColorWriteMask
constexpr MTLColorWriteMask ToMTLColorWriteMask(std::underlying_type_t< ColorWriteMask > type)
Definition: formats_mtl.h:208
impeller::StoreAction
StoreAction
Definition: formats.h:182
impeller::PrimitiveType
PrimitiveType
Definition: formats.h:328
impeller::StoreAction::kStoreAndMultisampleResolve
@ kStoreAndMultisampleResolve
impeller::PixelFormat::kB10G10R10XR
@ kB10G10R10XR
impeller::IndexType::k16bit
@ k16bit
impeller::PolygonMode
PolygonMode
Definition: formats.h:338
impeller::ToMTLSamplerAddressMode
constexpr MTLSamplerAddressMode ToMTLSamplerAddressMode(SamplerAddressMode mode)
Definition: formats_mtl.h:355
impeller::CompareFunction::kGreater
@ kGreater
Comparison test passes if new_value > current_value.
impeller::SafeMTLPixelFormatBGRA10_XR
MTLPixelFormat SafeMTLPixelFormatBGRA10_XR()
Definition: formats_mtl.mm:138
impeller::BlendFactor::kSourceAlphaSaturated
@ kSourceAlphaSaturated
impeller::PixelFormat::kB10G10R10XRSRGB
@ kB10G10R10XRSRGB
impeller::BlendFactor
BlendFactor
Definition: formats.h:152
impeller::Color
Definition: color.h:122
impeller::PixelFormat::kR8G8B8A8UNormIntSRGB
@ kR8G8B8A8UNormIntSRGB
impeller::BlendFactor::kOneMinusSourceAlpha
@ kOneMinusSourceAlpha
impeller::SamplerAddressMode
SamplerAddressMode
Definition: formats.h:377
impeller::CompareFunction::kNotEqual
@ kNotEqual
Comparison test passes if new_value != current_value.
impeller::ToMTLStencilOperation
constexpr MTLStencilOperation ToMTLStencilOperation(StencilOperation op)
Definition: formats_mtl.h:255
impeller::StencilOperation::kZero
@ kZero
Reset the stencil value to zero.
impeller::TextureType
TextureType
Definition: formats.h:236
impeller::ColorWriteMask::kGreen
@ kGreen
texture_descriptor.h
formats.h
impeller::ColorWriteMask::kRed
@ kRed
impeller::Color::alpha
Scalar alpha
Definition: color.h:141
impeller::StoreAction::kDontCare
@ kDontCare
impeller::PixelFormat::kR16G16B16A16Float
@ kR16G16B16A16Float
impeller::SafeMTLPixelFormatDepth24Unorm_Stencil8
MTLPixelFormat SafeMTLPixelFormatDepth24Unorm_Stencil8()
Definition: formats_mtl.mm:113
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::SamplerAddressMode::kClampToEdge
@ kClampToEdge
impeller::BlendFactor::kDestinationAlpha
@ kDestinationAlpha
impeller::ToMTLStoreAction
constexpr MTLStoreAction ToMTLStoreAction(StoreAction action)
Definition: formats_mtl.h:305
impeller::ToMTLCompareFunction
constexpr MTLCompareFunction ToMTLCompareFunction(CompareFunction func)
Definition: formats_mtl.h:233
impeller::StencilOperation
StencilOperation
Definition: formats.h:505
validation.h
impeller::Color::green
Scalar green
Definition: color.h:131
impeller::ToMTLClearColor
MTLClearColor ToMTLClearColor(const Color &color)
Definition: formats_mtl.h:370
impeller::PolygonMode::kFill
@ kFill
impeller::PrimitiveType::kTriangleStrip
@ kTriangleStrip
impeller::BlendFactor::kSourceColor
@ kSourceColor
impeller::PrimitiveType::kPoint
@ kPoint
impeller::ToMTLDepthStencilDescriptor
MTLDepthStencilDescriptor * ToMTLDepthStencilDescriptor(std::optional< DepthAttachmentDescriptor > depth, std::optional< StencilAttachmentDescriptor > front, std::optional< StencilAttachmentDescriptor > back)
Definition: formats_mtl.mm:54
impeller::BlendFactor::kDestinationColor
@ kDestinationColor
impeller::ToMTLTextureDescriptor
MTLTextureDescriptor * ToMTLTextureDescriptor(const TextureDescriptor &desc)
Definition: formats_mtl.mm:86
impeller::MinMagFilter::kNearest
@ kNearest
Select nearest to the sample point. Most widely supported.
impeller::BlendFactor::kZero
@ kZero
impeller::TextureType::kTexture2DMultisample
@ kTexture2DMultisample
impeller::StencilOperation::kKeep
@ kKeep
Don't modify the current stencil value.
impeller::StencilOperation::kInvert
@ kInvert
Perform a logical bitwise invert on the current stencil value.
impeller::CullMode
CullMode
Definition: formats.h:314
impeller::MipFilter::kNearest
@ kNearest
Sample from the nearest mip level.
impeller::LoadAction::kClear
@ kClear
impeller::BlendFactor::kOneMinusDestinationColor
@ kOneMinusDestinationColor
impeller::CullMode::kBackFace
@ kBackFace
impeller::FromMTLStoreAction
constexpr StoreAction FromMTLStoreAction(MTLStoreAction action)
Definition: formats_mtl.h:319
impeller::ToMTLLoadAction
constexpr MTLLoadAction ToMTLLoadAction(LoadAction action)
Definition: formats_mtl.h:277
impeller::CullMode::kNone
@ kNone
impeller::ToMTLBlendOperation
constexpr MTLBlendOperation ToMTLBlendOperation(BlendOperation type)
Definition: formats_mtl.h:196
impeller::MipFilter
MipFilter
Definition: formats.h:369
impeller::BlendOperation::kReverseSubtract
@ kReverseSubtract
impeller::BlendFactor::kBlendAlpha
@ kBlendAlpha
impeller::StencilOperation::kSetToReferenceValue
@ kSetToReferenceValue
Reset the stencil value to the reference value.
impeller::ToMTLPrimitiveType
constexpr MTLPrimitiveType ToMTLPrimitiveType(PrimitiveType type)
Definition: formats_mtl.h:149
impeller::LoadAction
LoadAction
Definition: formats.h:176
impeller::ToMTLSamplerMinMagFilter
constexpr MTLSamplerMinMagFilter ToMTLSamplerMinMagFilter(MinMagFilter filter)
Definition: formats_mtl.h:335
impeller::ToMTLRenderPipelineColorAttachmentDescriptor
MTLRenderPipelineColorAttachmentDescriptor * ToMTLRenderPipelineColorAttachmentDescriptor(ColorAttachmentDescriptor descriptor)
Definition: formats_mtl.mm:15
impeller::BlendOperation::kAdd
@ kAdd
impeller::MinMagFilter::kLinear
@ kLinear
impeller::BlendFactor::kBlendColor
@ kBlendColor
impeller::IndexType
IndexType
Definition: formats.h:320
impeller::Color::red
Scalar red
Definition: color.h:126
impeller::PixelFormat::kD32FloatS8UInt
@ kD32FloatS8UInt
impeller::CompareFunction::kNever
@ kNever
Comparison test never passes.
impeller::BlendFactor::kOneMinusBlendColor
@ kOneMinusBlendColor
impeller::PixelFormat::kUnknown
@ kUnknown
impeller::TextureType::kTextureCube
@ kTextureCube
impeller::MinMagFilter
MinMagFilter
Definition: formats.h:361
impeller::PixelFormat::kR8G8UNormInt
@ kR8G8UNormInt
impeller::PixelFormat::kD24UnormS8Uint
@ kD24UnormS8Uint
impeller::StoreAction::kStore
@ kStore
impeller::BlendFactor::kOne
@ kOne
impeller::BlendFactor::kOneMinusBlendAlpha
@ kOneMinusBlendAlpha
impeller::StencilOperation::kIncrementClamp
@ kIncrementClamp
Increment the current stencil value by 1. Clamp it to the maximum.
impeller::PixelFormat::kB8G8R8A8UNormInt
@ kB8G8R8A8UNormInt
impeller::PrimitiveType::kLine
@ kLine
impeller::TextureType::kTexture2D
@ kTexture2D
impeller::PrimitiveType::kLineStrip
@ kLineStrip
impeller::ToMTLPixelFormat
constexpr MTLPixelFormat ToMTLPixelFormat(PixelFormat format)
Definition: formats_mtl.h:75
impeller::SafeMTLPixelFormatBGR10_XR
MTLPixelFormat SafeMTLPixelFormatBGR10_XR()
Definition: formats_mtl.mm:130
impeller::CompareFunction::kLess
@ kLess
Comparison test passes if new_value < current_value.
impeller::ToMTLTextureType
constexpr MTLTextureType ToMTLTextureType(TextureType type)
Definition: formats_mtl.h:374
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:60
impeller::CullMode::kFrontFace
@ kFrontFace
impeller::FromMTLLoadAction
constexpr LoadAction FromMTLLoadAction(MTLLoadAction action)
Definition: formats_mtl.h:290
impeller::PixelFormat::kB10G10R10A10XR
@ kB10G10R10A10XR
impeller::BlendOperation
BlendOperation
Definition: formats.h:170
impeller::CompareFunction::kGreaterEqual
@ kGreaterEqual
Comparison test passes if new_value >= current_value.
impeller::StencilOperation::kDecrementClamp
@ kDecrementClamp
Decrement the current stencil value by 1. Clamp it to zero.
impeller::CompareFunction
CompareFunction
Definition: formats.h:486
impeller::CompareFunction::kAlways
@ kAlways
Comparison test passes always passes.
impeller::SafeMTLPixelFormatBGR10_XR_sRGB
MTLPixelFormat SafeMTLPixelFormatBGR10_XR_sRGB()
Definition: formats_mtl.mm:122
impeller::SamplerAddressMode::kMirror
@ kMirror
impeller::LoadAction::kDontCare
@ kDontCare
impeller::PixelFormat::kS8UInt
@ kS8UInt
impeller::ToMTLSamplerMipFilter
constexpr MTLSamplerMipFilter ToMTLSamplerMipFilter(MipFilter filter)
Definition: formats_mtl.h:345
impeller::ToMTLBlendFactor
constexpr MTLBlendFactor ToMTLBlendFactor(BlendFactor type)
Definition: formats_mtl.h:113
impeller::BlendFactor::kOneMinusSourceColor
@ kOneMinusSourceColor
impeller::PixelFormat::kA8UNormInt
@ kA8UNormInt
impeller::MipFilter::kLinear
@ kLinear
impeller::ToMTLIndexType
constexpr MTLIndexType ToMTLIndexType(IndexType type)
Definition: formats_mtl.h:175
impeller::FromMTLPixelFormat
constexpr PixelFormat FromMTLPixelFormat(MTLPixelFormat format)
Definition: formats_mtl.h:21
impeller::ColorWriteMask::kAlpha
@ kAlpha
color.h
impeller::ColorWriteMask::kBlue
@ kBlue
impeller::CompareFunction::kEqual
@ kEqual
Comparison test passes if new_value == current_value.
impeller::PrimitiveType::kTriangle
@ kTriangle
impeller::PolygonMode::kLine
@ kLine
impeller::PixelFormat::kR8UNormInt
@ kR8UNormInt
impeller::PixelFormat
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:94
impeller::Color::blue
Scalar blue
Definition: color.h:136
impeller::BlendFactor::kSourceAlpha
@ kSourceAlpha
impeller::StencilOperation::kDecrementWrap
@ kDecrementWrap
Decrement the current stencil value by 1. If at zero, set to maximum.
impeller::CompareFunction::kLessEqual
@ kLessEqual
Comparison test passes if new_value <= current_value.
impeller::ToMTLCullMode
constexpr MTLCullMode ToMTLCullMode(CullMode mode)
Definition: formats_mtl.h:184
impeller
Definition: aiks_context.cc:10
impeller::StencilOperation::kIncrementWrap
@ kIncrementWrap
Increment the current stencil value by 1. If at maximum, set to zero.
impeller::BlendOperation::kSubtract
@ kSubtract
impeller::ToMTLTriangleFillMode
constexpr MTLTriangleFillMode ToMTLTriangleFillMode(PolygonMode mode)
Definition: formats_mtl.h:165
impeller::BlendFactor::kOneMinusDestinationAlpha
@ kOneMinusDestinationAlpha
impeller::PixelFormat::kR32G32B32A32Float
@ kR32G32B32A32Float
impeller::SamplerAddressMode::kRepeat
@ kRepeat
impeller::SamplerAddressMode::kDecal
@ kDecal
decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddre...