| Flutter Impeller |

Public Member Functions | Public Attributes | List of all members
impeller::ColorAttachmentDescriptor Struct Reference

Describe the color attachment that will be used with this pipeline. More...

`#include <formats.h>`

## Public Member Functions
constexpr bool | operator== (const ColorAttachmentDescriptor &o) const
constexpr size_t | Hash () const

## Public Attributes
PixelFormat | format = PixelFormat::kUnknown
bool | blending_enabled = false
BlendFactor | src_color_blend_factor = BlendFactor::kSourceAlpha
BlendOperation | color_blend_op = BlendOperation::kAdd
BlendFactor | dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha
BlendFactor | src_alpha_blend_factor = BlendFactor::kSourceAlpha
BlendOperation | alpha_blend_op = BlendOperation::kAdd
BlendFactor | dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha
ColorWriteMask | write_mask = ColorWriteMaskBits::kAll

## Detailed Description

Describe the color attachment that will be used with this pipeline.

Blending at specific color attachments follows the pseudo-code:

if (blending_enabled) {
final_color.rgb = (src_color_blend_factor * new_color.rgb)
<color_blend_op>
(dst_color_blend_factor * old_color.rgb);
final_color.a = (src_alpha_blend_factor * new_color.a)
<alpha_blend_op>
(dst_alpha_blend_factor * old_color.a);
} else {
final_color = new_color;
}
// IMPORTANT: The write mask is applied irrespective of whether
// blending_enabled is set.
final_color = final_color & write_mask;

The default blend mode is 1 - source alpha.

Definition at line 518 of file formats.h.

## Member Function Documentation

## ◆ Hash()

constexpr size_t impeller::ColorAttachmentDescriptor::Hash | ( |  | ) | const
| inlineconstexpr

Definition at line 544 of file formats.h.

544 {
545 return fml::HashCombine(
546 format, blending_enabled, src_color_blend_factor, color_blend_op,
547 dst_color_blend_factor, src_alpha_blend_factor, alpha_blend_op,
548 dst_alpha_blend_factor, static_cast<uint64_t>(write_mask));
549 }

References alpha_blend_op, blending_enabled, color_blend_op, dst_alpha_blend_factor, dst_color_blend_factor, format, src_alpha_blend_factor, src_color_blend_factor, and write_mask.

## ◆ operator==()

constexpr bool impeller::ColorAttachmentDescriptor::operator== | ( | const ColorAttachmentDescriptor & | o | ) | const
| inlineconstexpr

Definition at line 532 of file formats.h.

532 {
533 return format == o.format && //
534 blending_enabled == o.blending_enabled && //
535 src_color_blend_factor == o.src_color_blend_factor && //
536 color_blend_op == o.color_blend_op && //
537 dst_color_blend_factor == o.dst_color_blend_factor && //
538 src_alpha_blend_factor == o.src_alpha_blend_factor && //
539 alpha_blend_op == o.alpha_blend_op && //
540 dst_alpha_blend_factor == o.dst_alpha_blend_factor && //
541 write_mask == o.write_mask;
542 }

References alpha_blend_op, blending_enabled, color_blend_op, dst_alpha_blend_factor, dst_color_blend_factor, format, src_alpha_blend_factor, src_color_blend_factor, and write_mask.

## Member Data Documentation

## ◆ alpha_blend_op

BlendOperation impeller::ColorAttachmentDescriptor::alpha_blend_op = BlendOperation::kAdd

Definition at line 527 of file formats.h.

Referenced by impeller::ContentContextOptions::ApplyToPipelineDescriptor(), Hash(), operator==(), impeller::ToMTLRenderPipelineColorAttachmentDescriptor(), and impeller::ToVKPipelineColorBlendAttachmentState().

## ◆ blending_enabled

bool impeller::ColorAttachmentDescriptor::blending_enabled = false

Definition at line 520 of file formats.h.

Referenced by impeller::ContentContextOptions::ApplyToPipelineDescriptor(), Hash(), impeller::PipelineBuilder< VertexShader_, FragmentShader_ >::InitializePipelineDescriptorDefaults(), operator==(), impeller::ToMTLRenderPipelineColorAttachmentDescriptor(), and impeller::ToVKPipelineColorBlendAttachmentState().

## ◆ color_blend_op

BlendOperation impeller::ColorAttachmentDescriptor::color_blend_op = BlendOperation::kAdd

