| Flutter Impeller |

formats.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_CORE_FORMATS_H_
6 #define FLUTTER_IMPELLER_CORE_FORMATS_H_
7
8 #include <cstdint>
9 #include <functional>
10 #include <memory>
11 #include <string>
12
13 #include "flutter/fml/hash_combine.h"
14 #include "flutter/fml/logging.h"
15 #include "impeller/base/mask.h"
16 #include "impeller/geometry/color.h"
17 #include "impeller/geometry/rect.h"
18 #include "impeller/geometry/scalar.h"
19
20 namespace impeller {
21
22 enum class WindingOrder {
23 kClockwise,
24 kCounterClockwise,
25 };
26
27 class Texture;
28
29 //------------------------------------------------------------------------------
30 /// @brief Specified where the allocation resides and how it is used.
31 ///
32 enum class StorageMode {
33 //----------------------------------------------------------------------------
34 /// Allocations can be mapped onto the hosts address space and also be used by
35 /// the device.
36 ///
37 kHostVisible,
38 //----------------------------------------------------------------------------
39 /// Allocations can only be used by the device. This location is optimal for
40 /// use by the device. If the host needs to access these allocations, the
41 /// transfer queue must be used to transfer this allocation onto the a host
42 /// visible buffer.
43 ///
44 kDevicePrivate,
45 //----------------------------------------------------------------------------
46 /// Used by the device for temporary render targets. These allocations cannot
47 /// be transferred from and to other allocations using the transfer queue.
48 /// Render pass cannot initialize the contents of these buffers using load and
49 /// store actions.
50 ///
51 /// These allocations reside in tile memory which has higher bandwidth, lower
52 /// latency and lower power consumption. The total device memory usage is
53 /// also lower as a separate allocation does not need to be created in
54 /// device memory. Prefer using these allocations for intermediates like depth
55 /// and stencil buffers.
56 ///
57 kDeviceTransient,
58 };
59
60 constexpr const char* StorageModeToString(StorageMode mode) {
61 switch (mode) {
62 case StorageMode::kHostVisible:
63 return "HostVisible";
64 case StorageMode::kDevicePrivate:
65 return "DevicePrivate";
66 case StorageMode::kDeviceTransient:
67 return "DeviceTransient";
68 }
69 FML_UNREACHABLE();
70 }
71
72 //------------------------------------------------------------------------------
73 /// @brief The Pixel formats supported by Impeller. The naming convention
74 /// denotes the usage of the component, the bit width of that
75 /// component, and then one or more qualifiers to its
76 /// interpretation.
77 ///
78 /// For instance, `kR8G8B8A8UNormIntSRGB` is a 32 bits-per-pixel
79 /// format ordered in RGBA with 8 bits per component with each
80 /// component expressed as an unsigned normalized integer and a
81 /// conversion from sRGB to linear color space.
82 ///
83 /// Key:
84 /// R -> Red Component
85 /// G -> Green Component
86 /// B -> Blue Component
87 /// D -> Depth Component
88 /// S -> Stencil Component
89 /// U -> Unsigned (Lack of this denotes a signed component)
90 /// Norm -> Normalized
91 /// SRGB -> sRGB to linear interpretation
92 ///
93 /// While the effective bit width of the pixel can be determined by
94 /// adding up the widths of each component, only the non-esoteric
95 /// formats are tightly packed. Do not assume tight packing for the
96 /// esoteric formats and use blit passes to convert to a
97 /// non-esoteric pass.
98 ///
99 enum class PixelFormat : uint8_t {
100 kUnknown,
101 kA8UNormInt,
102 kR8UNormInt,
103 kR8G8UNormInt,
104 kR8G8B8A8UNormInt,
105 kR8G8B8A8UNormIntSRGB,
106 kB8G8R8A8UNormInt,
107 kB8G8R8A8UNormIntSRGB,
108 kR32G32B32A32Float,
109 kR16G16B16A16Float,
110 kB10G10R10XR,
111 kB10G10R10XRSRGB,
112 kB10G10R10A10XR,
113 // Depth and stencil formats.
114 kS8UInt,
115 kD24UnormS8Uint,
116 kD32FloatS8UInt,
117 };
118
119 constexpr bool IsDepthWritable(PixelFormat format) {
120 switch (format) {
121 case PixelFormat::kD24UnormS8Uint:
122 case PixelFormat::kD32FloatS8UInt:
123 return true;
124 default:
125 return false;
126 }
127 }
128
129 constexpr bool IsStencilWritable(PixelFormat format) {
130 switch (format) {
131 case PixelFormat::kS8UInt:
132 case PixelFormat::kD24UnormS8Uint:
133 case PixelFormat::kD32FloatS8UInt:
134 return true;
135 default:
136 return false;
137 }
138 }
139
140 constexpr const char* PixelFormatToString(PixelFormat format) {
141 switch (format) {
142 case PixelFormat::kUnknown:
143 return "Unknown";
144 case PixelFormat::kA8UNormInt:
145 return "A8UNormInt";
146 case PixelFormat::kR8UNormInt:
147 return "R8UNormInt";
148 case PixelFormat::kR8G8UNormInt:
149 return "R8G8UNormInt";
150 case PixelFormat::kR8G8B8A8UNormInt:
151 return "R8G8B8A8UNormInt";
152 case PixelFormat::kR8G8B8A8UNormIntSRGB:
153 return "R8G8B8A8UNormIntSRGB";
154 case PixelFormat::kB8G8R8A8UNormInt:
155 return "B8G8R8A8UNormInt";
156 case PixelFormat::kB8G8R8A8UNormIntSRGB:
157 return "B8G8R8A8UNormIntSRGB";
158 case PixelFormat::kR32G32B32A32Float:
159 return "R32G32B32A32Float";
160 case PixelFormat::kR16G16B16A16Float:
161 return "R16G16B16A16Float";
162 case PixelFormat::kB10G10R10XR:
163 return "B10G10R10XR";
164 case PixelFormat::kB10G10R10XRSRGB:
165 return "B10G10R10XRSRGB";
166 case PixelFormat::kB10G10R10A10XR:
167 return "B10G10R10A10XR";
168 case PixelFormat::kS8UInt:
169 return "S8UInt";
170 case PixelFormat::kD24UnormS8Uint:
171 return "D24UnormS8Uint";
172 case PixelFormat::kD32FloatS8UInt:
173 return "D32FloatS8UInt";
174 }
175 FML_UNREACHABLE();
176 }
177
178 enum class BlendFactor {
179 kZero,
180 kOne,
181 kSourceColor,
182 kOneMinusSourceColor,
183 kSourceAlpha,
184 kOneMinusSourceAlpha,
185 kDestinationColor,
186 kOneMinusDestinationColor,
187 kDestinationAlpha,
188 kOneMinusDestinationAlpha,
189 kSourceAlphaSaturated,
190 kBlendColor,
191 kOneMinusBlendColor,
192 kBlendAlpha,
193 kOneMinusBlendAlpha,
194 };
195
196 enum class BlendOperation {
197 kAdd,
198 kSubtract,
199 kReverseSubtract,
200 };
201
202 enum class LoadAction {
203 kDontCare,
204 kLoad,
205 kClear,
206 };
207
208 enum class StoreAction {
209 kDontCare,
210 kStore,
211 kMultisampleResolve,
212 kStoreAndMultisampleResolve,
213 };
214
215 constexpr const char* LoadActionToString(LoadAction action) {
216 switch (action) {
217 case LoadAction::kDontCare:
218 return "DontCare";
219 case LoadAction::kLoad:
220 return "Load";
221 case LoadAction::kClear:
222 return "Clear";
223 }
224 }
225
226 constexpr const char* StoreActionToString(StoreAction action) {
227 switch (action) {
228 case StoreAction::kDontCare:
229 return "DontCare";
230 case StoreAction::kStore:
231 return "Store";
232 case StoreAction::kMultisampleResolve:
233 return "MultisampleResolve";
234 case StoreAction::kStoreAndMultisampleResolve:
235 return "StoreAndMultisampleResolve";
236 }
237 }
238
239 constexpr bool CanClearAttachment(LoadAction action) {
240 switch (action) {
241 case LoadAction::kLoad:
242 return false;
243 case LoadAction::kDontCare:
244 case LoadAction::kClear:
245 return true;
246 }
247 FML_UNREACHABLE();
248 }
249
250 constexpr bool CanDiscardAttachmentWhenDone(StoreAction action) {
251 switch (action) {
252 case StoreAction::kStore:
253 case StoreAction::kStoreAndMultisampleResolve:
254 return false;
255 case StoreAction::kDontCare:
256 case StoreAction::kMultisampleResolve:
257 return true;
258 }
259 FML_UNREACHABLE();
260 }
261
262 enum class TextureType {
263 kTexture2D,
264 kTexture2DMultisample,
265 kTextureCube,
266 kTextureExternalOES,
267 };
268
269 constexpr const char* TextureTypeToString(TextureType type) {
270 switch (type) {
271 case TextureType::kTexture2D:
272 return "Texture2D";
273 case TextureType::kTexture2DMultisample:
274 return "Texture2DMultisample";
275 case TextureType::kTextureCube:
276 return "TextureCube";
277 case TextureType::kTextureExternalOES:
278 return "TextureExternalOES";
279 }
280 FML_UNREACHABLE();
281 }
282
283 constexpr bool IsMultisampleCapable(TextureType type) {
284 switch (type) {
285 case TextureType::kTexture2D:
286 case TextureType::kTextureCube:
287 case TextureType::kTextureExternalOES:
288 return false;
289 case TextureType::kTexture2DMultisample:
290 return true;
291 }
292 return false;
293 }
294
295 enum class SampleCount : uint8_t {
296 kCount1 = 1,
297 kCount4 = 4,
298 };
299
300 enum class TextureUsage {
301 kUnknown = 0,
302 kShaderRead = 1 << 0,
303 kShaderWrite = 1 << 1,
304 kRenderTarget = 1 << 2,
305 };
306 IMPELLER_ENUM_IS_MASK(TextureUsage);
307
308 using TextureUsageMask = Mask<TextureUsage>;
309
310 constexpr const char* TextureUsageToString(TextureUsage usage) {
311 switch (usage) {
312 case TextureUsage::kUnknown:
313 return "Unknown";
314 case TextureUsage::kShaderRead:
315 return "ShaderRead";
316 case TextureUsage::kShaderWrite:
317 return "ShaderWrite";
318 case TextureUsage::kRenderTarget:
319 return "RenderTarget";
320 }
321 FML_UNREACHABLE();
322 }
323
324 std::string TextureUsageMaskToString(TextureUsageMask mask);
325
326 // Texture coordinate system.
327 enum class TextureCoordinateSystem {
328 // Alternative coordinate system used when uploading texture data from the
329 // host.
330 // (0, 0) is the bottom-left of the image with +Y going up.
331 kUploadFromHost,
332 // Default coordinate system.
333 // (0, 0) is the top-left of the image with +Y going down.
334 kRenderToTexture,
335 };
336
337 enum class CullMode {
338 kNone,
339 kFrontFace,
340 kBackFace,
341 };
342
343 enum class IndexType {
344 kUnknown,
345 k16bit,
346 k32bit,
347 /// Does not use the index buffer.
348 kNone,
349 };
350
351 /// Decides how backend draws pixels based on input vertices.
352 enum class PrimitiveType : uint8_t {
353 /// Draws a triage for each separate set of three vertices.
354 ///
355 /// Vertices [A, B, C, D, E, F] will produce triages
356 /// [ABC, DEF].
357 kTriangle,
358
359 /// Draws a triage for every adjacent three vertices.
360 ///
361 /// Vertices [A, B, C, D, E, F] will produce triages
362 /// [ABC, BCD, CDE, DEF].
363 kTriangleStrip,
364
365 /// Draws a line for each separate set of two vertices.
366 ///
367 /// Vertices [A, B, C] will produce discontinued line
368 /// [AB, BC].
369 kLine,
370
371 /// Draws a continuous line that connect every input vertices
372 ///
373 /// Vertices [A, B, C] will produce one continuous line
374 /// [ABC].
375 kLineStrip,
376
377 /// Draws a point at each input vertex.
378 kPoint,
379 // Triangle fans are implementation dependent and need extra extensions
380 // checks. Hence, they are not supported here.
381 };
382
383 enum class PolygonMode {
384 kFill,
385 kLine,
386 };
387
388 struct DepthRange {
389 Scalar z_near = 0.0;
390 Scalar z_far = 1.0;
391
392 constexpr bool operator==(const DepthRange& other) const {
393 return z_near == other.z_near && z_far == other.z_far;
394 }
395 };
396
397 struct Viewport {
398 Rect rect;
399 DepthRange depth_range;
400
401 constexpr bool operator==(const Viewport& other) const {
402 return rect == other.rect && depth_range == other.depth_range;
403 }
404 };
405
406 /// @brief Describes how the texture should be sampled when the texture
407 /// is being shrunk (minified) or expanded (magnified) to fit to
408 /// the sample point.
409 enum class MinMagFilter {
410 /// Select nearest to the sample point. Most widely supported.
411 kNearest,
412
413 /// Select two points and linearly interpolate between them. Some formats
414 /// may not support this.
415 kLinear,
416 };
417
418 /// @brief Options for selecting and filtering between mipmap levels.
419 enum class MipFilter {
420 /// @brief The texture is sampled as if it only had a single mipmap level.
421 ///
422 /// All samples are read from level 0.
423 kBase,
424
425 /// @brief The nearst mipmap level is selected.
426 kNearest,
427
428 /// @brief Sample from the two nearest mip levels and linearly interpolate.
429 ///
430 /// If the filter falls between levels, both levels are sampled, and
431 /// their results linearly interpolated between levels.
432 kLinear,
433 };
434
435 enum class SamplerAddressMode {
436 kClampToEdge,
437 kRepeat,
438 kMirror,
439 // More modes are almost always supported but they are usually behind
440 // extensions checks. The ones current in these structs are safe (always
441 // supported) defaults.
442
443 /// @brief decal sampling mode is only supported on devices that pass
444 /// the `Capabilities.SupportsDecalSamplerAddressMode` check.
445 kDecal,
446 };
447
448 enum class ColorWriteMaskBits : uint64_t {
449 kNone = 0,
450 kRed = 1 << 0,
451 kGreen = 1 << 1,
452 kBlue = 1 << 2,
453 kAlpha = 1 << 3,
454 kAll = kRed | kGreen | kBlue | kAlpha,
455 };
456 IMPELLER_ENUM_IS_MASK(ColorWriteMaskBits);
457
458 using ColorWriteMask = Mask<ColorWriteMaskBits>;
459
460 constexpr size_t BytesPerPixelForPixelFormat(PixelFormat format) {
461 switch (format) {
462 case PixelFormat::kUnknown:
463 return 0u;
464 case PixelFormat::kA8UNormInt:
465 case PixelFormat::kR8UNormInt:
466 case PixelFormat::kS8UInt:
467 return 1u;
468 case PixelFormat::kR8G8UNormInt:
469 return 2u;
470 case PixelFormat::kR8G8B8A8UNormInt:
471 case PixelFormat::kR8G8B8A8UNormIntSRGB:
472 case PixelFormat::kB8G8R8A8UNormInt:
473 case PixelFormat::kB8G8R8A8UNormIntSRGB:
474 case PixelFormat::kB10G10R10XRSRGB:
475 case PixelFormat::kB10G10R10XR:
476 return 4u;
477 case PixelFormat::kD24UnormS8Uint:
478 return 4u;
479 case PixelFormat::kD32FloatS8UInt:
480 return 5u;
481 case PixelFormat::kR16G16B16A16Float:
482 case PixelFormat::kB10G10R10A10XR:
483 return 8u;
484 case PixelFormat::kR32G32B32A32Float:
485 return 16u;
486 }
487 return 0u;
488 }
489
490 //------------------------------------------------------------------------------
491 /// @brief Describe the color attachment that will be used with this
492 /// pipeline.
493 ///
494 /// Blending at specific color attachments follows the pseudo-code:
495 /// ```
496 /// if (blending_enabled) {
497 /// final_color.rgb = (src_color_blend_factor * new_color.rgb)
498 /// <color_blend_op>
499 /// (dst_color_blend_factor * old_color.rgb);
500 /// final_color.a = (src_alpha_blend_factor * new_color.a)
501 /// <alpha_blend_op>
502 /// (dst_alpha_blend_factor * old_color.a);
503 /// } else {
504 /// final_color = new_color;
505 /// }
506 /// // IMPORTANT: The write mask is applied irrespective of whether
507 /// // blending_enabled is set.
508 /// final_color = final_color & write_mask;
509 /// ```
510 ///
511 /// The default blend mode is 1 - source alpha.
512 struct ColorAttachmentDescriptor {
513 PixelFormat format = PixelFormat::kUnknown;
514 bool blending_enabled = false;
515
516 BlendFactor src_color_blend_factor = BlendFactor::kSourceAlpha;
517 BlendOperation color_blend_op = BlendOperation::kAdd;
518 BlendFactor dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha;
519
520 BlendFactor src_alpha_blend_factor = BlendFactor::kSourceAlpha;
521 BlendOperation alpha_blend_op = BlendOperation::kAdd;
522 BlendFactor dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha;
523
524 ColorWriteMask write_mask = ColorWriteMaskBits::kAll;
525
526 constexpr bool operator==(const ColorAttachmentDescriptor& o) const {
527 return format == o.format && //
528 blending_enabled == o.blending_enabled && //
529 src_color_blend_factor == o.src_color_blend_factor && //
530 color_blend_op == o.color_blend_op && //
531 dst_color_blend_factor == o.dst_color_blend_factor && //
532 src_alpha_blend_factor == o.src_alpha_blend_factor && //
533 alpha_blend_op == o.alpha_blend_op && //
534 dst_alpha_blend_factor == o.dst_alpha_blend_factor && //
535 write_mask == o.write_mask;
536 }
537
538 constexpr size_t Hash() const {
539 return fml::HashCombine(
540 format, blending_enabled, src_color_blend_factor, color_blend_op,
541 dst_color_blend_factor, src_alpha_blend_factor, alpha_blend_op,
542 dst_alpha_blend_factor, static_cast<uint64_t>(write_mask));
543 }
544 };
545
546 enum class CompareFunction : uint8_t {
547 /// Comparison test never passes.
548 kNever,
549 /// Comparison test passes always passes.
550 kAlways,
551 /// Comparison test passes if new_value < current_value.
552 kLess,
553 /// Comparison test passes if new_value == current_value.
554 kEqual,
555 /// Comparison test passes if new_value <= current_value.
556 kLessEqual,
557 /// Comparison test passes if new_value > current_value.
558 kGreater,
559 /// Comparison test passes if new_value != current_value.
560 kNotEqual,
561 /// Comparison test passes if new_value >= current_value.
562 kGreaterEqual,
563 };
564
565 enum class StencilOperation : uint8_t {
566 /// Don't modify the current stencil value.
567 kKeep,
568 /// Reset the stencil value to zero.
569 kZero,
570 /// Reset the stencil value to the reference value.
571 kSetToReferenceValue,
572 /// Increment the current stencil value by 1. Clamp it to the maximum.
573 kIncrementClamp,
574 /// Decrement the current stencil value by 1. Clamp it to zero.
575 kDecrementClamp,
576 /// Perform a logical bitwise invert on the current stencil value.
577 kInvert,
578 /// Increment the current stencil value by 1. If at maximum, set to zero.
579 kIncrementWrap,
580 /// Decrement the current stencil value by 1. If at zero, set to maximum.
581 kDecrementWrap,
582 };
583
584 struct DepthAttachmentDescriptor {
585 //----------------------------------------------------------------------------
586 /// Indicates how to compare the value with that in the depth buffer.
587 ///
588 CompareFunction depth_compare = CompareFunction::kAlways;
589 //----------------------------------------------------------------------------
590 /// Indicates when writes must be performed to the depth buffer.
591 ///
592 bool depth_write_enabled = false;
593
594 constexpr bool operator==(const DepthAttachmentDescriptor& o) const {
595 return depth_compare == o.depth_compare &&
596 depth_write_enabled == o.depth_write_enabled;
597 }
598
599 constexpr size_t GetHash() const {
600 return fml::HashCombine(depth_compare, depth_write_enabled);
601 }
602 };
603
604 struct StencilAttachmentDescriptor {
605 //----------------------------------------------------------------------------
606 /// Indicates the operation to perform between the reference value and the
607 /// value in the stencil buffer. Both values have the read_mask applied to
608 /// them before performing this operation.
609 ///
610 CompareFunction stencil_compare = CompareFunction::kAlways;
611 //----------------------------------------------------------------------------
612 /// Indicates what to do when the stencil test has failed.
613 ///
614 StencilOperation stencil_failure = StencilOperation::kKeep;
615 //----------------------------------------------------------------------------
616 /// Indicates what to do when the stencil test passes but the depth test
617 /// fails.
618 ///
619 StencilOperation depth_failure = StencilOperation::kKeep;
620 //----------------------------------------------------------------------------
621 /// Indicates what to do when both the stencil and depth tests pass.
622 ///
623 StencilOperation depth_stencil_pass = StencilOperation::kKeep;
624
625 //----------------------------------------------------------------------------
626 /// The mask applied to the reference and stencil buffer values before
627 /// performing the stencil_compare operation.
628 ///
629 uint32_t read_mask = ~0;
630 //----------------------------------------------------------------------------
631 /// The mask applied to the new stencil value before it is written into the
632 /// stencil buffer.
633 ///
634 uint32_t write_mask = ~0;
635
636 constexpr bool operator==(const StencilAttachmentDescriptor& o) const {
637 return stencil_compare == o.stencil_compare &&
638 stencil_failure == o.stencil_failure &&
639 depth_failure == o.depth_failure &&
640 depth_stencil_pass == o.depth_stencil_pass &&
641 read_mask == o.read_mask && write_mask == o.write_mask;
642 }
643
644 constexpr size_t GetHash() const {
645 return fml::HashCombine(stencil_compare, stencil_failure, depth_failure,
646 depth_stencil_pass, read_mask, write_mask);
647 }
648 };
649
650 struct Attachment {
651 std::shared_ptr<Texture> texture;
652 std::shared_ptr<Texture> resolve_texture;
653 LoadAction load_action = LoadAction::kDontCare;
654 StoreAction store_action = StoreAction::kStore;
655
656 bool IsValid() const;
657 };
658
659 struct ColorAttachment : public Attachment {
660 Color clear_color = Color::BlackTransparent();
661 };
662
663 struct DepthAttachment : public Attachment {
664 double clear_depth = 0.0;
665 };
666
667 struct StencilAttachment : public Attachment {
668 uint32_t clear_stencil = 0;
669 };
670
671 std::string AttachmentToString(const Attachment& attachment);
672
673 std::string ColorAttachmentToString(const ColorAttachment& color);
674
675 std::string DepthAttachmentToString(const DepthAttachment& depth);
676
677 std::string StencilAttachmentToString(const StencilAttachment& stencil);
678
679 } // namespace impeller
680
681 namespace std {
682
683 template <>
684 struct hash<impeller::DepthAttachmentDescriptor> {
685 constexpr std::size_t operator()(
686 const impeller::DepthAttachmentDescriptor& des) const {
687 return des.GetHash();
688 }
689 };
690
691 template <>
692 struct hash<impeller::StencilAttachmentDescriptor> {
693 constexpr std::size_t operator()(
694 const impeller::StencilAttachmentDescriptor& des) const {
695 return des.GetHash();
696 }
697 };
698
699 } // namespace std
700
701 #endif // FLUTTER_IMPELLER_CORE_FORMATS_H_
impeller::StoreAction::kMultisampleResolve
@ kMultisampleResolve
impeller::PixelFormat::kS8UInt
@ kS8UInt
impeller::TextureType::kTextureExternalOES
@ kTextureExternalOES
impeller::ColorAttachmentDescriptor::src_color_blend_factor
BlendFactor src_color_blend_factor
Definition: formats.h:516
impeller::CompareFunction::kGreater
@ kGreater
Comparison test passes if new_value > current_value.
impeller::PrimitiveType::kLineStrip
@ kLineStrip
impeller::LoadAction::kLoad
@ kLoad
impeller::TextureUsage::kShaderWrite
@ kShaderWrite
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::Attachment::store_action
StoreAction store_action
Definition: formats.h:654
impeller::PolygonMode
PolygonMode
Definition: formats.h:383
impeller::PixelFormatToString
constexpr const char * PixelFormatToString(PixelFormat format)
Definition: formats.h:140
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::CanClearAttachment
constexpr bool CanClearAttachment(LoadAction action)
Definition: formats.h:239
impeller::StencilAttachmentDescriptor::depth_failure
StencilOperation depth_failure
Definition: formats.h:619
impeller::StencilAttachmentDescriptor::stencil_compare
CompareFunction stencil_compare
Definition: formats.h:610
impeller::Viewport::rect
Rect rect
Definition: formats.h:398
impeller::ColorWriteMaskBits::kNone
@ kNone
impeller::PixelFormat::kB10G10R10A10XR
@ kB10G10R10A10XR
impeller::PixelFormat::kB8G8R8A8UNormIntSRGB
@ kB8G8R8A8UNormIntSRGB
impeller::PixelFormat::kA8UNormInt
@ kA8UNormInt
impeller::Viewport::depth_range
DepthRange depth_range
Definition: formats.h:399
impeller::BlendFactor::kSourceAlphaSaturated
@ kSourceAlphaSaturated
impeller::BlendFactor
BlendFactor
Definition: formats.h:178
impeller::DepthRange::z_far
Scalar z_far
Definition: formats.h:390
impeller::IsDepthWritable
constexpr bool IsDepthWritable(PixelFormat format)
Definition: formats.h:119
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::ColorAttachment
Definition: formats.h:659
impeller::SamplerAddressMode
SamplerAddressMode
Definition: formats.h:435
impeller::CompareFunction::kGreaterEqual
@ kGreaterEqual
Comparison test passes if new_value >= current_value.
impeller::StencilOperation::kKeep
@ kKeep
Don't modify the current stencil value.
impeller::LoadActionToString
constexpr const char * LoadActionToString(LoadAction action)
Definition: formats.h:215
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::TextureType
TextureType
Definition: formats.h:262
impeller::DepthRange::z_near
Scalar z_near
Definition: formats.h:389
impeller::DepthAttachmentDescriptor::GetHash
constexpr size_t GetHash() const
Definition: formats.h:599
impeller::StencilOperation::kIncrementClamp
@ kIncrementClamp
Increment the current stencil value by 1. Clamp it to the maximum.
impeller::ColorAttachmentDescriptor::alpha_blend_op
BlendOperation alpha_blend_op
Definition: formats.h:521
impeller::StoreAction::kDontCare
@ kDontCare
impeller::StencilOperation::kInvert
@ kInvert
Perform a logical bitwise invert on the current stencil value.
impeller::WindingOrder::kClockwise
@ kClockwise
impeller::SamplerAddressMode::kClampToEdge
@ kClampToEdge
impeller::BlendFactor::kDestinationAlpha
@ kDestinationAlpha
impeller::IndexType::k32bit
@ k32bit
impeller::TextureUsage::kRenderTarget
@ kRenderTarget
impeller::StencilAttachmentDescriptor::write_mask
uint32_t write_mask
Definition: formats.h:634
impeller::StorageMode::kHostVisible
@ kHostVisible
impeller::WindingOrder
WindingOrder
Definition: formats.h:22
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::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::MinMagFilter::kNearest
@ kNearest
Select nearest to the sample point. Most widely supported.
impeller::TextureCoordinateSystem::kUploadFromHost
@ kUploadFromHost
impeller::Mask< TextureUsage >
impeller::PrimitiveType::kTriangle
@ kTriangle
impeller::ColorAttachmentDescriptor::Hash
constexpr size_t Hash() const
Definition: formats.h:538
impeller::BlendFactor::kZero
@ kZero
impeller::TextureType::kTexture2DMultisample
@ kTexture2DMultisample
impeller::StencilAttachment
Definition: formats.h:667
impeller::TextureCoordinateSystem
TextureCoordinateSystem
Definition: formats.h:327
impeller::CullMode
CullMode
Definition: formats.h:337
impeller::MipFilter::kNearest
@ kNearest
The nearst mipmap level is selected.
impeller::TextureCoordinateSystem::kRenderToTexture
@ kRenderToTexture
impeller::ColorWriteMaskBits::kAll
@ kAll
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::DepthAttachmentDescriptor::depth_write_enabled
bool depth_write_enabled
Definition: formats.h:592
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::StorageMode::kDeviceTransient
@ kDeviceTransient
impeller::ColorAttachment::clear_color
Color clear_color
Definition: formats.h:660
impeller::CullMode::kBackFace
@ kBackFace
impeller::StorageMode
StorageMode
Specified where the allocation resides and how it is used.
Definition: formats.h:32
impeller::DepthAttachmentDescriptor::operator==
constexpr bool operator==(const DepthAttachmentDescriptor &o) const
Definition: formats.h:594
impeller::CullMode::kNone
@ kNone
impeller::StencilAttachmentDescriptor::read_mask
uint32_t read_mask
Definition: formats.h:629
impeller::MipFilter
MipFilter
Options for selecting and filtering between mipmap levels.
Definition: formats.h:419
impeller::BlendOperation::kReverseSubtract
@ kReverseSubtract
impeller::BytesPerPixelForPixelFormat
constexpr size_t BytesPerPixelForPixelFormat(PixelFormat format)
Definition: formats.h:460
impeller::BlendFactor::kBlendAlpha
@ kBlendAlpha
impeller::Attachment::texture
std::shared_ptr< Texture > texture
Definition: formats.h:651
impeller::DepthRange::operator==
constexpr bool operator==(const DepthRange &other) const
Definition: formats.h:392
impeller::LoadAction
LoadAction
Definition: formats.h:202
impeller::PrimitiveType::kPoint
@ kPoint
Draws a point at each input vertex.
impeller::PixelFormat::kR8G8UNormInt
@ kR8G8UNormInt
impeller::BlendOperation::kAdd
@ kAdd
impeller::MinMagFilter::kLinear
@ kLinear
impeller::StorageMode::kDevicePrivate
@ kDevicePrivate
impeller::StorageModeToString
constexpr const char * StorageModeToString(StorageMode mode)
Definition: formats.h:60
impeller::BlendFactor::kBlendColor
@ kBlendColor
std::hash< impeller::DepthAttachmentDescriptor >::operator()
constexpr std::size_t operator()(const impeller::DepthAttachmentDescriptor &des) const
Definition: formats.h:685
impeller::IndexType
IndexType
Definition: formats.h:343
impeller::ColorWriteMaskBits
ColorWriteMaskBits
Definition: formats.h:448
impeller::PixelFormat::kB10G10R10XR
@ kB10G10R10XR
impeller::AttachmentToString
std::string AttachmentToString(const Attachment &attachment)
Definition: formats.cc:104
impeller::ColorAttachmentToString
std::string ColorAttachmentToString(const ColorAttachment &color)
Definition: formats.cc:123
impeller::PixelFormat::kD24UnormS8Uint
@ kD24UnormS8Uint
type
GLenum type
Definition: blit_command_gles.cc:126
mask.h
impeller::WindingOrder::kCounterClockwise
@ kCounterClockwise
impeller::StencilAttachmentDescriptor::stencil_failure
StencilOperation stencil_failure
Definition: formats.h:614
impeller::IsStencilWritable
constexpr bool IsStencilWritable(PixelFormat format)
Definition: formats.h:129
impeller::BlendFactor::kOneMinusBlendColor
@ kOneMinusBlendColor
impeller::IndexType::kNone
@ kNone
Does not use the index buffer.
impeller::ColorAttachmentDescriptor::format
PixelFormat format
Definition: formats.h:513
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::StencilAttachmentDescriptor::depth_stencil_pass
StencilOperation depth_stencil_pass
Definition: formats.h:623
impeller::Attachment
Definition: formats.h:650
impeller::TextureUsage
TextureUsage
Definition: formats.h:300
impeller::StoreAction::kStore
@ kStore
impeller::StencilAttachment::clear_stencil
uint32_t clear_stencil
Definition: formats.h:668
impeller::CompareFunction::kLessEqual
@ kLessEqual
Comparison test passes if new_value <= current_value.
impeller::StencilAttachmentDescriptor::operator==
constexpr bool operator==(const StencilAttachmentDescriptor &o) const
Definition: formats.h:636
impeller::BlendFactor::kOne
@ kOne
impeller::BlendFactor::kOneMinusBlendAlpha
@ kOneMinusBlendAlpha
impeller::CanDiscardAttachmentWhenDone
constexpr bool CanDiscardAttachmentWhenDone(StoreAction action)
Definition: formats.h:250
impeller::StencilAttachmentDescriptor::GetHash
constexpr size_t GetHash() const
Definition: formats.h:644
impeller::TextureUsageMask
Mask< TextureUsage > TextureUsageMask
Definition: formats.h:308
impeller::IsMultisampleCapable
constexpr bool IsMultisampleCapable(TextureType type)
Definition: formats.h:283
impeller::CompareFunction::kAlways
@ kAlways
Comparison test passes always passes.
impeller::DepthRange
Definition: formats.h:388
impeller::TextureType::kTexture2D
@ kTexture2D
impeller::StencilOperation::kZero
@ kZero
Reset the stencil value to zero.
impeller::PixelFormat::kR32G32B32A32Float
@ kR32G32B32A32Float
impeller::TextureUsageMaskToString
std::string TextureUsageMaskToString(TextureUsageMask mask)
Definition: formats.cc:81
impeller::TextureUsage::kUnknown
@ kUnknown
impeller::PixelFormat::kUnknown
@ kUnknown
impeller::CompareFunction::kNever
@ kNever
Comparison test never passes.
std::hash< impeller::StencilAttachmentDescriptor >::operator()
constexpr std::size_t operator()(const impeller::StencilAttachmentDescriptor &des) const
Definition: formats.h:693
scalar.h
impeller::ColorAttachmentDescriptor::src_alpha_blend_factor
BlendFactor src_alpha_blend_factor
Definition: formats.h:520
impeller::Viewport
Definition: formats.h:397
impeller::CullMode::kFrontFace
@ kFrontFace
impeller::ColorWriteMaskBits::kAlpha
@ kAlpha
impeller::ColorAttachmentDescriptor::dst_color_blend_factor
BlendFactor dst_color_blend_factor
Definition: formats.h:518
impeller::TextureTypeToString
constexpr const char * TextureTypeToString(TextureType type)
Definition: formats.h:269
impeller::BlendOperation
BlendOperation
Definition: formats.h:196
impeller::ColorAttachmentDescriptor::dst_alpha_blend_factor
BlendFactor dst_alpha_blend_factor
Definition: formats.h:522
impeller::Attachment::resolve_texture
std::shared_ptr< Texture > resolve_texture
Definition: formats.h:652
impeller::MipFilter::kBase
@ kBase
The texture is sampled as if it only had a single mipmap level.
impeller::PixelFormat::kR8G8B8A8UNormIntSRGB
@ kR8G8B8A8UNormIntSRGB
impeller::SamplerAddressMode::kMirror
@ kMirror
std
Definition: comparable.h:95
impeller::DepthAttachmentToString
std::string DepthAttachmentToString(const DepthAttachment &depth)
Definition: formats.cc:130
impeller::LoadAction::kDontCare
@ kDontCare
rect.h
impeller::DepthAttachmentDescriptor
Definition: formats.h:584
impeller::Color::BlackTransparent
static constexpr Color BlackTransparent()
Definition: color.h:272
impeller::StencilAttachmentDescriptor
Definition: formats.h:604
impeller::SampleCount
SampleCount
Definition: formats.h:295
impeller::Attachment::load_action
LoadAction load_action
Definition: formats.h:653
impeller::BlendFactor::kOneMinusSourceColor
@ kOneMinusSourceColor
impeller::ColorWriteMaskBits::kRed
@ kRed
impeller::MipFilter::kLinear
@ kLinear
Sample from the two nearest mip levels and linearly interpolate.
impeller::TextureUsage::kShaderRead
@ kShaderRead
impeller::ColorWriteMaskBits::kBlue
@ kBlue
impeller::Viewport::operator==
constexpr bool operator==(const Viewport &other) const
Definition: formats.h:401
impeller::Attachment::IsValid
bool IsValid() const
Definition: formats.cc:26
color.h
impeller::ColorAttachmentDescriptor::operator==
constexpr bool operator==(const ColorAttachmentDescriptor &o) const
Definition: formats.h:526
impeller::DepthAttachment::clear_depth
double clear_depth
Definition: formats.h:664
impeller::SampleCount::kCount1
@ kCount1
impeller::SampleCount::kCount4
@ kCount4
color
DlColor color
Definition: dl_golden_blur_unittests.cc:23
impeller::PolygonMode::kLine
@ kLine
impeller::StoreActionToString
constexpr const char * StoreActionToString(StoreAction action)
Definition: formats.h:226
impeller::DepthAttachment
Definition: formats.h:663
impeller::ColorAttachmentDescriptor::color_blend_op
BlendOperation color_blend_op
Definition: formats.h:517
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::TextureUsageToString
constexpr const char * TextureUsageToString(TextureUsage usage)
Definition: formats.h:310
impeller::CompareFunction::kLess
@ kLess
Comparison test passes if new_value < current_value.
impeller
Definition: aiks_blend_unittests.cc:18
impeller::StencilAttachmentToString
std::string StencilAttachmentToString(const StencilAttachment &stencil)
Definition: formats.cc:137
impeller::ColorAttachmentDescriptor::blending_enabled
bool blending_enabled
Definition: formats.h:514
impeller::BlendOperation::kSubtract
@ kSubtract
impeller::IndexType::kUnknown
@ kUnknown
impeller::TRect< Scalar >
impeller::IMPELLER_ENUM_IS_MASK
IMPELLER_ENUM_IS_MASK(MyMaskBits)
impeller::BlendFactor::kOneMinusDestinationAlpha
@ kOneMinusDestinationAlpha
impeller::DepthAttachmentDescriptor::depth_compare
CompareFunction depth_compare
Definition: formats.h:588
impeller::ColorAttachmentDescriptor::write_mask
ColorWriteMask write_mask
Definition: formats.h:524
impeller::ColorAttachmentDescriptor
Describe the color attachment that will be used with this pipeline.
Definition: formats.h:512
impeller::SamplerAddressMode::kRepeat
@ kRepeat
impeller::SamplerAddressMode::kDecal
@ kDecal
decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddre...