![]() |
Flutter Engine
The Flutter Engine
|
#include <ScratchResourceManager.h>
Classes | |
class | PendingUseListener |
Public Member Functions | |
ScratchResourceManager (ResourceProvider *resourceProvider, std::unique_ptr< ProxyReadCountMap >) | |
~ScratchResourceManager () | |
sk_sp< Texture > | getScratchTexture (SkISize, const TextureInfo &, std::string_view label) |
void | returnTexture (sk_sp< Texture >) |
void | pushScope () |
void | popScope () |
void | notifyResourcesConsumed () |
void | markResourceInUse (PendingUseListener *listener) |
int | pendingReadCount (const TextureProxy *proxy) const |
bool | removePendingRead (const TextureProxy *proxy) |
ScratchResourceManager helps coordinate the reuse of resources within a Recording that would not otherwise be returned from the ResourceProvider/Cache because the Recorder is holds usage refs on the resources and they are typically not Shareable.
A ScratchResourceManager maintains a pool of resources that have been handed out for some use case and then been explicitly returned by the original holder. It is up to the callers to return resources in an optimal manner (for best reuse) and not use them after they've been returned for a later task's use. To help callers manage when they can return resources, the manager maintains a stack that corresponds with the depth-first traversal of the tasks during prepareResources() and provides hooks to register listeners that are invoked when tasks read or sample resources.
Once all uninstantiated resources are assigned and prepareResources() succeeds, the ScratchResourceManager can be discarded. The reuse within a Recording's task graph is fixed at that point and remains valid even if the recording is replayed.
Definition at line 75 of file ScratchResourceManager.h.
skgpu::graphite::ScratchResourceManager::ScratchResourceManager | ( | ResourceProvider * | resourceProvider, |
std::unique_ptr< ProxyReadCountMap > | proxyCounts | ||
) |
Definition at line 17 of file ScratchResourceManager.cpp.
|
default |
sk_sp< Texture > skgpu::graphite::ScratchResourceManager::getScratchTexture | ( | SkISize | dimensions, |
const TextureInfo & | info, | ||
std::string_view | label | ||
) |
Definition at line 27 of file ScratchResourceManager.cpp.
void skgpu::graphite::ScratchResourceManager::markResourceInUse | ( | PendingUseListener * | listener | ) |
Definition at line 102 of file ScratchResourceManager.cpp.
void skgpu::graphite::ScratchResourceManager::notifyResourcesConsumed | ( | ) |
Definition at line 85 of file ScratchResourceManager.cpp.
|
inline |
Definition at line 164 of file ScratchResourceManager.h.
void skgpu::graphite::ScratchResourceManager::popScope | ( | ) |
Definition at line 69 of file ScratchResourceManager.cpp.
void skgpu::graphite::ScratchResourceManager::pushScope | ( | ) |
Definition at line 64 of file ScratchResourceManager.cpp.
|
inline |
Definition at line 169 of file ScratchResourceManager.h.
Definition at line 52 of file ScratchResourceManager.cpp.