diff options
-rw-r--r-- | src/gpu/GrClipStackClip.cpp | 5 | ||||
-rw-r--r-- | src/gpu/GrReducedClip.cpp | 16 | ||||
-rw-r--r-- | src/gpu/GrReducedClip.h | 8 | ||||
-rw-r--r-- | src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp | 8 | ||||
-rw-r--r-- | src/gpu/ccpr/GrCoverageCountingPathRenderer.h | 2 |
5 files changed, 16 insertions, 23 deletions
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp index fe8d10095c..f5c08f07eb 100644 --- a/src/gpu/GrClipStackClip.cpp +++ b/src/gpu/GrClipStackClip.cpp @@ -205,7 +205,8 @@ bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTar } auto* ccpr = context->contextPriv().drawingManager()->getCoverageCountingPathRenderer(); - GrReducedClip reducedClip(*fStack, devBounds, caps, maxWindowRectangles, maxAnalyticFPs, ccpr); + GrReducedClip reducedClip(*fStack, devBounds, caps, maxWindowRectangles, maxAnalyticFPs, + ccpr ? maxAnalyticFPs : 0); if (InitialState::kAllOut == reducedClip.initialState() && reducedClip.maskElements().isEmpty()) { return false; @@ -231,7 +232,7 @@ bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTar // can cause a flush or otherwise change which opList our draw is going into. uint32_t opListID = renderTargetContext->getOpList()->uniqueID(); int rtWidth = renderTargetContext->width(), rtHeight = renderTargetContext->height(); - if (auto clipFPs = reducedClip.finishAndDetachAnalyticFPs(proxyProvider, opListID, + if (auto clipFPs = reducedClip.finishAndDetachAnalyticFPs(ccpr, proxyProvider, opListID, rtWidth, rtHeight)) { out->addCoverageFP(std::move(clipFPs)); } diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp index 9d27f7696e..1c5150c679 100644 --- a/src/gpu/GrReducedClip.cpp +++ b/src/gpu/GrReducedClip.cpp @@ -35,13 +35,14 @@ */ GrReducedClip::GrReducedClip(const SkClipStack& stack, const SkRect& queryBounds, const GrShaderCaps* caps, int maxWindowRectangles, int maxAnalyticFPs, - GrCoverageCountingPathRenderer* ccpr) + int maxCCPRClipPaths) : fCaps(caps) , fMaxWindowRectangles(maxWindowRectangles) , fMaxAnalyticFPs(maxAnalyticFPs) - , fCCPR(fMaxAnalyticFPs ? ccpr : nullptr) { + , fMaxCCPRClipPaths(maxCCPRClipPaths) { SkASSERT(!queryBounds.isEmpty()); SkASSERT(fMaxWindowRectangles <= GrWindowRectangles::kMaxWindows); + SkASSERT(fMaxCCPRClipPaths <= fMaxAnalyticFPs); fHasScissor = false; fAAClipRectGenID = SK_InvalidGenID; @@ -651,7 +652,7 @@ GrReducedClip::ClipResult GrReducedClip::addAnalyticFP(const SkPath& deviceSpace return ClipResult::kClipped; } - if (fCCPR && GrAA::kYes == aa && fCCPR->canMakeClipProcessor(deviceSpacePath)) { + if (fCCPRClipPaths.count() < fMaxCCPRClipPaths && GrAA::kYes == aa) { // Set aside CCPR paths for later. We will create their clip FPs once we know the ID of the // opList they will operate in. SkPath& ccprClipPath = fCCPRClipPaths.push_back(deviceSpacePath); @@ -955,17 +956,18 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context, } std::unique_ptr<GrFragmentProcessor> GrReducedClip::finishAndDetachAnalyticFPs( - GrProxyProvider* proxyProvider, uint32_t opListID, - int rtWidth, int rtHeight) { + GrCoverageCountingPathRenderer* ccpr, GrProxyProvider* proxyProvider, uint32_t opListID, + int rtWidth, int rtHeight) { // Make sure finishAndDetachAnalyticFPs hasn't been called already. SkDEBUGCODE(for (const auto& fp : fAnalyticFPs) { SkASSERT(fp); }) if (!fCCPRClipPaths.empty()) { fAnalyticFPs.reserve(fAnalyticFPs.count() + fCCPRClipPaths.count()); for (const SkPath& ccprClipPath : fCCPRClipPaths) { + SkASSERT(ccpr); SkASSERT(fHasScissor); - auto fp = fCCPR->makeClipProcessor(proxyProvider, opListID, ccprClipPath, fScissor, - rtWidth, rtHeight); + auto fp = ccpr->makeClipProcessor(proxyProvider, opListID, ccprClipPath, fScissor, + rtWidth, rtHeight); fAnalyticFPs.push_back(std::move(fp)); } fCCPRClipPaths.reset(); diff --git a/src/gpu/GrReducedClip.h b/src/gpu/GrReducedClip.h index c3838d8802..87ef3461e5 100644 --- a/src/gpu/GrReducedClip.h +++ b/src/gpu/GrReducedClip.h @@ -27,8 +27,7 @@ public: using ElementList = SkTLList<SkClipStack::Element, 16>; GrReducedClip(const SkClipStack&, const SkRect& queryBounds, const GrShaderCaps* caps, - int maxWindowRectangles = 0, int maxAnalyticFPs = 0, - GrCoverageCountingPathRenderer* = nullptr); + int maxWindowRectangles = 0, int maxAnalyticFPs = 0, int maxCCPRClipPaths = 0); enum class InitialState : bool { kAllIn, @@ -97,7 +96,8 @@ public: * the render target context, surface allocations, and even switching render targets (pre MDB) * may cause flushes or otherwise change which opList the actual draw is going into. */ - std::unique_ptr<GrFragmentProcessor> finishAndDetachAnalyticFPs(GrProxyProvider*, + std::unique_ptr<GrFragmentProcessor> finishAndDetachAnalyticFPs(GrCoverageCountingPathRenderer*, + GrProxyProvider*, uint32_t opListID, int rtWidth, int rtHeight); @@ -135,7 +135,7 @@ private: const GrShaderCaps* fCaps; const int fMaxWindowRectangles; const int fMaxAnalyticFPs; - GrCoverageCountingPathRenderer* const fCCPR; + const int fMaxCCPRClipPaths; InitialState fInitialState; SkIRect fScissor; diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp index b6f5770b35..fa08af5dca 100644 --- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp +++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp @@ -185,13 +185,6 @@ void CCPR::DrawPathsOp::wasRecorded(GrRenderTargetOpList* opList) { fOwningRTPendingPaths->fDrawOps.addToTail(this); } -bool GrCoverageCountingPathRenderer::canMakeClipProcessor(const SkPath& deviceSpacePath) const { - if (!fDrawCachablePaths && !deviceSpacePath.isVolatile()) { - return false; - } - return true; -} - std::unique_ptr<GrFragmentProcessor> GrCoverageCountingPathRenderer::makeClipProcessor( GrProxyProvider* proxyProvider, uint32_t opListID, const SkPath& deviceSpacePath, const SkIRect& accessRect, @@ -199,7 +192,6 @@ std::unique_ptr<GrFragmentProcessor> GrCoverageCountingPathRenderer::makeClipPro using MustCheckBounds = GrCCClipProcessor::MustCheckBounds; SkASSERT(!fFlushing); - SkASSERT(this->canMakeClipProcessor(deviceSpacePath)); ClipPath& clipPath = fRTPendingPathsMap[opListID].fClipPaths[deviceSpacePath.getGenerationID()]; if (clipPath.isUninitialized()) { diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h index ba214f5843..da3c2e7086 100644 --- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h +++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h @@ -183,8 +183,6 @@ public: SkDEBUGCODE(bool fHasAtlasTransform = false); }; - bool canMakeClipProcessor(const SkPath& deviceSpacePath) const; - std::unique_ptr<GrFragmentProcessor> makeClipProcessor(GrProxyProvider*, uint32_t oplistID, const SkPath& deviceSpacePath, const SkIRect& accessRect, |