An implementation of the [RenderTargetAllocator] that caches all allocated texture data for one frame. More...
#include <render_target_cache.h>
Public Member Functions | |
RenderTargetCache (std::shared_ptr< Allocator > allocator, uint32_t keep_alive_frame_count=4) | |
~RenderTargetCache ()=default | |
void | Start () override |
Mark the beginning of a frame workload. More... | |
void | End () override |
Mark the end of a frame workload. More... | |
void | DisableCache () override |
Disable any caching until the next call to EnabledCache . More... | |
void | EnableCache () override |
Re-enable any caching if disabled. More... | |
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 |
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 |
size_t | CachedTextureCount () const |
std::vector< RenderTargetData >::const_iterator | GetRenderTargetDataBegin () const |
Visible for testing. More... | |
std::vector< RenderTargetData >::const_iterator | GetRenderTargetDataEnd () const |
Visible for testing. More... | |
![]() | |
RenderTargetAllocator (std::shared_ptr< Allocator > allocator) | |
virtual | ~RenderTargetAllocator ()=default |
An implementation of the [RenderTargetAllocator] that caches all allocated texture data for one frame.
Any textures unused after a frame are immediately discarded.
Definition at line 18 of file render_target_cache.h.
|
explicit |
Definition at line 11 of file render_target_cache.cc.
|
default |
size_t impeller::RenderTargetCache::CachedTextureCount | ( | ) | const |
Definition at line 164 of file render_target_cache.cc.
|
overridevirtual |
Reimplemented from impeller::RenderTargetAllocator.
Definition at line 54 of file render_target_cache.cc.
References impeller::RenderTargetAllocator::CreateOffscreen(), impeller::TSize< T >::IsEmpty(), impeller::RenderTarget::IsValid(), impeller::RenderTargetConfig::size, and impeller::Attachment::texture.
|
overridevirtual |
Reimplemented from impeller::RenderTargetAllocator.
Definition at line 108 of file render_target_cache.cc.
References impeller::RenderTargetAllocator::CreateOffscreenMSAA(), impeller::TSize< T >::IsEmpty(), impeller::RenderTarget::IsValid(), impeller::Attachment::resolve_texture, impeller::RenderTargetConfig::size, and impeller::Attachment::texture.
|
overridevirtual |
Disable any caching until the next call to EnabledCache
.
Reimplemented from impeller::RenderTargetAllocator.
Definition at line 38 of file render_target_cache.cc.
|
overridevirtual |
Re-enable any caching if disabled.
Reimplemented from impeller::RenderTargetAllocator.
Definition at line 46 of file render_target_cache.cc.
|
overridevirtual |
Mark the end of a frame workload.
This may be used to deallocate any unused textures.
Reimplemented from impeller::RenderTargetAllocator.
Definition at line 23 of file render_target_cache.cc.
|
inline |
Visible for testing.
Definition at line 87 of file render_target_cache.h.
|
inline |
Visible for testing.
Definition at line 93 of file render_target_cache.h.
|
overridevirtual |
Mark the beginning of a frame workload.
This may be used to reset any tracking state on whether or not a particular texture instance is still in use.
Reimplemented from impeller::RenderTargetAllocator.
Definition at line 16 of file render_target_cache.cc.