#include <entity_pass.h>
Public Types | |
| using | Element = std::variant< Entity, std::unique_ptr< EntityPass > > |
| using | BackdropFilterProc = std::function< std::shared_ptr< FilterContents >(FilterInput::Ref, const Matrix &effect_transform, Entity::RenderingMode rendering_mode)> |
Public Member Functions | |
| EntityPass () | |
| ~EntityPass () | |
| void | SetDelegate (std::shared_ptr< EntityPassDelegate > delgate) |
| void | SetBoundsLimit (std::optional< Rect > bounds_limit, ContentBoundsPromise bounds_promise=ContentBoundsPromise::kUnknown) |
| Set the bounds limit, which is provided by the user when creating a SaveLayer. This is a hint that allows the user to communicate that it's OK to not render content outside of the bounds. More... | |
| std::optional< Rect > | GetBoundsLimit () const |
| Get the bounds limit, which is provided by the user when creating a SaveLayer. More... | |
| bool | GetBoundsLimitMightClipContent () const |
| Indicates if the bounds limit set using |SetBoundsLimit()| might clip the contents of the pass. More... | |
| bool | GetBoundsLimitIsSnug () const |
| Indicates if the bounds limit set using |SetBoundsLimit()| is a reasonably tight estimate of the bounds of the contents. More... | |
| size_t | GetSubpassesDepth () const |
| void | AddEntity (Entity entity) |
| Add an entity to the current entity pass. More... | |
| void | PushClip (Entity entity) |
| void | PopClips (size_t num_clips, uint64_t depth) |
| void | PopAllClips (uint64_t depth) |
| void | SetElements (std::vector< Element > elements) |
| EntityPass * | AddSubpass (std::unique_ptr< EntityPass > pass) |
| Appends a given pass as a subpass. More... | |
| void | AddSubpassInline (std::unique_ptr< EntityPass > pass) |
| Merges a given pass into this pass. Useful for drawing pre-recorded pictures that don't require rendering into a separate subpass. More... | |
| EntityPass * | GetSuperpass () const |
| bool | Render (ContentContext &renderer, const RenderTarget &render_target) const |
| void | IterateAllElements (const std::function< bool(Element &)> &iterator) |
| Iterate all elements (entities and subpasses) in this pass, recursively including elements of child passes. The iteration order is depth-first. Whenever a subpass elements is encountered, it's included in the stream before its children. More... | |
| void | IterateAllElements (const std::function< bool(const Element &)> &iterator) const |
| void | IterateAllEntities (const std::function< bool(Entity &)> &iterator) |
| Iterate all entities in this pass, recursively including entities of child passes. The iteration order is depth-first. More... | |
| void | IterateAllEntities (const std::function< bool(const Entity &)> &iterator) const |
| Iterate all entities in this pass, recursively including entities of child passes. The iteration order is depth-first and does not allow modification of the entities. More... | |
| bool | IterateUntilSubpass (const std::function< bool(Entity &)> &iterator) |
| Iterate entities in this pass up until the first subpass is found. This is useful for limiting look-ahead optimizations. More... | |
| size_t | GetElementCount () const |
| Return the number of elements on this pass. More... | |
| void | SetTransform (Matrix transform) |
| void | SetClipDepth (size_t clip_depth) |
| size_t | GetClipDepth () const |
| void | SetNewClipDepth (size_t clip_depth) |
| uint32_t | GetNewClipDepth () const |
| void | SetBlendMode (BlendMode blend_mode) |
| std::optional< Color > | GetClearColor (ISize size=ISize::Infinite()) const |
| Return the premultiplied clear color of the pass entities, if any. More... | |
| Color | GetClearColorOrDefault (ISize size=ISize::Infinite()) const |
| Return the premultiplied clear color of the pass entities. More... | |
| void | SetBackdropFilter (BackdropFilterProc proc) |
| void | SetEnableOffscreenCheckerboard (bool enabled) |
| int32_t | GetRequiredMipCount () const |
| void | SetRequiredMipCount (int32_t mip_count) |
| std::optional< Rect > | GetSubpassCoverage (const EntityPass &subpass, std::optional< Rect > coverage_limit) const |
| Computes the coverage of a given subpass. This is used to determine the texture size of a given subpass before it's rendered to and passed through the subpass ImageFilter, if any. More... | |
| std::optional< Rect > | GetElementsCoverage (std::optional< Rect > coverage_limit) const |
Static Public Attributes | |
| static const std::string | kCaptureDocumentName = "EntityPass" |
Definition at line 43 of file entity_pass.h.
| using impeller::EntityPass::BackdropFilterProc = std::function<std::shared_ptr<FilterContents>( FilterInput::Ref, const Matrix& effect_transform, Entity::RenderingMode rendering_mode)> |
Definition at line 61 of file entity_pass.h.
| using impeller::EntityPass::Element = std::variant<Entity, std::unique_ptr<EntityPass> > |
Elements are renderable items in the EntityPass. Each can either be an Entity or a child EntityPass.
When the element is a child EntityPass, it may be rendered to an offscreen texture and converted into an Entity that draws the texture into the current pass, or its children may be collapsed into the current
EntityPass. Elements are converted to Entities in GetEntityForElement().
Definition at line 54 of file entity_pass.h.
|
default |
|
default |
| void impeller::EntityPass::AddEntity | ( | Entity | entity | ) |
Add an entity to the current entity pass.
Definition at line 106 of file entity_pass.cc.
References impeller::Entity::GetBlendMode(), impeller::Entity::GetContents(), impeller::Entity::kLastPipelineBlendMode, impeller::kSource, impeller::kSourceOver, and impeller::Entity::SetBlendMode().
Referenced by impeller::testing::TEST_P().
| EntityPass * impeller::EntityPass::AddSubpass | ( | std::unique_ptr< EntityPass > | pass | ) |
Appends a given pass as a subpass.
Definition at line 272 of file entity_pass.cc.
References impeller::Entity::kLastPipelineBlendMode.
Referenced by impeller::testing::TEST_P().
| void impeller::EntityPass::AddSubpassInline | ( | std::unique_ptr< EntityPass > | pass | ) |
Merges a given pass into this pass. Useful for drawing pre-recorded pictures that don't require rendering into a separate subpass.
Definition at line 291 of file entity_pass.cc.
| std::optional< Rect > impeller::EntityPass::GetBoundsLimit | ( | ) | const |
Get the bounds limit, which is provided by the user when creating a SaveLayer.
Definition at line 71 of file entity_pass.cc.
| bool impeller::EntityPass::GetBoundsLimitIsSnug | ( | ) | const |
Indicates if the bounds limit set using |SetBoundsLimit()| is a reasonably tight estimate of the bounds of the contents.
Definition at line 94 of file entity_pass.cc.
References impeller::kContainsContents, impeller::kMayClipContents, and impeller::kUnknown.
Referenced by GetSubpassCoverage().
| bool impeller::EntityPass::GetBoundsLimitMightClipContent | ( | ) | const |
Indicates if the bounds limit set using |SetBoundsLimit()| might clip the contents of the pass.
Definition at line 75 of file entity_pass.cc.
References impeller::kContainsContents, impeller::kMayClipContents, and impeller::kUnknown.
Referenced by impeller::OpacityPeepholePassDelegate::CanCollapseIntoParentPass().
| std::optional< Color > impeller::EntityPass::GetClearColor | ( | ISize | size = ISize::Infinite() | ) | const |
Return the premultiplied clear color of the pass entities, if any.
Definition at line 1187 of file entity_pass.cc.
References impeller::Color::BlackTransparent().
Referenced by GetClearColorOrDefault().
| Color impeller::EntityPass::GetClearColorOrDefault | ( | ISize | size = ISize::Infinite() | ) | const |
Return the premultiplied clear color of the pass entities.
If the entity pass has no clear color, this will return transparent black.
Definition at line 1183 of file entity_pass.cc.
References impeller::Color::BlackTransparent(), and GetClearColor().
Referenced by Render().
| size_t impeller::EntityPass::GetClipDepth | ( | ) | const |
Definition at line 1166 of file entity_pass.cc.
| size_t impeller::EntityPass::GetElementCount | ( | ) | const |
Return the number of elements on this pass.
Definition at line 1154 of file entity_pass.cc.
Referenced by impeller::OpacityPeepholePassDelegate::CanCollapseIntoParentPass().
| std::optional< Rect > impeller::EntityPass::GetElementsCoverage | ( | std::optional< Rect > | coverage_limit | ) | const |
Definition at line 160 of file entity_pass.cc.
References GetSubpassCoverage(), impeller::TRect< Scalar >::Intersection(), impeller::Entity::kSubpass, impeller::FilterInput::Make(), impeller::Entity::SetTransform(), impeller::TRect< Scalar >::Union(), and VALIDATION_LOG.
Referenced by GetSubpassCoverage(), and impeller::testing::TEST_P().
| uint32_t impeller::EntityPass::GetNewClipDepth | ( | ) | const |
Definition at line 1174 of file entity_pass.cc.
|
inline |
Definition at line 186 of file entity_pass.h.
Referenced by Render().
| std::optional< Rect > impeller::EntityPass::GetSubpassCoverage | ( | const EntityPass & | subpass, |
| std::optional< Rect > | coverage_limit | ||
| ) | const |
Computes the coverage of a given subpass. This is used to determine the texture size of a given subpass before it's rendered to and passed through the subpass ImageFilter, if any.
| [in] | subpass | The EntityPass for which to compute pre-filteredcoverage. |
| [in] | coverage_limit | Confines coverage to a specified area. This hint is used to trim coverage to the root framebuffer area. std::nullopt means there is no limit. |
std::nullopt means rendering the subpass will have no effect on the color attachment. Definition at line 236 of file entity_pass.cc.
References GetBoundsLimitIsSnug(), and GetElementsCoverage().
Referenced by GetElementsCoverage(), and impeller::testing::TEST_P().
| size_t impeller::EntityPass::GetSubpassesDepth | ( | ) | const |
Definition at line 149 of file entity_pass.cc.
| EntityPass * impeller::EntityPass::GetSuperpass | ( | ) | const |
Definition at line 268 of file entity_pass.cc.
Referenced by impeller::Canvas::Restore().
| void impeller::EntityPass::IterateAllElements | ( | const std::function< bool(const Element &)> & | iterator | ) | const |
TODO(gaaclarke): Remove duplication here between const and non-const versions.
Definition at line 1074 of file entity_pass.cc.
References IterateAllElements().
| void impeller::EntityPass::IterateAllElements | ( | const std::function< bool(Element &)> & | iterator | ) |
Iterate all elements (entities and subpasses) in this pass, recursively including elements of child passes. The iteration order is depth-first. Whenever a subpass elements is encountered, it's included in the stream before its children.
Definition at line 1058 of file entity_pass.cc.
Referenced by IterateAllElements().
| void impeller::EntityPass::IterateAllEntities | ( | const std::function< bool(const Entity &)> & | iterator | ) | const |
Iterate all entities in this pass, recursively including entities of child passes. The iteration order is depth-first and does not allow modification of the entities.
Definition at line 1114 of file entity_pass.cc.
References IterateAllEntities().
| void impeller::EntityPass::IterateAllEntities | ( | const std::function< bool(Entity &)> & | iterator | ) |
Iterate all entities in this pass, recursively including entities of child passes. The iteration order is depth-first.
Definition at line 1093 of file entity_pass.cc.
Referenced by IterateAllEntities(), and Render().
| bool impeller::EntityPass::IterateUntilSubpass | ( | const std::function< bool(Entity &)> & | iterator | ) |
Iterate entities in this pass up until the first subpass is found. This is useful for limiting look-ahead optimizations.
Definition at line 1136 of file entity_pass.cc.
Referenced by impeller::OpacityPeepholePassDelegate::CanCollapseIntoParentPass().
| void impeller::EntityPass::PopAllClips | ( | uint64_t | depth | ) |
Definition at line 141 of file entity_pass.cc.
References PopClips().
Referenced by impeller::EntityPlayground::OpenPlaygroundHere().
| void impeller::EntityPass::PopClips | ( | size_t | num_clips, |
| uint64_t | depth | ||
| ) |
Definition at line 123 of file entity_pass.cc.
References impeller::Entity::SetNewClipDepth(), and VALIDATION_LOG.
Referenced by PopAllClips(), and impeller::Canvas::Restore().
| void impeller::EntityPass::PushClip | ( | Entity | entity | ) |
Definition at line 118 of file entity_pass.cc.
| bool impeller::EntityPass::Render | ( | ContentContext & | renderer, |
| const RenderTarget & | render_target | ||
| ) | const |
Definition at line 376 of file entity_pass.cc.
References impeller::CreateRenderTarget(), GetClearColorOrDefault(), impeller::Entity::GetContents(), impeller::ContentContext::GetContext(), impeller::ContentContext::GetDeviceCapabilities(), impeller::ContentContext::GetLazyGlyphAtlas(), impeller::EntityPassTarget::GetRenderTarget(), impeller::ContentContext::GetRenderTargetCache(), impeller::RenderTarget::GetRenderTargetSize(), impeller::RenderTarget::GetRenderTargetTexture(), GetRequiredMipCount(), IterateAllEntities(), kCaptureDocumentName, impeller::kDefaultStencilConfig, impeller::kSource, impeller::TextureContents::MakeRect(), impeller::TRect< Scalar >::MakeSize(), impeller::Entity::Render(), impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), impeller::Capabilities::SupportsImplicitResolvingMSAA(), impeller::Capabilities::SupportsReadFromResolve(), and VALIDATION_LOG.
Referenced by impeller::EntityPlayground::OpenPlaygroundHere().
| void impeller::EntityPass::SetBackdropFilter | ( | BackdropFilterProc | proc | ) |
| void impeller::EntityPass::SetBlendMode | ( | BlendMode | blend_mode | ) |
Definition at line 1178 of file entity_pass.cc.
References impeller::Entity::IsBlendModeDestructive().
| void impeller::EntityPass::SetBoundsLimit | ( | std::optional< Rect > | bounds_limit, |
| ContentBoundsPromise | bounds_promise = ContentBoundsPromise::kUnknown |
||
| ) |
Set the bounds limit, which is provided by the user when creating a SaveLayer. This is a hint that allows the user to communicate that it's OK to not render content outside of the bounds.
For consistency with Skia, we effectively treat this like a rectangle clip by forcing the subpass texture size to never exceed it.
The entity pass will assume that these bounds cause a clipping effect on the layer unless this call is followed up with a call to |SetBoundsClipsContent()| specifying otherwise.
Definition at line 64 of file entity_pass.cc.
References impeller::kUnknown.
| void impeller::EntityPass::SetClipDepth | ( | size_t | clip_depth | ) |
Definition at line 1162 of file entity_pass.cc.
| void impeller::EntityPass::SetDelegate | ( | std::shared_ptr< EntityPassDelegate > | delgate | ) |
Definition at line 57 of file entity_pass.cc.
| void impeller::EntityPass::SetElements | ( | std::vector< Element > | elements | ) |
Definition at line 145 of file entity_pass.cc.
| void impeller::EntityPass::SetEnableOffscreenCheckerboard | ( | bool | enabled | ) |
Definition at line 1217 of file entity_pass.cc.
| void impeller::EntityPass::SetNewClipDepth | ( | size_t | clip_depth | ) |
Definition at line 1170 of file entity_pass.cc.
Referenced by impeller::Canvas::Restore().
|
inline |
Definition at line 188 of file entity_pass.h.
| void impeller::EntityPass::SetTransform | ( | Matrix | transform | ) |
Definition at line 1158 of file entity_pass.cc.
|
static |
Definition at line 56 of file entity_pass.h.
Referenced by Render().