diff options
author | Brian Salomon <bsalomon@google.com> | 2017-04-04 15:13:25 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-04 19:46:18 +0000 |
commit | e14bd80db048277daa3db28496310e1863b5b7a9 (patch) | |
tree | 7da5f6aa72b4b884476f46cc4cebe2a9fa3274c4 | |
parent | 9e4d51126f60264f53fbf841ef97092803e88374 (diff) |
Move GrPipelineBuilder into GrRenderTargetContext::addLegacyDrawOp
This makes the legacy code use GrProcessorSet::Analysis in the same manner as the non-GrLegacyMeshDrawOps which enables changes to how analysis works.
Change-Id: I8171e285ac8930beb3ac33cd3c4ee88f217b9e40
Reviewed-on: https://skia-review.googlesource.com/11205
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
-rw-r--r-- | src/gpu/GrPipeline.cpp | 29 | ||||
-rw-r--r-- | src/gpu/GrPipeline.h | 6 | ||||
-rw-r--r-- | src/gpu/GrPipelineBuilder.h | 8 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetContext.cpp | 43 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetContext.h | 2 | ||||
-rw-r--r-- | src/gpu/GrSWMaskHelper.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrSoftwarePathRenderer.cpp | 2 | ||||
-rw-r--r-- | src/gpu/instanced/InstancedRendering.cpp | 4 | ||||
-rw-r--r-- | src/gpu/ops/GrAAConvexPathRenderer.cpp | 3 | ||||
-rw-r--r-- | src/gpu/ops/GrAAHairLinePathRenderer.cpp | 3 | ||||
-rw-r--r-- | src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp | 3 | ||||
-rw-r--r-- | src/gpu/ops/GrDashLinePathRenderer.cpp | 3 | ||||
-rw-r--r-- | src/gpu/ops/GrDefaultPathRenderer.cpp | 6 | ||||
-rw-r--r-- | src/gpu/ops/GrDrawPathOp.cpp | 4 | ||||
-rw-r--r-- | src/gpu/ops/GrMSAAPathRenderer.cpp | 4 | ||||
-rw-r--r-- | src/gpu/ops/GrMeshDrawOp.h | 10 | ||||
-rw-r--r-- | src/gpu/ops/GrSmallPathRenderer.cpp | 3 | ||||
-rw-r--r-- | src/gpu/ops/GrStencilAndCoverPathRenderer.cpp | 2 | ||||
-rw-r--r-- | src/gpu/ops/GrTessellatingPathRenderer.cpp | 3 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasTextBlob.cpp | 2 | ||||
-rw-r--r-- | tests/ProcessorTest.cpp | 2 | ||||
-rw-r--r-- | tools/gpu/GrTest.cpp | 3 |
22 files changed, 71 insertions, 76 deletions
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp index e36db07e0e..f48162c86b 100644 --- a/src/gpu/GrPipeline.cpp +++ b/src/gpu/GrPipeline.cpp @@ -19,10 +19,6 @@ #include "ops/GrOp.h" void GrPipeline::init(const InitArgs& args) { - if (args.fAnalysis) { - SkASSERT(args.fAnalysis->outputColor() == args.fInputColor); - SkASSERT(args.fAnalysis->outputCoverage() == args.fInputCoverage); - } SkASSERT(args.fRenderTarget); fRenderTarget.reset(args.fRenderTarget); @@ -62,12 +58,12 @@ void GrPipeline::init(const InitArgs& args) { const GrXPFactory* xpFactory = args.fProcessors->xpFactory(); if (xpFactory) { xferProcessor.reset(xpFactory->createXferProcessor( - args.fInputColor, args.fInputCoverage, hasMixedSamples, *args.fCaps)); + args.fXPInputColor, args.fXPInputCoverage, hasMixedSamples, *args.fCaps)); SkASSERT(xferProcessor); } else { // This may return nullptr in the common case of src-over implemented using hw blending. xferProcessor.reset(GrPorterDuffXPFactory::CreateSrcOverXferProcessor( - *args.fCaps, args.fInputColor, args.fInputCoverage, hasMixedSamples)); + *args.fCaps, args.fXPInputColor, args.fXPInputCoverage, hasMixedSamples)); } fXferProcessor.reset(xferProcessor.get()); } @@ -76,25 +72,9 @@ void GrPipeline::init(const InitArgs& args) { fDstTextureOffset = args.fDstTexture.offset(); } - // This is for the legacy GrPipeline creation in GrLegacyMeshDrawOp where analysis does not - // eliminate fragment processors from GrProcessorSet. - int colorFPsToEliminate = 0; - if (args.fAnalysis) { - GrColor overrideColor = GrColor_ILLEGAL; - colorFPsToEliminate = - args.fAnalysis->getInputColorOverrideAndColorProcessorEliminationCount( - &overrideColor); - colorFPsToEliminate = SkTMax(colorFPsToEliminate, 0); - if (args.fAnalysis->isInputColorIgnored()) { - // No need to have an override color if it isn't even going to be used. - overrideColor = GrColor_ILLEGAL; - colorFPsToEliminate = args.fProcessors->numColorFragmentProcessors(); - } - } - // Copy GrFragmentProcessors from GrPipelineBuilder to Pipeline, possibly removing some of the // color fragment processors. - fNumColorProcessors = args.fProcessors->numColorFragmentProcessors() - colorFPsToEliminate; + fNumColorProcessors = args.fProcessors->numColorFragmentProcessors(); int numTotalProcessors = fNumColorProcessors + args.fProcessors->numCoverageFragmentProcessors(); if (args.fAppliedClip && args.fAppliedClip->clipCoverageFragmentProcessor()) { @@ -102,8 +82,7 @@ void GrPipeline::init(const InitArgs& args) { } fFragmentProcessors.reset(numTotalProcessors); int currFPIdx = 0; - for (int i = colorFPsToEliminate; i < args.fProcessors->numColorFragmentProcessors(); - ++i, ++currFPIdx) { + for (int i = 0; i < args.fProcessors->numColorFragmentProcessors(); ++i, ++currFPIdx) { const GrFragmentProcessor* fp = args.fProcessors->colorFragmentProcessor(i); fFragmentProcessors[currFPIdx].reset(fp); } diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h index d7a4f4ebed..02a14af889 100644 --- a/src/gpu/GrPipeline.h +++ b/src/gpu/GrPipeline.h @@ -57,10 +57,8 @@ public: uint32_t fFlags = 0; GrDrawFace fDrawFace = GrDrawFace::kBoth; const GrProcessorSet* fProcessors = nullptr; - GrProcessorAnalysisColor fInputColor; - GrProcessorAnalysisCoverage fInputCoverage = GrProcessorAnalysisCoverage::kNone; - // This is only used for GrLegacyMeshDrawOp's pipeline creation system. - const GrProcessorSet::Analysis* fAnalysis = nullptr; + GrProcessorAnalysisColor fXPInputColor; + GrProcessorAnalysisCoverage fXPInputCoverage = GrProcessorAnalysisCoverage::kNone; const GrUserStencilSettings* fUserStencil = &GrUserStencilSettings::kUnused; const GrAppliedClip* fAppliedClip = nullptr; GrRenderTarget* fRenderTarget = nullptr; diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h index 7451b655b1..94e07e6cd8 100644 --- a/src/gpu/GrPipelineBuilder.h +++ b/src/gpu/GrPipelineBuilder.h @@ -63,6 +63,14 @@ public: const GrProcessorSet& processors() const { return fProcessors; } + void analyzeAndEliminateFragmentProcessors(GrProcessorSet::Analysis* analysis, + const GrProcessorAnalysisColor& colorInput, + const GrProcessorAnalysisCoverage coverageInput, + const GrAppliedClip* clip, const GrCaps& caps) { + fProcessors.analyzeAndEliminateFragmentProcessors(analysis, colorInput, coverageInput, clip, + caps); + } + /// @} diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index f4c4410dc4..af17e5b8e2 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -516,7 +516,7 @@ bool GrRenderTargetContext::drawFilledRect(const GrClip& clip, if (ss) { pipelineBuilder.setUserStencil(ss); } - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); return true; } } @@ -639,7 +639,7 @@ void GrRenderTargetContext::drawRect(const GrClip& clip, if (op) { GrPipelineBuilder pipelineBuilder(std::move(paint), aaType); pipelineBuilder.setSnapVerticesToPixelCenters(snapToPixelCenters); - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); return; } } @@ -814,7 +814,7 @@ void GrRenderTargetContext::fillRectToRect(const GrClip& clip, std::unique_ptr<GrLegacyMeshDrawOp> op = GrAAFillRectOp::MakeWithLocalRect( paint.getColor(), viewMatrix, croppedRect, croppedLocalRect); GrPipelineBuilder pipelineBuilder(std::move(paint), aaType); - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); return; } @@ -870,7 +870,7 @@ void GrRenderTargetContext::fillRectWithLocalMatrix(const GrClip& clip, std::unique_ptr<GrLegacyMeshDrawOp> op = GrAAFillRectOp::Make(paint.getColor(), viewMatrix, localMatrix, croppedRect); GrPipelineBuilder pipelineBuilder(std::move(paint), aaType); - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); return; } @@ -920,7 +920,7 @@ void GrRenderTargetContext::drawVertices(const GrClip& clip, return; } GrPipelineBuilder pipelineBuilder(std::move(paint), GrAAType::kNone); - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); } void GrRenderTargetContext::drawVertices(const GrClip& clip, @@ -941,7 +941,7 @@ void GrRenderTargetContext::drawVertices(const GrClip& clip, return; } GrPipelineBuilder pipelineBuilder(std::move(paint), GrAAType::kNone); - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); } /////////////////////////////////////////////////////////////////////////////// @@ -963,7 +963,7 @@ void GrRenderTargetContext::drawAtlas(const GrClip& clip, std::unique_ptr<GrLegacyMeshDrawOp> op = GrDrawAtlasOp::Make(paint.getColor(), viewMatrix, spriteCount, xform, texRect, colors); GrPipelineBuilder pipelineBuilder(std::move(paint), GrAAType::kNone); - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); } /////////////////////////////////////////////////////////////////////////////// @@ -1023,7 +1023,7 @@ void GrRenderTargetContext::drawRRect(const GrClip& origClip, shaderCaps); if (op) { GrPipelineBuilder pipelineBuilder(std::move(paint), aaType); - this->addLegacyMeshDrawOp(pipelineBuilder, *clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), *clip, std::move(op)); return; } } @@ -1061,7 +1061,7 @@ void GrRenderTargetContext::drawShadowRRect(const GrClip& clip, paint.getColor(), viewMatrix, rrect, blurRadius, stroke, shaderCaps); if (op) { GrPipelineBuilder pipelineBuilder(std::move(paint), GrAAType::kNone); - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); return; } } @@ -1202,7 +1202,7 @@ void GrRenderTargetContext::drawRegion(const GrClip& clip, std::unique_ptr<GrLegacyMeshDrawOp> op = GrRegionOp::Make(paint.getColor(), viewMatrix, region); GrPipelineBuilder pipelineBuilder(std::move(paint), GrAAType::kNone); - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); } void GrRenderTargetContext::drawOval(const GrClip& clip, @@ -1243,7 +1243,7 @@ void GrRenderTargetContext::drawOval(const GrClip& clip, GrOvalOpFactory::MakeOvalOp(paint.getColor(), viewMatrix, oval, stroke, shaderCaps); if (op) { GrPipelineBuilder pipelineBuilder(std::move(paint), aaType); - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); return; } } @@ -1283,7 +1283,7 @@ void GrRenderTargetContext::drawArc(const GrClip& clip, shaderCaps); if (op) { GrPipelineBuilder pipelineBuilder(std::move(paint), aaType); - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); return; } } @@ -1311,7 +1311,7 @@ void GrRenderTargetContext::drawImageLattice(const GrClip& clip, paint.getColor(), viewMatrix, imageWidth, imageHeight, std::move(iter), dst); GrPipelineBuilder pipelineBuilder(std::move(paint), GrAAType::kNone); - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); } void GrRenderTargetContext::prepareForExternalIO() { @@ -1339,7 +1339,7 @@ void GrRenderTargetContext::drawNonAAFilledRect(const GrClip& clip, if (ss) { pipelineBuilder.setUserStencil(ss); } - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); } // Can 'path' be drawn as a pair of filled nested rectangles? @@ -1419,7 +1419,7 @@ void GrRenderTargetContext::drawPath(const GrClip& clip, GrRectOpFactory::MakeAAFillNestedRects(paint.getColor(), viewMatrix, rects); if (op) { GrPipelineBuilder pipelineBuilder(std::move(paint), aaType); - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); } return; } @@ -1433,7 +1433,7 @@ void GrRenderTargetContext::drawPath(const GrClip& clip, paint.getColor(), viewMatrix, ovalRect, style.strokeRec(), shaderCaps); if (op) { GrPipelineBuilder pipelineBuilder(std::move(paint), aaType); - this->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + this->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); return; } } @@ -1676,7 +1676,7 @@ uint32_t GrRenderTargetContext::addDrawOp(const GrClip& clip, std::unique_ptr<Gr return this->getOpList()->addOp(std::move(op), this, std::move(appliedClip), dstTexture); } -uint32_t GrRenderTargetContext::addLegacyMeshDrawOp(const GrPipelineBuilder& pipelineBuilder, +uint32_t GrRenderTargetContext::addLegacyMeshDrawOp(GrPipelineBuilder&& pipelineBuilder, const GrClip& clip, std::unique_ptr<GrLegacyMeshDrawOp> op) { ASSERT_SINGLE_OWNER @@ -1711,16 +1711,15 @@ uint32_t GrRenderTargetContext::addLegacyMeshDrawOp(const GrPipelineBuilder& pip } GrProcessorSet::Analysis analysis; - op->analyzeProcessors(&analysis, pipelineBuilder.processors(), &appliedClip, *this->caps()); + op->analyzeProcessors(&analysis, &pipelineBuilder, &appliedClip, *this->caps()); GrPipeline::InitArgs args; pipelineBuilder.getPipelineInitArgs(&args); args.fAppliedClip = &appliedClip; args.fRenderTarget = rt; args.fCaps = this->caps(); - args.fAnalysis = &analysis; - args.fInputColor = analysis.outputColor(); - args.fInputCoverage = analysis.outputCoverage(); + args.fXPInputColor = analysis.outputColor(); + args.fXPInputCoverage = analysis.outputCoverage(); if (analysis.requiresDstTexture()) { this->setupDstTexture(rt, clip, bounds, &args.fDstTexture); @@ -1728,7 +1727,7 @@ uint32_t GrRenderTargetContext::addLegacyMeshDrawOp(const GrPipelineBuilder& pip return SK_InvalidUniqueID; } } - op->initPipeline(args); + op->initPipeline(args, analysis); // TODO: We need to add pipeline dependencies on textures, etc before recording this op. op->setClippedBounds(bounds); return this->getOpList()->addOp(std::move(op), this); diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h index edec4de3ef..fe32faf1b9 100644 --- a/src/gpu/GrRenderTargetContext.h +++ b/src/gpu/GrRenderTargetContext.h @@ -466,7 +466,7 @@ private: // the op list. They return the id of the opList to which the op was added, or 0, if it was // dropped (e.g., due to clipping). uint32_t addDrawOp(const GrClip&, std::unique_ptr<GrDrawOp>); - uint32_t addLegacyMeshDrawOp(const GrPipelineBuilder&, const GrClip&, + uint32_t addLegacyMeshDrawOp(GrPipelineBuilder&&, const GrClip&, std::unique_ptr<GrLegacyMeshDrawOp>); // Makes a copy of the dst if it is necessary for the draw and returns the texture that should diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp index fb06ab4ca1..2068734614 100644 --- a/src/gpu/GrSWMaskHelper.cpp +++ b/src/gpu/GrSWMaskHelper.cpp @@ -180,5 +180,5 @@ void GrSWMaskHelper::DrawToTargetWithShapeMask(sk_sp<GrTextureProxy> proxy, GrSamplerParams::kNone_FilterMode)); GrPipelineBuilder pipelineBuilder(std::move(paint), GrAAType::kNone); pipelineBuilder.setUserStencil(&userStencilSettings); - renderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + renderTargetContext->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); } diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp index 25004e192b..0e7cecd97c 100644 --- a/src/gpu/GrSoftwarePathRenderer.cpp +++ b/src/gpu/GrSoftwarePathRenderer.cpp @@ -81,7 +81,7 @@ void GrSoftwarePathRenderer::DrawNonAARect(GrRenderTargetContext* renderTargetCo GrPipelineBuilder pipelineBuilder(std::move(paint), GrAAType::kNone); pipelineBuilder.setUserStencil(&userStencilSettings); - renderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + renderTargetContext->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); } void GrSoftwarePathRenderer::DrawAroundInvPath(GrRenderTargetContext* renderTargetContext, diff --git a/src/gpu/instanced/InstancedRendering.cpp b/src/gpu/instanced/InstancedRendering.cpp index 4abaef69b3..9b6e576f8f 100644 --- a/src/gpu/instanced/InstancedRendering.cpp +++ b/src/gpu/instanced/InstancedRendering.cpp @@ -482,8 +482,8 @@ void InstancedRendering::Op::onExecute(GrOpFlushState* state) { GrPipeline pipeline; GrPipeline::InitArgs args; - args.fInputColor = fAnalysisColor; - args.fInputCoverage = coverage; + args.fXPInputColor = fAnalysisColor; + args.fXPInputCoverage = coverage; args.fAppliedClip = clip; args.fCaps = &state->caps(); args.fProcessors = &fProcessors; diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp index 5c52fef7d3..efc6622c15 100644 --- a/src/gpu/ops/GrAAConvexPathRenderer.cpp +++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp @@ -979,7 +979,8 @@ bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) { GrPipelineBuilder pipelineBuilder(std::move(args.fPaint), args.fAAType); pipelineBuilder.setUserStencil(args.fUserStencilSettings); - args.fRenderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, *args.fClip, std::move(op)); + args.fRenderTargetContext->addLegacyMeshDrawOp(std::move(pipelineBuilder), *args.fClip, + std::move(op)); return true; diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp index c789aa8347..274e308465 100644 --- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp +++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp @@ -950,7 +950,8 @@ bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) { args.fPaint.getColor(), *args.fViewMatrix, path, args.fShape->style(), devClipBounds); GrPipelineBuilder pipelineBuilder(std::move(args.fPaint), args.fAAType); pipelineBuilder.setUserStencil(args.fUserStencilSettings); - args.fRenderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, *args.fClip, std::move(op)); + args.fRenderTargetContext->addLegacyMeshDrawOp(std::move(pipelineBuilder), *args.fClip, + std::move(op)); return true; } diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp index 8768c1e362..2a5464c130 100644 --- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp +++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp @@ -343,7 +343,8 @@ bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) { GrPipelineBuilder pipelineBuilder(std::move(args.fPaint), args.fAAType); pipelineBuilder.setUserStencil(args.fUserStencilSettings); - args.fRenderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, *args.fClip, std::move(op)); + args.fRenderTargetContext->addLegacyMeshDrawOp(std::move(pipelineBuilder), *args.fClip, + std::move(op)); return true; } diff --git a/src/gpu/ops/GrDashLinePathRenderer.cpp b/src/gpu/ops/GrDashLinePathRenderer.cpp index eda89069dd..cafe2474c7 100644 --- a/src/gpu/ops/GrDashLinePathRenderer.cpp +++ b/src/gpu/ops/GrDashLinePathRenderer.cpp @@ -55,6 +55,7 @@ bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) { GrPipelineBuilder pipelineBuilder(std::move(args.fPaint), args.fAAType); pipelineBuilder.setUserStencil(args.fUserStencilSettings); - args.fRenderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, *args.fClip, std::move(op)); + args.fRenderTargetContext->addLegacyMeshDrawOp( + std::move(pipelineBuilder), *args.fClip, std::move(op)); return true; } diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp index 73c1f10c4d..762084cba8 100644 --- a/src/gpu/ops/GrDefaultPathRenderer.cpp +++ b/src/gpu/ops/GrDefaultPathRenderer.cpp @@ -554,7 +554,8 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget GrPipelineBuilder pipelineBuilder(std::move(paint), aaType); pipelineBuilder.setDrawFace(drawFace[p]); pipelineBuilder.setUserStencil(passes[p]); - renderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + renderTargetContext->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, + std::move(op)); } else { std::unique_ptr<GrLegacyMeshDrawOp> op = DefaultPathOp::Make(paint.getColor(), path, srcSpaceTol, newCoverage, @@ -567,7 +568,8 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget GrPipelineBuilder pipelineBuilder(std::move(passPaint), aaType); pipelineBuilder.setDrawFace(drawFace[p]); pipelineBuilder.setUserStencil(passes[p]); - renderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + renderTargetContext->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, + std::move(op)); } } return true; diff --git a/src/gpu/ops/GrDrawPathOp.cpp b/src/gpu/ops/GrDrawPathOp.cpp index 81a2de0dc8..1c68fdf8a1 100644 --- a/src/gpu/ops/GrDrawPathOp.cpp +++ b/src/gpu/ops/GrDrawPathOp.cpp @@ -46,8 +46,8 @@ void GrDrawPathOpBase::initPipeline(const GrOpFlushState& state, GrPipeline* pip args.fRenderTarget = state.drawOpArgs().fRenderTarget; args.fCaps = &state.caps(); args.fDstTexture = state.drawOpArgs().fDstTexture; - args.fInputColor = analysis.outputColor(); - args.fInputCoverage = analysis.outputCoverage(); + args.fXPInputColor = analysis.outputColor(); + args.fXPInputCoverage = analysis.outputCoverage(); return pipeline->init(args); } diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp index 227c540656..8e320063e3 100644 --- a/src/gpu/ops/GrMSAAPathRenderer.cpp +++ b/src/gpu/ops/GrMSAAPathRenderer.cpp @@ -640,7 +640,7 @@ bool GrMSAAPathRenderer::internalDrawPath(GrRenderTargetContext* renderTargetCon } GrPipelineBuilder pipelineBuilder(std::move(firstPassPaint), aaType); pipelineBuilder.setUserStencil(passes[0]); - renderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + renderTargetContext->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); } if (passes[1]) { @@ -669,7 +669,7 @@ bool GrMSAAPathRenderer::internalDrawPath(GrRenderTargetContext* renderTargetCon GrPipelineBuilder pipelineBuilder(std::move(paint), aaType); pipelineBuilder.setUserStencil(passes[1]); - renderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + renderTargetContext->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); } return true; } diff --git a/src/gpu/ops/GrMeshDrawOp.h b/src/gpu/ops/GrMeshDrawOp.h index 8daa62b374..41d3848666 100644 --- a/src/gpu/ops/GrMeshDrawOp.h +++ b/src/gpu/ops/GrMeshDrawOp.h @@ -12,6 +12,7 @@ #include "GrGeometryProcessor.h" #include "GrMesh.h" #include "GrPendingProgramElement.h" +#include "GrPipelineBuilder.h" #include "SkTLList.h" @@ -101,18 +102,19 @@ public: * initial color and coverage from this op's geometry processor. */ void analyzeProcessors(GrProcessorSet::Analysis* analysis, - const GrProcessorSet& processors, + GrPipelineBuilder* pipelineBuilder, const GrAppliedClip* appliedClip, const GrCaps& caps) const { GrProcessorAnalysisColor inputColor; GrProcessorAnalysisCoverage inputCoverage; this->getProcessorAnalysisInputs(&inputColor, &inputCoverage); - analysis->init(inputColor, inputCoverage, processors, appliedClip, caps); + pipelineBuilder->analyzeAndEliminateFragmentProcessors(analysis, inputColor, inputCoverage, + appliedClip, caps); } - void initPipeline(const GrPipeline::InitArgs& args) { + void initPipeline(const GrPipeline::InitArgs& args, const GrProcessorSet::Analysis& analysis) { fPipeline.init(args); - this->applyPipelineOptimizations(PipelineOptimizations(*args.fAnalysis)); + this->applyPipelineOptimizations(PipelineOptimizations(analysis)); } /** diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp index ef70bc591a..0986a09141 100644 --- a/src/gpu/ops/GrSmallPathRenderer.cpp +++ b/src/gpu/ops/GrSmallPathRenderer.cpp @@ -766,7 +766,8 @@ bool GrSmallPathRenderer::onDrawPath(const DrawPathArgs& args) { GrPipelineBuilder pipelineBuilder(std::move(args.fPaint), args.fAAType); pipelineBuilder.setUserStencil(args.fUserStencilSettings); - args.fRenderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, *args.fClip, std::move(op)); + args.fRenderTargetContext->addLegacyMeshDrawOp(std::move(pipelineBuilder), *args.fClip, + std::move(op)); return true; } diff --git a/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp b/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp index ea07644218..a4e32acff3 100644 --- a/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp +++ b/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp @@ -141,7 +141,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { GrPipelineBuilder pipelineBuilder(std::move(args.fPaint), coverAAType); pipelineBuilder.setUserStencil(&kInvertedCoverPass); - args.fRenderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, *args.fClip, + args.fRenderTargetContext->addLegacyMeshDrawOp(std::move(pipelineBuilder), *args.fClip, std::move(coverOp)); } } else { diff --git a/src/gpu/ops/GrTessellatingPathRenderer.cpp b/src/gpu/ops/GrTessellatingPathRenderer.cpp index eda39c2eec..059d8314c4 100644 --- a/src/gpu/ops/GrTessellatingPathRenderer.cpp +++ b/src/gpu/ops/GrTessellatingPathRenderer.cpp @@ -369,7 +369,8 @@ bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) { GrAAType::kCoverage == args.fAAType); GrPipelineBuilder pipelineBuilder(std::move(args.fPaint), args.fAAType); pipelineBuilder.setUserStencil(args.fUserStencilSettings); - args.fRenderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, *args.fClip, std::move(op)); + args.fRenderTargetContext->addLegacyMeshDrawOp(std::move(pipelineBuilder), *args.fClip, + std::move(op)); return true; } diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp index e8eeb0c78a..d3aa7e49f2 100644 --- a/src/gpu/text/GrAtlasTextBlob.cpp +++ b/src/gpu/text/GrAtlasTextBlob.cpp @@ -310,7 +310,7 @@ inline void GrAtlasTextBlob::flushRun(GrRenderTargetContext* rtc, const GrClip& distanceAdjustTable, rtc->isGammaCorrect(), cache)); GrPipelineBuilder pipelineBuilder(std::move(grPaint), GrAAType::kNone); - rtc->addLegacyMeshDrawOp(pipelineBuilder, clip, std::move(op)); + rtc->addLegacyMeshDrawOp(std::move(pipelineBuilder), clip, std::move(op)); } } diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp index 241c0fa4e3..b8691f2689 100644 --- a/tests/ProcessorTest.cpp +++ b/tests/ProcessorTest.cpp @@ -270,7 +270,7 @@ void test_draw_op(GrRenderTargetContext* rtc, sk_sp<GrFragmentProcessor> fp, auto op = GrNonAAFillRectOp::Make(GrColor_WHITE, SkMatrix::I(), SkRect::MakeWH(rtc->width(), rtc->height()), nullptr, nullptr); - rtc->addLegacyMeshDrawOp(pb, GrNoClip(), std::move(op)); + rtc->addLegacyMeshDrawOp(std::move(pb), GrNoClip(), std::move(op)); } #include "SkCommandLineFlags.h" diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp index 23c8a16484..0350ff3e5a 100644 --- a/tools/gpu/GrTest.cpp +++ b/tools/gpu/GrTest.cpp @@ -247,7 +247,8 @@ uint32_t GrRenderTargetContextPriv::testingOnly_addLegacyMeshDrawOp( } pipelineBuilder.setSnapVerticesToPixelCenters(snapToCenters); - return fRenderTargetContext->addLegacyMeshDrawOp(pipelineBuilder, GrNoClip(), std::move(op)); + return fRenderTargetContext->addLegacyMeshDrawOp(std::move(pipelineBuilder), GrNoClip(), + std::move(op)); } #undef ASSERT_SINGLE_OWNER |