aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-01-23 14:35:25 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-23 20:17:53 +0000
commit5f13fbac19ee0ea9a3d5216740912d377a30d622 (patch)
tree45f1becca7239814f3abf23a5f73c68a041a8727 /src
parent319ba3d3a177498095c31696e0aec8b3af25f663 (diff)
Stop tracking whether GrFragmentProcessors read their input
Change-Id: Id5338901978b97289798eaef873527597bd8dfd6 Reviewed-on: https://skia-review.googlesource.com/7414 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkColorMatrixFilterRowMajor255.cpp5
-rw-r--r--src/core/SkNormalBevelSource.cpp2
-rw-r--r--src/core/SkNormalFlatSource.cpp2
-rw-r--r--src/core/SkNormalMapSource.cpp2
-rw-r--r--src/effects/SkArithmeticImageFilter.cpp2
-rw-r--r--src/effects/SkDisplacementMapEffect.cpp2
-rw-r--r--src/effects/SkLumaColorFilter.cpp3
-rw-r--r--src/effects/SkOverdrawColorFilter.cpp2
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp2
-rw-r--r--src/effects/SkRRectsGaussianEdgeMaskFilter.cpp2
-rw-r--r--src/effects/SkTableColorFilter.cpp2
-rw-r--r--src/gpu/GrFragmentProcessor.cpp18
-rw-r--r--src/gpu/GrProcOptInfo.cpp7
-rw-r--r--src/gpu/GrProcOptInfo.h7
-rw-r--r--src/gpu/effects/GrConstColorProcessor.cpp3
-rw-r--r--src/gpu/effects/GrDitherEffect.cpp2
-rw-r--r--src/gpu/effects/GrGammaEffect.cpp2
-rw-r--r--src/gpu/effects/GrXfermodeFragmentProcessor.cpp17
-rw-r--r--src/gpu/effects/GrYUVEffect.cpp5
19 files changed, 25 insertions, 62 deletions
diff --git a/src/core/SkColorMatrixFilterRowMajor255.cpp b/src/core/SkColorMatrixFilterRowMajor255.cpp
index 778fe98c4e..2bcc79e4cc 100644
--- a/src/core/SkColorMatrixFilterRowMajor255.cpp
+++ b/src/core/SkColorMatrixFilterRowMajor255.cpp
@@ -393,7 +393,7 @@ private:
// then we can't know the final result.
if (0 != fMatrix[kAlphaRowStartIdx + i]) {
if (!(inout->validFlags() & kRGBAFlags[i])) {
- inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
+ inout->setToUnknown();
return;
} else {
uint32_t component = (inout->color() >> kShifts[i]) & 0xFF;
@@ -407,8 +407,7 @@ private:
// underflow this may deviate from the actual result. Maybe the effect should pin its
// result if the matrix could over/underflow for any component?
inout->setToOther(kA_GrColorComponentFlag,
- static_cast<uint8_t>(SkScalarPin(outputA, 0, 255)) << GrColor_SHIFT_A,
- GrInvariantOutput::kWill_ReadInput);
+ static_cast<uint8_t>(SkScalarPin(outputA, 0, 255)) << GrColor_SHIFT_A);
}
SkScalar fMatrix[20];
diff --git a/src/core/SkNormalBevelSource.cpp b/src/core/SkNormalBevelSource.cpp
index 86206b3f4e..bcdb999c15 100644
--- a/src/core/SkNormalBevelSource.cpp
+++ b/src/core/SkNormalBevelSource.cpp
@@ -223,7 +223,7 @@ public:
const char* name() const override { return "NormalBevelFP"; }
void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
- inout->setToUnknown(GrInvariantOutput::ReadInput::kWillNot_ReadInput);
+ inout->setToUnknown();
}
private:
diff --git a/src/core/SkNormalFlatSource.cpp b/src/core/SkNormalFlatSource.cpp
index 4ecd86174f..4fca57c1f3 100644
--- a/src/core/SkNormalFlatSource.cpp
+++ b/src/core/SkNormalFlatSource.cpp
@@ -50,7 +50,7 @@ public:
const char* name() const override { return "NormalFlatFP"; }
void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
- inout->setToUnknown(GrInvariantOutput::ReadInput::kWillNot_ReadInput);
+ inout->setToUnknown();
}
private:
diff --git a/src/core/SkNormalMapSource.cpp b/src/core/SkNormalMapSource.cpp
index 204effab11..5da9467ff7 100644
--- a/src/core/SkNormalMapSource.cpp
+++ b/src/core/SkNormalMapSource.cpp
@@ -103,7 +103,7 @@ public:
const char* name() const override { return "NormalMapFP"; }
void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
- inout->setToUnknown(GrInvariantOutput::ReadInput::kWillNot_ReadInput);
+ inout->setToUnknown();
}
const SkMatrix& invCTM() const { return fInvCTM; }
diff --git a/src/effects/SkArithmeticImageFilter.cpp b/src/effects/SkArithmeticImageFilter.cpp
index d33a9dc562..8d80984bdf 100644
--- a/src/effects/SkArithmeticImageFilter.cpp
+++ b/src/effects/SkArithmeticImageFilter.cpp
@@ -287,7 +287,7 @@ private:
void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
// TODO: optimize this
- inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
+ inout->setToUnknown();
}
ArithmeticFP(float k1, float k2, float k3, float k4, bool enforcePMColor,
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 0d3940317f..d838e1e347 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -528,7 +528,7 @@ void GrDisplacementMapEffect::onComputeInvariantOutput(GrInvariantOutput* inout)
// and no displacement offset push any texture coordinates out of bounds OR if the constant
// alpha is 0. Since this isn't trivial to compute at this point, let's assume the output is
// not of constant color when a displacement effect is applied.
- inout->setToUnknown(GrInvariantOutput::kWillNot_ReadInput);
+ inout->setToUnknown();
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/effects/SkLumaColorFilter.cpp b/src/effects/SkLumaColorFilter.cpp
index bd5c1463eb..a9516af63d 100644
--- a/src/effects/SkLumaColorFilter.cpp
+++ b/src/effects/SkLumaColorFilter.cpp
@@ -115,8 +115,7 @@ private:
void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
// The output is always black. The alpha value for the color passed in is arbitrary.
- inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0),
- GrInvariantOutput::kWill_ReadInput);
+ inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0));
}
};
diff --git a/src/effects/SkOverdrawColorFilter.cpp b/src/effects/SkOverdrawColorFilter.cpp
index 7d95e3a7f1..dea4f8b6de 100644
--- a/src/effects/SkOverdrawColorFilter.cpp
+++ b/src/effects/SkOverdrawColorFilter.cpp
@@ -121,7 +121,7 @@ bool OverdrawFragmentProcessor::onIsEqual(const GrFragmentProcessor& other) cons
}
void OverdrawFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput* inout) const {
- inout->invalidateComponents(kRGBA_GrColorComponentFlags, GrInvariantOutput::kWill_ReadInput);
+ inout->invalidateComponents(kRGBA_GrColorComponentFlags);
}
GLOverdrawFragmentProcessor::GLOverdrawFragmentProcessor(const GrColor4f* colors) {
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 90a3531291..600a4fbb6b 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -536,7 +536,7 @@ private:
}
void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
- inout->setToUnknown(GrInvariantOutput::kWillNot_ReadInput);
+ inout->setToUnknown();
}
GrPerlinNoiseEffect(SkPerlinNoiseShader::Type type,
diff --git a/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp b/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp
index 53df9e2aeb..5da3ed1eb1 100644
--- a/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp
+++ b/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp
@@ -456,7 +456,7 @@ public:
const char* name() const override { return "RRectsGaussianEdgeFP"; }
void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
- inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
+ inout->setToUnknown();
}
const SkRRect& first() const { return fFirst; }
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 3634946fc6..1fd4c90eed 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -561,7 +561,7 @@ void ColorTableEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const
if (fFlags & SkTable_ColorFilter::kA_Flag) {
invalidateFlags |= kA_GrColorComponentFlag;
}
- inout->invalidateComponents(invalidateFlags, GrInvariantOutput::kWill_ReadInput);
+ inout->invalidateComponents(invalidateFlags);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index 0518966911..0ad144a3be 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -181,7 +181,7 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::MulOutputByInputUnpremulColor(
void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
// TODO: Add a helper to GrInvariantOutput that handles multiplying by color with flags?
if (!(inout->validFlags() & kA_GrColorComponentFlag)) {
- inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
+ inout->setToUnknown();
return;
}
@@ -208,7 +208,7 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::MulOutputByInputUnpremulColor(
color |= SkMulDiv255Round(GrColorUnpackB(c0), GrColorUnpackB(c1)) <<
GrColor_SHIFT_B;
}
- inout->setToOther(commonFlags, color, GrInvariantOutput::kWill_ReadInput);
+ inout->setToOther(commonFlags, color);
}
};
if (!fp) {
@@ -272,8 +272,7 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::OverrideInput(sk_sp<GrFragmentPr
}
void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
- inout->setToOther(kRGBA_GrColorComponentFlags, fColor.toGrColor(),
- GrInvariantOutput::kWillNot_ReadInput);
+ inout->setToOther(kRGBA_GrColorComponentFlags, fColor.toGrColor());
this->childProcessor(0).computeInvariantOutput(inout);
}
@@ -282,11 +281,7 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::OverrideInput(sk_sp<GrFragmentPr
GrInvariantOutput childOut(0x0, kNone_GrColorComponentFlags);
fp->computeInvariantOutput(&childOut);
- if (childOut.willUseInputColor()) {
- return sk_sp<GrFragmentProcessor>(new ReplaceInputFragmentProcessor(std::move(fp), color));
- } else {
- return fp;
- }
+ return sk_sp<GrFragmentProcessor>(new ReplaceInputFragmentProcessor(std::move(fp), color));
}
sk_sp<GrFragmentProcessor> GrFragmentProcessor::RunInSeries(sk_sp<GrFragmentProcessor>* series,
@@ -354,7 +349,7 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::RunInSeries(sk_sp<GrFragmentProc
int firstIdx = info.firstEffectiveProcessorIndex();
cnt -= firstIdx;
- if (firstIdx > 0 && info.inputColorIsUsed()) {
+ if (firstIdx > 0) {
// See comment above - need to preserve 4f and color spaces during invariant processing.
sk_sp<GrFragmentProcessor> colorFP(GrConstColorProcessor::Make(
GrColor4f::FromGrColor(info.inputColorToFirstEffectiveProccesor()),
@@ -366,9 +361,6 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::RunInSeries(sk_sp<GrFragmentProc
replacementSeries.emplace_back(std::move(series[firstIdx + i]));
}
series = replacementSeries.begin();
- } else {
- series += firstIdx;
- cnt -= firstIdx;
}
if (1 == cnt) {
diff --git a/src/gpu/GrProcOptInfo.cpp b/src/gpu/GrProcOptInfo.cpp
index f18482338c..1f3edadf99 100644
--- a/src/gpu/GrProcOptInfo.cpp
+++ b/src/gpu/GrProcOptInfo.cpp
@@ -12,17 +12,10 @@
void GrProcOptInfo::analyzeProcessors(const GrFragmentProcessor* const* processors, int cnt) {
for (int i = 0; i < cnt; ++i) {
const GrFragmentProcessor* processor = processors[i];
- fInOut.resetWillUseInputColor();
processor->computeInvariantOutput(&fInOut);
- SkDEBUGCODE(fInOut.validate());
- if (!fInOut.willUseInputColor()) {
- fFirstEffectiveProcessorIndex = i;
- fInputColorIsUsed = false;
- }
if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) {
fFirstEffectiveProcessorIndex = i + 1;
fInputColor = fInOut.color();
- fInputColorIsUsed = true;
// Since we are clearing all previous color stages we are in a state where we have found
// zero stages that don't multiply the inputColor.
fInOut.resetNonMulStageFound();
diff --git a/src/gpu/GrProcOptInfo.h b/src/gpu/GrProcOptInfo.h
index 6b040045e0..39175fdef6 100644
--- a/src/gpu/GrProcOptInfo.h
+++ b/src/gpu/GrProcOptInfo.h
@@ -65,11 +65,6 @@ public:
int firstEffectiveProcessorIndex() const { return fFirstEffectiveProcessorIndex; }
/**
- * True if the first effective processor reads its input, false otherwise.
- */
- bool inputColorIsUsed() const { return fInputColorIsUsed; }
-
- /**
* If input color is used and per-vertex colors are not used, this is the input color to the
* first effective processor.
*/
@@ -79,7 +74,6 @@ private:
void internalReset(GrColor color, GrColorComponentFlags colorFlags, bool isLCDCoverage) {
fInOut.reset(color, colorFlags);
fFirstEffectiveProcessorIndex = 0;
- fInputColorIsUsed = true;
fInputColor = color;
fIsLCDCoverage = isLCDCoverage;
}
@@ -88,7 +82,6 @@ private:
GrInvariantOutput fInOut;
int fFirstEffectiveProcessorIndex = 0;
- bool fInputColorIsUsed = true;
bool fIsLCDCoverage = false;
GrColor fInputColor = 0;
};
diff --git a/src/gpu/effects/GrConstColorProcessor.cpp b/src/gpu/effects/GrConstColorProcessor.cpp
index 0efe997f78..e6568793df 100644
--- a/src/gpu/effects/GrConstColorProcessor.cpp
+++ b/src/gpu/effects/GrConstColorProcessor.cpp
@@ -64,8 +64,7 @@ private:
void GrConstColorProcessor::onComputeInvariantOutput(GrInvariantOutput* inout) const {
if (kIgnore_InputMode == fMode) {
- inout->setToOther(kRGBA_GrColorComponentFlags, fColor.toGrColor(),
- GrInvariantOutput::kWillNot_ReadInput);
+ inout->setToOther(kRGBA_GrColorComponentFlags, fColor.toGrColor());
} else {
float r = fColor.fRGBA[0];
bool colorIsSingleChannel = r == fColor.fRGBA[1] && r == fColor.fRGBA[2] &&
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp
index a93e74f412..2ba47d2e09 100644
--- a/src/gpu/effects/GrDitherEffect.cpp
+++ b/src/gpu/effects/GrDitherEffect.cpp
@@ -45,7 +45,7 @@ private:
};
void DitherEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
- inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
+ inout->setToUnknown();
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrGammaEffect.cpp b/src/gpu/effects/GrGammaEffect.cpp
index 765612052c..8b9363e843 100644
--- a/src/gpu/effects/GrGammaEffect.cpp
+++ b/src/gpu/effects/GrGammaEffect.cpp
@@ -109,7 +109,7 @@ bool GrGammaEffect::onIsEqual(const GrFragmentProcessor& s) const {
}
void GrGammaEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
- inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
+ inout->setToUnknown();
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
index d3eaee338d..d98478747a 100644
--- a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
+++ b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
@@ -42,7 +42,7 @@ protected:
}
void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
- inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
+ inout->setToUnknown();
}
private:
@@ -197,20 +197,9 @@ protected:
inout->color(), inout->validFlags(),
&blendColor, &blendFlags);
}
- // will the shader code reference the input color?
- GrInvariantOutput::ReadInput readsInput = GrInvariantOutput::kWillNot_ReadInput;
- if (kDst_Child == fChild) {
- if (kZero_GrBlendCoeff != srcCoeff || GrBlendCoeffRefsSrc(dstCoeff)) {
- readsInput = GrInvariantOutput::kWill_ReadInput;
- }
- } else {
- if (kZero_GrBlendCoeff != dstCoeff || GrBlendCoeffRefsDst(srcCoeff)) {
- readsInput = GrInvariantOutput::kWill_ReadInput;
- }
- }
- inout->setToOther(blendFlags, blendColor, readsInput);
+ inout->setToOther(blendFlags, blendColor);
} else {
- inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
+ inout->setToUnknown();
}
}
diff --git a/src/gpu/effects/GrYUVEffect.cpp b/src/gpu/effects/GrYUVEffect.cpp
index 41bab180ba..6b15c0dc72 100644
--- a/src/gpu/effects/GrYUVEffect.cpp
+++ b/src/gpu/effects/GrYUVEffect.cpp
@@ -187,8 +187,7 @@ private:
void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
// YUV is opaque
- inout->setToOther(kA_GrColorComponentFlag, 0xFF << GrColor_SHIFT_A,
- GrInvariantOutput::kWillNot_ReadInput);
+ inout->setToOther(kA_GrColorComponentFlag, 0xFF << GrColor_SHIFT_A);
}
GrCoordTransform fYTransform;
@@ -348,7 +347,7 @@ private:
}
void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
- inout->setToUnknown(GrInvariantOutput::kWillNot_ReadInput);
+ inout->setToUnknown();
}
GrCoordTransform fTransform;