Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Unified Diff: src/gpu/GrDrawState.cpp

Issue 504203004: Attach GrOptDrawState into shader building pipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@opt2
Patch Set: Rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrOptDrawState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawState.cpp
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index 642ec2669ff9e348f49153b400c75009587dc7cc..f6397446658b588c0043acbf58024b1e5cbfdde1 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -15,9 +15,17 @@
GrOptDrawState* GrDrawState::createOptState() const {
if (NULL == fCachedOptState) {
- fCachedOptState = SkNEW_ARGS(GrOptDrawState, (*this));
+ GrBlendCoeff srcCoeff;
+ GrBlendCoeff dstCoeff;
+ BlendOptFlags blendFlags = this->getBlendOpts(false, &srcCoeff, &dstCoeff);
+ fCachedOptState = SkNEW_ARGS(GrOptDrawState, (*this, blendFlags, srcCoeff, dstCoeff));
} else {
- SkASSERT(GrOptDrawState(*this) == *fCachedOptState);
+#ifdef SK_DEBUG
+ GrBlendCoeff srcCoeff;
+ GrBlendCoeff dstCoeff;
+ BlendOptFlags blendFlags = this->getBlendOpts(false, &srcCoeff, &dstCoeff);
+ SkASSERT(GrOptDrawState(*this, blendFlags, srcCoeff, dstCoeff) == *fCachedOptState);
+#endif
}
fCachedOptState->ref();
return fCachedOptState;
@@ -106,9 +114,6 @@ GrDrawState& GrDrawState::operator=(const GrDrawState& that) {
}
fColorStages = that.fColorStages;
fCoverageStages = that.fCoverageStages;
- fOptSrcBlend = that.fOptSrcBlend;
- fOptDstBlend = that.fOptDstBlend;
- fBlendOptFlags = that.fBlendOptFlags;
fHints = that.fHints;
@@ -299,7 +304,7 @@ bool GrDrawState::couldApplyCoverage(const GrDrawTargetCaps& caps) const {
// or c) the src, dst blend coeffs are 1,0 and we will read Dst Color
GrBlendCoeff srcCoeff;
GrBlendCoeff dstCoeff;
- GrRODrawState::BlendOptFlags flag = this->getBlendOpts(true, &srcCoeff, &dstCoeff);
+ BlendOptFlags flag = this->getBlendOpts(true, &srcCoeff, &dstCoeff);
return GrRODrawState::kNone_BlendOpt != flag ||
(this->willEffectReadDstColor() &&
kOne_GrBlendCoeff == srcCoeff && kZero_GrBlendCoeff == dstCoeff);
@@ -455,3 +460,16 @@ void GrDrawState::AutoViewMatrixRestore::doEffectCoordChanges(const SkMatrix& co
}
}
+////////////////////////////////////////////////////////////////////////////////
+
+void GrDrawState::invalidateOptState() const {
+ SkSafeSetNull(fCachedOptState);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+GrDrawState::~GrDrawState() {
+ SkSafeUnref(fCachedOptState);
+ SkASSERT(0 == fBlockEffectRemovalCnt);
+}
+
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrOptDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698