diff options
author | Chris Dalton <csmartdalton@google.com> | 2017-11-29 22:01:06 -0700 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-30 15:37:12 +0000 |
commit | 706a6ff60c55bee85cff06fc9f8f3764f6e5154b (patch) | |
tree | ce416111dc4101cf58ee12bd7c35007317f33819 /src/gpu/GrResourceAllocator.cpp | |
parent | de2f1dfebd9d28787cdfd77496f365ed3eb6894d (diff) |
Add "lazy" texture proxies
Adds ultra-deferred proxies that are instantiated by a user-supplied
callback during flush.
Bug: skia:7190
Change-Id: I75a7ac6dba953c3b0a99febc203a7f4d2f3789fc
Reviewed-on: https://skia-review.googlesource.com/76461
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrResourceAllocator.cpp')
-rw-r--r-- | src/gpu/GrResourceAllocator.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gpu/GrResourceAllocator.cpp b/src/gpu/GrResourceAllocator.cpp index 0afc0ed8c9..bf46c61e8e 100644 --- a/src/gpu/GrResourceAllocator.cpp +++ b/src/gpu/GrResourceAllocator.cpp @@ -73,6 +73,13 @@ void GrResourceAllocator::addInterval(GrSurfaceProxy* proxy, unsigned int start, fIntvlList.insertByIncreasingStart(newIntvl); fIntvlHash.add(newIntvl); + +#ifdef SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION + // FIXME: remove this once we can do the lazy instantiation from assign instead. + if (proxy->isPendingLazyInstantiation()) { + proxy->priv().doLazyInstantiation(fResourceProvider); + } +#endif } GrResourceAllocator::Interval* GrResourceAllocator::IntervalList::popHead() { @@ -224,8 +231,9 @@ bool GrResourceAllocator::assign(int* startIndex, int* stopIndex) { continue; } - sk_sp<GrSurface> surface = this->findSurfaceFor(cur->proxy(), needsStencil); - if (surface) { + if (cur->proxy()->isPendingLazyInstantiation()) { + cur->proxy()->priv().doLazyInstantiation(fResourceProvider); + } else if (sk_sp<GrSurface> surface = this->findSurfaceFor(cur->proxy(), needsStencil)) { // TODO: make getUniqueKey virtual on GrSurfaceProxy GrTextureProxy* tex = cur->proxy()->asTextureProxy(); if (tex && tex->getUniqueKey().isValid()) { |