Attach GrOptDrawState into shader building pipeline
The OptDrawState is now used for creating the actual gl shader. Current
optimizations dones in GrOptDrawState include:
All blend optimizations
Constant color/coverage stage optimizations
BUG=skia:
Committed: https://skia.googlesource.com/skia/+/ee6206572b42fec11f83ad0c1e6d435903640518
R=bsalomon@google.com, joshualitt@google.com
Author: egdaniel@google.com
Review URL: https://codereview.chromium.org/504203004
diff --git a/src/gpu/GrRODrawState.cpp b/src/gpu/GrRODrawState.cpp
index f7e486f..26edb18 100644
--- a/src/gpu/GrRODrawState.cpp
+++ b/src/gpu/GrRODrawState.cpp
@@ -184,26 +184,6 @@
dstCoeff = &bogusDstCoeff;
}
- if (forceCoverage) {
- return this->calcBlendOpts(true, srcCoeff, dstCoeff);
- }
-
- if (0 == (fBlendOptFlags & kInvalid_BlendOptFlag)) {
- *srcCoeff = fOptSrcBlend;
- *dstCoeff = fOptDstBlend;
- return fBlendOptFlags;
- }
-
- fBlendOptFlags = this->calcBlendOpts(forceCoverage, srcCoeff, dstCoeff);
- fOptSrcBlend = *srcCoeff;
- fOptDstBlend = *dstCoeff;
-
- return fBlendOptFlags;
-}
-
-GrRODrawState::BlendOptFlags GrRODrawState::calcBlendOpts(bool forceCoverage,
- GrBlendCoeff* srcCoeff,
- GrBlendCoeff* dstCoeff) const {
*srcCoeff = this->getSrcBlendCoeff();
*dstCoeff = this->getDstBlendCoeff();
@@ -225,6 +205,7 @@
if (this->getStencil().doesWrite()) {
return kEmitCoverage_BlendOptFlag;
} else {
+ *dstCoeff = kOne_GrBlendCoeff;
return kSkipDraw_BlendOptFlag;
}
}
@@ -372,13 +353,3 @@
return (kA_GrColorComponentFlag & validComponentFlags) && 0xFF == GrColorUnpackA(color);
}
-////////////////////////////////////////////////////////////////////////////////
-
-bool GrRODrawState::canIgnoreColorAttribute() const {
- if (fBlendOptFlags & kInvalid_BlendOptFlag) {
- this->getBlendOpts();
- }
- return SkToBool(fBlendOptFlags & (GrRODrawState::kEmitTransBlack_BlendOptFlag |
- GrRODrawState::kEmitCoverage_BlendOptFlag));
-}
-