aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrOptDrawState.cpp13
-rw-r--r--src/gpu/GrProcessor.cpp3
-rw-r--r--src/gpu/effects/GrConvexPolyEffect.cpp2
-rw-r--r--src/gpu/effects/GrDitherEffect.cpp2
-rw-r--r--src/gpu/effects/GrYUVtoRGBEffect.cpp4
5 files changed, 16 insertions, 8 deletions
diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp
index 7c8710f7d6..40e0c6ce1f 100644
--- a/src/gpu/GrOptDrawState.cpp
+++ b/src/gpu/GrOptDrawState.cpp
@@ -244,16 +244,19 @@ void GrOptDrawState::computeEffectiveColorStages(const GrDrawState& ds, int* fir
for (int i = 0; i < ds.numColorStages(); ++i) {
const GrFragmentProcessor* fp = ds.getColorStage(i).getProcessor();
- if (!fp->willUseInputColor()) {
+ fp->computeInvariantOutput(&inout);
+ if (!inout.fWillUseInputColor) {
*firstColorStageIdx = i;
fInputColorIsUsed = false;
}
- fp->computeInvariantOutput(&inout);
if (kRGBA_GrColorComponentFlags == inout.fValidFlags) {
*firstColorStageIdx = i + 1;
fColor = inout.fColor;
fInputColorIsUsed = true;
*fixedFunctionVAToRemove |= 0x1 << kColor_GrVertexAttribBinding;
+ // 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.
+ inout.fNonMulStageFound = false;
}
}
}
@@ -267,9 +270,11 @@ void GrOptDrawState::computeEffectiveCoverageStages(const GrDrawState& ds,
// Don't do any optimizations on coverage stages. It should not be the case where we do not use
// input coverage in an effect
#ifdef OptCoverageStages
+ GrProcessor::InvariantOutput inout;
for (int i = 0; i < ds.numCoverageStages(); ++i) {
- const GrProcessor* processor = ds.getCoverageStage(i).getProcessor();
- if (!processor->willUseInputColor()) {
+ const GrFragmentProcessor* fp = ds.getCoverageStage(i).getProcessor();
+ fp->computeInvariantOutput(&inout);
+ if (!inout.fWillUseInputColor) {
*firstCoverageStageIdx = i;
fInputCoverageIsUsed = false;
}
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp
index bf65cb0fb9..04401c8adf 100644
--- a/src/gpu/GrProcessor.cpp
+++ b/src/gpu/GrProcessor.cpp
@@ -133,6 +133,9 @@ void GrProcessor::InvariantOutput::validate() const {
}
SkASSERT(this->validPreMulColor());
+
+ // If we claim that we are not using the input color we must not be modulating the input.
+ SkASSERT(fNonMulStageFound || fWillUseInputColor);
}
bool GrProcessor::InvariantOutput::colorComponentsAllEqual() const {
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index bafa64d13a..c84b540850 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -46,7 +46,7 @@ private:
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE {
if (fRect.isEmpty()) {
// An empty rect will have no coverage anywhere.
- inout->setToTransparentBlack();
+ inout->mulByKnownAlpha(0);
} else {
inout->mulByUnknownAlpha();
}
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp
index 068a23eae7..643829b848 100644
--- a/src/gpu/effects/GrDitherEffect.cpp
+++ b/src/gpu/effects/GrDitherEffect.cpp
@@ -50,7 +50,7 @@ private:
};
void DitherEffect::onComputeInvariantOutput(InvariantOutput* inout) const {
- inout->setToUnknown();
+ inout->setToUnknown(InvariantOutput::kWill_ReadInput);
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index f280d1bdd4..b18bd7fa01 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -99,7 +99,6 @@ private:
this->addTextureAccess(&fYAccess);
this->addTextureAccess(&fUAccess);
this->addTextureAccess(&fVAccess);
- this->setWillNotUseInputColor();
}
virtual bool onIsEqual(const GrFragmentProcessor& sBase) const {
@@ -112,7 +111,8 @@ private:
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE {
// YUV is opaque
- inout->setToOther(kA_GrColorComponentFlag, 0xFF << GrColor_SHIFT_A);
+ inout->setToOther(kA_GrColorComponentFlag, 0xFF << GrColor_SHIFT_A,
+ InvariantOutput::kWill_ReadInput);
}
GrCoordTransform fCoordTransform;