diff options
author | Robert Phillips <robertphillips@google.com> | 2017-09-13 15:25:47 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-13 19:49:47 +0000 |
commit | 09dfc4759e99229e7c74891a88596e8b9b3d9026 (patch) | |
tree | 29131ab740739a098a8cd19f103a08a711394605 /src | |
parent | b493eebca14aefbd5f22fb5d45ba978b19db4b18 (diff) |
Pull non-substantive changes out of explicit GPU resource allocation CL
Change-Id: Ib6a289553ecd15c722599b7dc0d347a7800801cb
Reviewed-on: https://skia-review.googlesource.com/46284
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrContext.cpp | 13 | ||||
-rw-r--r-- | src/gpu/GrOpList.cpp | 6 | ||||
-rw-r--r-- | src/gpu/GrOpList.h | 2 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetContext.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrResourceAllocator.cpp | 32 | ||||
-rw-r--r-- | src/gpu/GrResourceAllocator.h | 3 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasTextBlob.cpp | 4 |
7 files changed, 51 insertions, 11 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index d05f1976f1..ba26cc844e 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -646,12 +646,6 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src, return false; } - if (!proxyToRead->instantiate(fContext->resourceProvider())) { - return false; - } - - GrSurface* surfaceToRead = proxyToRead->priv().peekSurface(); - if (GrGpu::kRequireDraw_DrawPreference == drawPreference && !didTempDraw) { return false; } @@ -660,6 +654,13 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src, this->flushSurfaceWrites(proxyToRead.get()); configToRead = tempDrawInfo.fReadConfig; } + + if (!proxyToRead->instantiate(fContext->resourceProvider())) { + return false; + } + + GrSurface* surfaceToRead = proxyToRead->priv().peekSurface(); + if (!fContext->fGpu->readPixels(surfaceToRead, proxyToRead->origin(), left, top, width, height, configToRead, buffer, rowBytes)) { return false; diff --git a/src/gpu/GrOpList.cpp b/src/gpu/GrOpList.cpp index 521beea743..17b0f10ebf 100644 --- a/src/gpu/GrOpList.cpp +++ b/src/gpu/GrOpList.cpp @@ -31,6 +31,7 @@ GrOpList::GrOpList(GrResourceProvider* resourceProvider, fTarget.setProxy(sk_ref_sp(surfaceProxy), kWrite_GrIOType); fTarget.get()->setLastOpList(this); +#ifndef MDB_ALLOC_RESOURCES // MDB TODO: remove this! We are currently moving to having all the ops that target // the RT as a dest (e.g., clear, etc.) rely on the opList's 'fTarget' pointer // for the IO Ref. This works well but until they are all swapped over (and none @@ -39,6 +40,7 @@ GrOpList::GrOpList(GrResourceProvider* resourceProvider, // re-use assumptions. fTarget.get()->instantiate(resourceProvider); fTarget.markPendingIO(); +#endif } GrOpList::~GrOpList() { @@ -101,6 +103,10 @@ void GrOpList::addDependency(GrSurfaceProxy* dependedOn, const GrCaps& caps) { } #ifdef SK_DEBUG +bool GrOpList::isInstantiated() const { + return fTarget.get()->priv().isInstantiated(); +} + void GrOpList::dump() const { SkDebugf("--------------------------------------------------------------\n"); SkDebugf("node: %d -> RT: %d\n", fUniqueID, fTarget.get() ? fTarget.get()->uniqueID().asUInt() diff --git a/src/gpu/GrOpList.h b/src/gpu/GrOpList.h index ae6b9a1906..ef21a24f46 100644 --- a/src/gpu/GrOpList.h +++ b/src/gpu/GrOpList.h @@ -98,6 +98,8 @@ public: void setStencilLoadOp(GrLoadOp loadOp) { fStencilLoadOp = loadOp; } protected: + SkDEBUGCODE(bool isInstantiated() const;) + GrSurfaceProxyRef fTarget; GrAuditTrail* fAuditTrail; diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index 561eaef340..4f1ad1279e 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -124,10 +124,12 @@ GrRenderTargetContext::GrRenderTargetContext(GrContext* context, fColorXformFromSRGB = GrColorSpaceXform::Make(srgbColorSpace.get(), fColorSpace.get()); } +#ifndef MDB_ALLOC_RESOURCES // MDB TODO: to ensure all resources still get allocated in the correct order in the hybrid // world we need to get the correct opList here so that it, in turn, can grab and hold // its rendertarget. this->getRTOpList(); +#endif SkDEBUGCODE(this->validate();) } diff --git a/src/gpu/GrResourceAllocator.cpp b/src/gpu/GrResourceAllocator.cpp index 76abe1855c..e5d6dbf360 100644 --- a/src/gpu/GrResourceAllocator.cpp +++ b/src/gpu/GrResourceAllocator.cpp @@ -134,3 +134,35 @@ void GrResourceAllocator::assign() { fActiveIntvls.insertByIncreasingEnd(cur); } } + +#ifdef SK_DEBUG +void GrResourceAllocator::dump() { + unsigned int min = fNumOps+1; + unsigned int max = 0; + for(const Interval* cur = fIntvlList.peekHead(); cur; cur = cur->fNext) { + SkDebugf("{ %d,%d }: [%d, %d]\n", + cur->fProxy->uniqueID().asUInt(), cur->fProxy->underlyingUniqueID().asUInt(), + cur->fStart, cur->fEnd); + if (min > cur->fStart) { + min = cur->fStart; + } + if (max < cur->fEnd) { + max = cur->fEnd; + } + } + + for(const Interval* cur = fIntvlList.peekHead(); cur; cur = cur->fNext) { + SkDebugf("{ %3d,%3d }: ", + cur->fProxy->uniqueID().asUInt(), cur->fProxy->underlyingUniqueID().asUInt()); + for (unsigned int i = min; i <= max; ++i) { + if (i >= cur->fStart && i <= cur->fEnd) { + SkDebugf("x"); + } else { + SkDebugf(" "); + } + } + SkDebugf("\n"); + } +} +#endif + diff --git a/src/gpu/GrResourceAllocator.h b/src/gpu/GrResourceAllocator.h index fcaa3d5c9a..bd0c690a58 100644 --- a/src/gpu/GrResourceAllocator.h +++ b/src/gpu/GrResourceAllocator.h @@ -52,6 +52,7 @@ public: } void assign(); + SkDEBUGCODE(void dump();) private: class Interval; @@ -92,7 +93,7 @@ private: static uint32_t Hash(const uint32_t& key) { return key; } GrSurfaceProxy* fProxy; - uint32_t fProxyID; // This is here b.c. DynamicHash requires a ref to the key + uint32_t fProxyID; // This is here b.c. DynamicHash requires a ref to the key unsigned int fStart; unsigned int fEnd; Interval* fNext; diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp index 823444c972..b88ed9329e 100644 --- a/src/gpu/text/GrAtlasTextBlob.cpp +++ b/src/gpu/text/GrAtlasTextBlob.cpp @@ -298,10 +298,6 @@ inline void GrAtlasTextBlob::flushRun(GrRenderTargetContext* rtc, const GrClip& int lastRun = fRuns[run].fSubRunInfo.count() - 1; for (int subRun = 0; subRun <= lastRun; subRun++) { const Run::SubRunInfo& info = fRuns[run].fSubRunInfo[subRun]; - GrPaint grPaint; - if (!paint.toGrPaint(info.maskFormat(), rtc, viewMatrix, &grPaint)) { - continue; - } int glyphCount = info.glyphCount(); if (0 == glyphCount) { continue; |