Remove gpu shader optimatization for solid white or trans black colors
Running test on the added bench which draws a grid of all white paths, all blue paths, or alternating checkered white/blue paths.
With optimization in (ms):
White Blue Checkered
Linux ~80 ~80 ~160
N7 ~800 ~1100 ~1500
Moto-e ~830 ~1100 ~2500
Without optimization in (ms):
White Blue Checkered
Linux ~80 ~80 ~80
N7 ~1100 ~1100 ~1100
Moto-e ~1100 ~1100 ~1500
BUG=skia:
Committed: https://skia.googlesource.com/skia/+/5f78d2251a440443c9eaa321dad058d7a32bfef7
R=bsalomon@google.com
Author: egdaniel@google.com
Review URL: https://codereview.chromium.org/375823005
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index 14ba6fa..02c7920 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -409,6 +409,15 @@
return kNone_BlendOpt;
}
+bool GrDrawState::canIgnoreColorAttribute() const {
+ if (fBlendOptFlags & kInvalid_BlendOptFlag) {
+ this->getBlendOpts();
+ }
+ return SkToBool(fBlendOptFlags & (GrDrawState::kEmitTransBlack_BlendOptFlag |
+ GrDrawState::kEmitCoverage_BlendOptFlag));
+}
+
+
////////////////////////////////////////////////////////////////////////////////
void GrDrawState::AutoViewMatrixRestore::restore() {