ccpr: Remove canMakeClipProcessor
Now that conics are supported we can make a ccpr clip FP out of any path. No need to ask. And the 'fDrawCachablePaths' check was redundant since clip paths are always volatile anyway (for now). Bug: skia: Change-Id: I670474a3b91f1c252ed323eb627bbb109788e6b8 Reviewed-on: https://skia-review.googlesource.com/124362 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
parent
cb31248132
commit
1dec19a29e
@ -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));
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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()) {
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user