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/GrSoftwarePathRenderer.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/GrSoftwarePathRenderer.cpp')
-rw-r--r-- | src/gpu/GrSoftwarePathRenderer.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp index 9f876f1213..cd37dffc39 100644 --- a/src/gpu/GrSoftwarePathRenderer.cpp +++ b/src/gpu/GrSoftwarePathRenderer.cpp @@ -9,10 +9,10 @@ #include "GrAuditTrail.h" #include "GrClip.h" #include "GrContextPriv.h" +#include "GrDeferredProxyUploader.h" #include "GrGpuResourcePriv.h" #include "GrOpFlushState.h" #include "GrOpList.h" -#include "GrPrepareCallback.h" #include "GrResourceProvider.h" #include "GrSWMaskHelper.h" #include "SkMakeUnique.h" @@ -175,7 +175,7 @@ static sk_sp<GrTextureProxy> make_deferred_mask_texture_proxy(GrContext* context namespace { /** - * Payload class for use with GrMaskUploaderPrepareCallback. The software path renderer only draws + * Payload class for use with GrTDeferredProxyUploader. The software path renderer only draws * a single path into the mask texture. This stores all of the information needed by the worker * thread's call to drawShape (see below, in onDrawPath). */ @@ -317,15 +317,9 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) { return false; } - // TODO: I believe the assignUniqueKeyToProxy below used to instantiate the proxy before - // before the draw that used the result was being flushed, so the upload was succeeding. - // With assignUniqueKeyToProxy no longer forcing an instantiation it will have to happen - // explicitly elsewhere. - proxy->instantiate(fResourceProvider); - - auto uploader = skstd::make_unique<GrMaskUploaderPrepareCallback<SoftwarePathData>>( - proxy, *boundsForMask, *args.fViewMatrix, *args.fShape, aa); - GrMaskUploaderPrepareCallback<SoftwarePathData>* uploaderRaw = uploader.get(); + auto uploader = skstd::make_unique<GrTDeferredProxyUploader<SoftwarePathData>>( + *boundsForMask, *args.fViewMatrix, *args.fShape, aa); + GrTDeferredProxyUploader<SoftwarePathData>* uploaderRaw = uploader.get(); auto drawAndUploadMask = [uploaderRaw] { TRACE_EVENT0("skia", "Threaded SW Mask Render"); @@ -337,10 +331,10 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) { } else { SkDEBUGFAIL("Unable to allocate SW mask."); } - uploaderRaw->getSemaphore()->signal(); + uploaderRaw->signalAndFreeData(); }; taskGroup->add(std::move(drawAndUploadMask)); - args.fRenderTargetContext->getOpList()->addPrepareCallback(std::move(uploader)); + proxy->texPriv().setDeferredUploader(std::move(uploader)); } else { GrSWMaskHelper helper; if (!helper.init(*boundsForMask)) { |