aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPipeline.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-03-28 16:32:05 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-29 13:17:50 +0000
commit318538484f99253b6a2acf97d4d1b420e628b289 (patch)
treea698f31af79a873f16bad8847c50623bb44a19be /src/gpu/GrPipeline.cpp
parent02bb6df0819d932a7a7ef8c6fb6914e3c5a0f4a2 (diff)
Remove GrXferProcessor::getOptimizations.
This replaces GrXferProcessor::getOptimizations with a new function on GrXPFactory. The results are made available via FragmentProcessorAnalysis. Bug: skia: Change-Id: I535985458c9d13ad858cac94e957e2fdbe332036 Reviewed-on: https://skia-review.googlesource.com/10218 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrPipeline.cpp')
-rw-r--r--src/gpu/GrPipeline.cpp47
1 files changed, 21 insertions, 26 deletions
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index adcdd0fe02..d8f7fbdbf8 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -52,37 +52,32 @@ GrPipelineOptimizations GrPipeline::init(const InitArgs& args) {
bool isHWAA = kHWAntialias_Flag & args.fFlags;
// Create XferProcessor from DS's XPFactory
- bool hasMixedSamples = args.fRenderTarget->isMixedSampled() && (isHWAA || isStencilEnabled());
- const GrXPFactory* xpFactory = args.fProcessors->xpFactory();
- sk_sp<GrXferProcessor> xferProcessor;
- if (xpFactory) {
- xferProcessor.reset(xpFactory->createXferProcessor(*args.fAnalysis, 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));
+ {
+ bool hasMixedSamples =
+ args.fRenderTarget->isMixedSampled() && (isHWAA || this->isStencilEnabled());
+ sk_sp<GrXferProcessor> xferProcessor;
+ const GrXPFactory* xpFactory = args.fProcessors->xpFactory();
+ if (xpFactory) {
+ xferProcessor.reset(xpFactory->createXferProcessor(*args.fAnalysis, 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));
+ }
+ 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);
-
- GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags;
-
- const GrXferProcessor* xpForOpts = xferProcessor ? xferProcessor.get() :
- &GrPorterDuffXPFactory::SimpleSrcOverXP();
- optFlags = xpForOpts->getOptimizations(*args.fAnalysis);
-
- // No need to have an override color if it isn't even going to be used.
- if (SkToBool(GrXferProcessor::kIgnoreColor_OptFlag & optFlags)) {
+ if (args.fAnalysis->isInputColorIgnored()) {
+ // No need to have an override color if it isn't even going to be used.
overrideColor = GrColor_ILLEGAL;
- }
-
- fXferProcessor.reset(xferProcessor.get());
-
- if ((optFlags & GrXferProcessor::kIgnoreColor_OptFlag)) {
colorFPsToEliminate = args.fProcessors->numColorFragmentProcessors();
}
@@ -122,7 +117,7 @@ GrPipelineOptimizations GrPipeline::init(const InitArgs& args) {
if (args.fAnalysis->usesLocalCoords()) {
optimizations.fFlags |= GrPipelineOptimizations::kReadsLocalCoords_Flag;
}
- if (SkToBool(optFlags & GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag)) {
+ if (args.fAnalysis->isCompatibleWithCoverageAsAlpha()) {
optimizations.fFlags |= GrPipelineOptimizations::kCanTweakAlphaForCoverage_Flag;
}
return optimizations;