5 #ifndef FLUTTER_IMPELLER_ENTITY_RENDER_TARGET_CACHE_H_
6 #define FLUTTER_IMPELLER_ENTITY_RENDER_TARGET_CACHE_H_
21 uint32_t keep_alive_frame_count = 4);
26 void Start()
override;
41 std::string_view label =
"Offscreen",
44 std::optional<RenderTarget::AttachmentConfig> stencil_attachment_config =
46 const std::shared_ptr<Texture>& existing_color_texture =
nullptr,
47 const std::shared_ptr<Texture>& existing_depth_stencil_texture =
54 std::string_view label =
"Offscreen MSAA",
57 std::optional<RenderTarget::AttachmentConfig> stencil_attachment_config =
59 const std::shared_ptr<Texture>& existing_color_msaa_texture =
nullptr,
60 const std::shared_ptr<Texture>& existing_color_resolve_texture =
nullptr,
61 const std::shared_ptr<Texture>& existing_depth_stencil_texture =
68 struct RenderTargetData {
70 uint32_t keep_alive_frame_count;
75 bool CacheEnabled()
const;
77 std::vector<RenderTargetData> render_target_data_;
78 uint32_t keep_alive_frame_count_;
79 uint32_t cache_disabled_count_ = 0;
89 return render_target_data_.begin();
94 return render_target_data_.end();
To do anything rendering related with Impeller, you need a context.
a wrapper around the impeller [Allocator] instance that can be used to provide caching of allocated r...
An implementation of the [RenderTargetAllocator] that caches all allocated texture data for one frame...
RenderTarget CreateOffscreen(const Context &context, ISize size, int mip_count, std::string_view label="Offscreen", RenderTarget::AttachmentConfig color_attachment_config=RenderTarget::kDefaultColorAttachmentConfig, std::optional< RenderTarget::AttachmentConfig > stencil_attachment_config=RenderTarget::kDefaultStencilAttachmentConfig, const std::shared_ptr< Texture > &existing_color_texture=nullptr, const std::shared_ptr< Texture > &existing_depth_stencil_texture=nullptr) override
size_t CachedTextureCount() const
void DisableCache() override
Disable any caching until the next call to EnabledCache.
void EnableCache() override
Re-enable any caching if disabled.
~RenderTargetCache()=default
RenderTargetCache(std::shared_ptr< Allocator > allocator, uint32_t keep_alive_frame_count=4)
std::vector< RenderTargetData >::const_iterator GetRenderTargetDataBegin() const
Visible for testing.
std::vector< RenderTargetData >::const_iterator GetRenderTargetDataEnd() const
Visible for testing.
void End() override
Mark the end of a frame workload.
void Start() override
Mark the beginning of a frame workload.
RenderTarget CreateOffscreenMSAA(const Context &context, ISize size, int mip_count, std::string_view label="Offscreen MSAA", RenderTarget::AttachmentConfigMSAA color_attachment_config=RenderTarget::kDefaultColorAttachmentConfigMSAA, std::optional< RenderTarget::AttachmentConfig > stencil_attachment_config=RenderTarget::kDefaultStencilAttachmentConfig, const std::shared_ptr< Texture > &existing_color_msaa_texture=nullptr, const std::shared_ptr< Texture > &existing_color_resolve_texture=nullptr, const std::shared_ptr< Texture > &existing_depth_stencil_texture=nullptr) override
static constexpr AttachmentConfig kDefaultColorAttachmentConfig
static constexpr AttachmentConfigMSAA kDefaultColorAttachmentConfigMSAA
static constexpr AttachmentConfig kDefaultStencilAttachmentConfig