diff options
author | Brian Salomon <bsalomon@google.com> | 2017-03-29 14:25:04 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-29 19:05:06 +0000 |
commit | 1c6025cc9da4a4f3a8ad16dde2ae8dcf120ed270 (patch) | |
tree | f9d56e3c06726f2b1e69a6532a301b2dd1621533 /src/gpu/GrPipeline.cpp | |
parent | 978533c302bc53a26980c96f8a348ae7eb9e3862 (diff) |
Make analysis optional to GrPipeline::init().
GrXPFactory::createXferProcessor now takes GrPipelineAnalysisColor and GrPipelineAnalysisCoverage rather than GrProcessorSet::FragmentProcessorAnalysis.
This will make it so ops do not have to retain the analysis or rerun it to create pipelines at flush time.
Change-Id: Ib28ba65de425b20c2647329275f209aec168c3df
Reviewed-on: https://skia-review.googlesource.com/10474
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrPipeline.cpp')
-rw-r--r-- | src/gpu/GrPipeline.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp index 0a4a36c817..82d938e4c3 100644 --- a/src/gpu/GrPipeline.cpp +++ b/src/gpu/GrPipeline.cpp @@ -19,7 +19,10 @@ #include "ops/GrOp.h" void GrPipeline::init(const InitArgs& args) { - SkASSERT(args.fAnalysis); + if (args.fAnalysis) { + SkASSERT(args.fAnalysis->outputColor() == args.fInputColor); + SkASSERT(args.fAnalysis->outputCoverage() == args.fInputCoverage); + } SkASSERT(args.fRenderTarget); fRenderTarget.reset(args.fRenderTarget); @@ -58,27 +61,33 @@ void GrPipeline::init(const InitArgs& args) { sk_sp<GrXferProcessor> xferProcessor; const GrXPFactory* xpFactory = args.fProcessors->xpFactory(); if (xpFactory) { - xferProcessor.reset(xpFactory->createXferProcessor(*args.fAnalysis, hasMixedSamples, + xferProcessor.reset(xpFactory->createXferProcessor(args.fInputColor, + args.fInputCoverage, hasMixedSamples, &args.fDstTexture, *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.fAnalysis, hasMixedSamples, &args.fDstTexture)); + *args.fCaps, args.fInputColor, args.fInputCoverage, hasMixedSamples, + &args.fDstTexture)); } fXferProcessor.reset(xferProcessor.get()); } - // This is for the legacy GrPipeline creation in GrMeshDrawOp where analysis does not - // eliminate fragment processors from GrProcessorSet. - GrColor overrideColor = GrColor_ILLEGAL; - int 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(); + // This is for the legacy GrPipeline creation in GrMeshDrawOp 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 |