diff options
author | Brian Osman <brianosman@google.com> | 2017-09-28 10:10:55 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-28 14:46:07 +0000 |
commit | 742f3d02a1c6a916d7e0ed3bedb0b546bbe3c15f (patch) | |
tree | 5232ae60fde957274230f6c0812a4337a34a7f68 /src/gpu/GrOpList.cpp | |
parent | 05572fa6e784b3037e94966c74c8a358348b2245 (diff) |
Make threaded proxy generation MDB-friendly, and defer instantiation
Replaces GrPrepareCallback with GrDeferredProxyUploader, stored directly
on GrTextureProxy. Op lists now store a list of referenced proxies that
are being generated by worker threads. At flush time, iterate over those
proxies, and invoke their uploader.
Lifetime of the uploader object is now tied to the proxy, but the ASAP
upload function will free the proxy's uploader, if it's called.
Bug: skia:
Change-Id: Ieb2c6a805d19990012839a8e103c3ca5b8d3dfc6
Reviewed-on: https://skia-review.googlesource.com/49904
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrOpList.cpp')
-rw-r--r-- | src/gpu/GrOpList.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/gpu/GrOpList.cpp b/src/gpu/GrOpList.cpp index 65d4e73fd0..59e1cd0f23 100644 --- a/src/gpu/GrOpList.cpp +++ b/src/gpu/GrOpList.cpp @@ -8,8 +8,9 @@ #include "GrOpList.h" #include "GrContext.h" -#include "GrPrepareCallback.h" +#include "GrDeferredProxyUploader.h" #include "GrSurfaceProxy.h" +#include "GrTextureProxyPriv.h" #include "SkAtomics.h" @@ -57,17 +58,19 @@ void GrOpList::reset() { } fTarget.reset(); - fPrepareCallbacks.reset(); + fDeferredProxies.reset(); fAuditTrail = nullptr; } -void GrOpList::addPrepareCallback(std::unique_ptr<GrPrepareCallback> callback) { - fPrepareCallbacks.push_back(std::move(callback)); +void GrOpList::instantiateDeferredProxies(GrResourceProvider* resourceProvider) { + for (int i = 0; i < fDeferredProxies.count(); ++i) { + fDeferredProxies[i]->instantiate(resourceProvider); + } } void GrOpList::prepare(GrOpFlushState* flushState) { - for (int i = 0; i < fPrepareCallbacks.count(); ++i) { - (*fPrepareCallbacks[i])(flushState); + for (int i = 0; i < fDeferredProxies.count(); ++i) { + fDeferredProxies[i]->texPriv().scheduleUpload(flushState); } this->onPrepare(flushState); @@ -100,6 +103,12 @@ void GrOpList::addDependency(GrSurfaceProxy* dependedOn, const GrCaps& caps) { opList->makeClosed(caps); } } + + if (GrTextureProxy* textureProxy = dependedOn->asTextureProxy()) { + if (textureProxy->texPriv().isDeferred()) { + fDeferredProxies.push_back(textureProxy); + } + } } #ifdef SK_DEBUG |