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>
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index e36db07..f48162c 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 @@
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 @@
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 @@
}
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);
}