Definition at line 523 of file formats.h.

Referenced by impeller::ContentContextOptions::ApplyToPipelineDescriptor(), Hash(), operator==(), impeller::ToMTLRenderPipelineColorAttachmentDescriptor(), and impeller::ToVKPipelineColorBlendAttachmentState().

## ◆ dst_alpha_blend_factor

BlendFactor impeller::ColorAttachmentDescriptor::dst_alpha_blend_factor = BlendFactor::kOneMinusSourceAlpha

Definition at line 528 of file formats.h.

Referenced by impeller::ContentContextOptions::ApplyToPipelineDescriptor(), Hash(), operator==(), impeller::ToMTLRenderPipelineColorAttachmentDescriptor(), and impeller::ToVKPipelineColorBlendAttachmentState().

## ◆ dst_color_blend_factor

BlendFactor impeller::ColorAttachmentDescriptor::dst_color_blend_factor = BlendFactor::kOneMinusSourceAlpha

Definition at line 524 of file formats.h.

Referenced by impeller::ContentContextOptions::ApplyToPipelineDescriptor(), Hash(), operator==(), impeller::ToMTLRenderPipelineColorAttachmentDescriptor(), and impeller::ToVKPipelineColorBlendAttachmentState().

## ◆ format

PixelFormat impeller::ColorAttachmentDescriptor::format = PixelFormat::kUnknown

Definition at line 519 of file formats.h.

Referenced by impeller::ContentContextOptions::ApplyToPipelineDescriptor(), Hash(), impeller::PipelineBuilder< VertexShader_, FragmentShader_ >::InitializePipelineDescriptorDefaults(), operator==(), impeller::testing::TEST_P(), and impeller::ToMTLRenderPipelineColorAttachmentDescriptor().

## ◆ src_alpha_blend_factor

BlendFactor impeller::ColorAttachmentDescriptor::src_alpha_blend_factor = BlendFactor::kSourceAlpha

Definition at line 526 of file formats.h.

Referenced by impeller::ContentContextOptions::ApplyToPipelineDescriptor(), Hash(), operator==(), impeller::ToMTLRenderPipelineColorAttachmentDescriptor(), and impeller::ToVKPipelineColorBlendAttachmentState().

## ◆ src_color_blend_factor

BlendFactor impeller::ColorAttachmentDescriptor::src_color_blend_factor = BlendFactor::kSourceAlpha

Definition at line 522 of file formats.h.

Referenced by impeller::ContentContextOptions::ApplyToPipelineDescriptor(), Hash(), operator==(), impeller::ToMTLRenderPipelineColorAttachmentDescriptor(), and impeller::ToVKPipelineColorBlendAttachmentState().

## ◆ write_mask

ColorWriteMask impeller::ColorAttachmentDescriptor::write_mask = ColorWriteMaskBits::kAll

Definition at line 530 of file formats.h.

Referenced by impeller::ContentContextOptions::ApplyToPipelineDescriptor(), Hash(), operator==(), impeller::ToMTLRenderPipelineColorAttachmentDescriptor(), and impeller::ToVKPipelineColorBlendAttachmentState().

The documentation for this struct was generated from the following file:

- impeller/core/formats.h

impeller::ColorAttachmentDescriptor::src_color_blend_factor
BlendFactor src_color_blend_factor
Definition: formats.h:522
impeller::ColorAttachmentDescriptor::alpha_blend_op
BlendOperation alpha_blend_op
Definition: formats.h:527
impeller::ColorAttachmentDescriptor::format
PixelFormat format
Definition: formats.h:519
impeller::ColorAttachmentDescriptor::src_alpha_blend_factor
BlendFactor src_alpha_blend_factor
Definition: formats.h:526
impeller::ColorAttachmentDescriptor::dst_color_blend_factor
BlendFactor dst_color_blend_factor
Definition: formats.h:524
impeller::ColorAttachmentDescriptor::dst_alpha_blend_factor
BlendFactor dst_alpha_blend_factor
Definition: formats.h:528
impeller::ColorAttachmentDescriptor::color_blend_op
BlendOperation color_blend_op
Definition: formats.h:523
impeller::ColorAttachmentDescriptor::blending_enabled
bool blending_enabled
Definition: formats.h:520
impeller::ColorAttachmentDescriptor::write_mask
ColorWriteMask write_mask
Definition: formats.h:530