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