Flutter Engine
The Flutter Engine
|
Maintains a bounded pool of hardware buffer backed texture sources that can be used as swapchain images. More...
#include <ahb_texture_pool_vk.h>
Classes | |
struct | PoolEntry |
Public Member Functions | |
AHBTexturePoolVK (std::weak_ptr< Context > context, android::HardwareBufferDescriptor desc, size_t max_entries=3u) | |
Create a new (empty) texture pool. More... | |
~AHBTexturePoolVK () | |
AHBTexturePoolVK (const AHBTexturePoolVK &)=delete | |
AHBTexturePoolVK & | operator= (const AHBTexturePoolVK &)=delete |
bool | IsValid () const |
If the pool can create and pool hardware buffer backed texture sources. The only reason valid textures cannot be obtained from a valid pool is because of resource exhaustion. More... | |
PoolEntry | Pop () |
Pops an texture source from the pool. If the pool is empty, a new texture source is created and returned. More... | |
void | Push (std::shared_ptr< AHBTextureSourceVK > texture, fml::UniqueFD render_ready_fence) |
Push a popped texture back into the pool. This also performs a GC. More... | |
void | PerformGC () |
Perform an explicit GC of the pool items. This happens implicitly when a texture source us pushed into the pool but one may be necessary explicitly if there is no push back into the pool for a long time. More... | |
Maintains a bounded pool of hardware buffer backed texture sources that can be used as swapchain images.
The number of cached entries in the texture pool is capped to a caller specified value.
If a previously cached entry cannot be obtained from the pool, a new entry is created. The only case where a valid texture source cannot be obtained is due to resource exhaustion.
Pools are thread-safe.
Definition at line 29 of file ahb_texture_pool_vk.h.
|
explicit |
Create a new (empty) texture pool.
[in] | context | The context whose allocators will be used to create the resources for the texture sources. |
[in] | desc | The descriptor of the hardware buffers that will be used to create the backing stores of the texture sources. |
[in] | max_entries | The maximum entries that will remain cached in the pool. |
Definition at line 11 of file ahb_texture_pool_vk.cc.
|
default |
|
delete |
bool impeller::AHBTexturePoolVK::IsValid | ( | ) | const |
If the pool can create and pool hardware buffer backed texture sources. The only reason valid textures cannot be obtained from a valid pool is because of resource exhaustion.
true
if valid, false
otherwise. Definition at line 93 of file ahb_texture_pool_vk.cc.
|
delete |
void impeller::AHBTexturePoolVK::PerformGC | ( | ) |
Perform an explicit GC of the pool items. This happens implicitly when a texture source us pushed into the pool but one may be necessary explicitly if there is no push back into the pool for a long time.
Definition at line 78 of file ahb_texture_pool_vk.cc.
AHBTexturePoolVK::PoolEntry impeller::AHBTexturePoolVK::Pop | ( | ) |
Pops an texture source from the pool. If the pool is empty, a new texture source is created and returned.
This operation is thread-safe.
Definition at line 27 of file ahb_texture_pool_vk.cc.
void impeller::AHBTexturePoolVK::Push | ( | std::shared_ptr< AHBTextureSourceVK > | texture, |
fml::UniqueFD | render_ready_fence | ||
) |
Push a popped texture back into the pool. This also performs a GC.
This operation is thread-safe.
[in] | texture | The texture to be returned to the pool. |
Definition at line 41 of file ahb_texture_pool_vk.cc.