aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2014-07-30 13:18:32 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-07-30 13:18:32 -0700
commit0f1a7c42d7e98fcd682501f1944fd42f3ce3a894 (patch)
tree0e00c71f614fc6cbe3770eb18f953da6b6bf9a27 /src/gpu
parentb3abe90145b988883c9882de1ac42da963adbf67 (diff)
Remove kDisableBlend_BlendOptFlag as it is no longer needed
BUG=skia: R=bsalomon@google.com Author: egdaniel@google.com Review URL: https://codereview.chromium.org/425153003
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrDrawState.cpp16
-rw-r--r--src/gpu/GrDrawState.h12
-rw-r--r--src/gpu/GrDrawTarget.cpp10
3 files changed, 17 insertions, 21 deletions
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index 02c7920f5d..1b40642251 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -339,8 +339,7 @@ GrDrawState::BlendOptFlags GrDrawState::calcBlendOpts(bool forceCoverage,
// (0,1). The same applies when coverage is known to be 0.
if ((kZero_GrBlendCoeff == *srcCoeff && dstCoeffIsOne) || covIsZero) {
if (this->getStencil().doesWrite()) {
- return kDisableBlend_BlendOptFlag |
- kEmitCoverage_BlendOptFlag;
+ return kEmitCoverage_BlendOptFlag;
} else {
return kSkipDraw_BlendOptFlag;
}
@@ -359,13 +358,14 @@ GrDrawState::BlendOptFlags GrDrawState::calcBlendOpts(bool forceCoverage,
if (kOne_GrBlendCoeff == *srcCoeff) {
// if there is no coverage and coeffs are (1,0) then we
// won't need to read the dst at all, it gets replaced by src
- return kDisableBlend_BlendOptFlag;
+ *dstCoeff = kZero_GrBlendCoeff;
+ return kNone_BlendOpt;
} else if (kZero_GrBlendCoeff == *srcCoeff) {
// if the op is "clear" then we don't need to emit a color
// or blend, just write transparent black into the dst.
*srcCoeff = kOne_GrBlendCoeff;
*dstCoeff = kZero_GrBlendCoeff;
- return kDisableBlend_BlendOptFlag | kEmitTransBlack_BlendOptFlag;
+ return kEmitTransBlack_BlendOptFlag;
}
}
} else if (this->isCoverageDrawing()) {
@@ -399,13 +399,7 @@ GrDrawState::BlendOptFlags GrDrawState::calcBlendOpts(bool forceCoverage,
return kCoverageAsAlpha_BlendOptFlag;
}
}
- if (kOne_GrBlendCoeff == *srcCoeff &&
- kZero_GrBlendCoeff == *dstCoeff &&
- this->willEffectReadDstColor()) {
- // In this case the shader will fully resolve the color, coverage, and dst and we don't
- // need blending.
- return kDisableBlend_BlendOptFlag;
- }
+
return kNone_BlendOpt;
}
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index c1dd9dcd36..d1b7a66f5c 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -521,28 +521,24 @@ public:
*/
kSkipDraw_BlendOptFlag = 0x1,
/**
- * Emit the src color, disable HW blending (replace dst with src)
- */
- kDisableBlend_BlendOptFlag = 0x2,
- /**
* The coverage value does not have to be computed separately from alpha, the the output
* color can be the modulation of the two.
*/
- kCoverageAsAlpha_BlendOptFlag = 0x4,
+ kCoverageAsAlpha_BlendOptFlag = 0x2,
/**
* Instead of emitting a src color, emit coverage in the alpha channel and r,g,b are
* "don't cares".
*/
- kEmitCoverage_BlendOptFlag = 0x8,
+ kEmitCoverage_BlendOptFlag = 0x4,
/**
* Emit transparent black instead of the src color, no need to compute coverage.
*/
- kEmitTransBlack_BlendOptFlag = 0x10,
+ kEmitTransBlack_BlendOptFlag = 0x8,
/**
* Flag used to invalidate the cached BlendOptFlags, OptSrcCoeff, and OptDstCoeff cached by
* the get BlendOpts function.
*/
- kInvalid_BlendOptFlag = 0x20,
+ kInvalid_BlendOptFlag = 1 << 31,
};
GR_DECL_BITFIELD_OPS_FRIENDS(BlendOptFlags);
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 10fa6b202d..fd5e476c4e 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -615,9 +615,15 @@ void GrDrawTarget::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
bool GrDrawTarget::canApplyCoverage() const {
// we can correctly apply coverage if a) we have dual source blending
- // or b) one of our blend optimizations applies.
+ // or b) one of our blend optimizations applies
+ // or c) the src, dst blend coeffs are 1,0 and we will read Dst Color
+ GrBlendCoeff srcCoeff;
+ GrBlendCoeff dstCoeff;
+ GrDrawState::BlendOptFlags flag = this->getDrawState().getBlendOpts(true, &srcCoeff, &dstCoeff);
return this->caps()->dualSourceBlendingSupport() ||
- GrDrawState::kNone_BlendOpt != this->getDrawState().getBlendOpts(true);
+ GrDrawState::kNone_BlendOpt != flag ||
+ (this->getDrawState().willEffectReadDstColor() &&
+ kOne_GrBlendCoeff == srcCoeff && kZero_GrBlendCoeff == dstCoeff);
}
////////////////////////////////////////////////////////////////////////////////