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