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