diff options
author | Greg Daniel <egdaniel@google.com> | 2018-03-08 15:27:36 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-08 21:05:21 +0000 |
commit | 4684f82ebca85d4c7043e5c1028e34cf5631da32 (patch) | |
tree | 6e640d1b212ab614fa19ccd4e43c5adff440dacd /src/gpu/GrResourceAllocator.cpp | |
parent | 3adc12213b2d1efbe417476517ff3381af17a311 (diff) |
Add ability to uninstantiate lazy proxies after every flush.
Bug: skia:
Change-Id: Id32540cda54a9c5e3e6cb721776699be3cc8ac1a
Reviewed-on: https://skia-review.googlesource.com/113263
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrResourceAllocator.cpp')
-rw-r--r-- | src/gpu/GrResourceAllocator.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gpu/GrResourceAllocator.cpp b/src/gpu/GrResourceAllocator.cpp index f41169c110..d3895073aa 100644 --- a/src/gpu/GrResourceAllocator.cpp +++ b/src/gpu/GrResourceAllocator.cpp @@ -16,6 +16,7 @@ #include "GrSurfaceProxy.h" #include "GrSurfaceProxyPriv.h" #include "GrTextureProxy.h" +#include "GrUninstantiateProxyTracker.h" void GrResourceAllocator::Interval::assign(sk_sp<GrSurface> s) { SkASSERT(!fAssignedSurface); @@ -200,7 +201,9 @@ void GrResourceAllocator::expire(unsigned int curIndex) { } } -bool GrResourceAllocator::assign(int* startIndex, int* stopIndex, AssignError* outError) { +bool GrResourceAllocator::assign(int* startIndex, int* stopIndex, + GrUninstantiateProxyTracker* uninstantiateTracker, + AssignError* outError) { SkASSERT(outError); *outError = AssignError::kNoError; @@ -252,6 +255,11 @@ bool GrResourceAllocator::assign(int* startIndex, int* stopIndex, AssignError* o if (GrSurfaceProxy::LazyState::kNot != cur->proxy()->lazyInstantiationState()) { if (!cur->proxy()->priv().doLazyInstantiation(fResourceProvider)) { *outError = AssignError::kFailedProxyInstantiation; + } else { + if (GrSurfaceProxy::LazyInstantiationType::kUninstantiate == + cur->proxy()->priv().lazyInstantiationType()) { + uninstantiateTracker->addProxy(cur->proxy()); + } } } else if (sk_sp<GrSurface> surface = this->findSurfaceFor(cur->proxy(), needsStencil)) { // TODO: make getUniqueKey virtual on GrSurfaceProxy |