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

Unified Diff: src/gpu/GrDrawState.cpp

Issue 739673002: Create GrOptDrawState before recording draw in GrInOrderDrawBuffer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove unused function in pendingprogramelement Created 6 years, 1 month 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/GrDrawTarget.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 6558b0d5facc8785587116f9c19b255b3a40fc86..fef549463a327d0236f647a18243f6d01ecd5e4b 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -72,43 +72,6 @@ bool GrDrawState::isEqual(const GrDrawState& that) const {
return true;
}
-GrDrawState::CombinedState GrDrawState::CombineIfPossible(
- const GrDrawState& a, const GrDrawState& b, const GrDrawTargetCaps& caps) {
-
- if (!a.isEqual(b)) {
- return kIncompatible_CombinedState;
- }
-
- // If the general draw states are equal (from check above) we know hasColorVertexAttribute()
- // is equivalent for both a and b
- if (a.hasColorVertexAttribute()) {
- // If one is opaque and the other is not then the combined state is not opaque. Moreover,
- // if the opaqueness affects the ability to get color/coverage blending correct then we
- // don't combine the draw states.
- bool aIsOpaque = (kVertexColorsAreOpaque_Hint & a.fHints);
- bool bIsOpaque = (kVertexColorsAreOpaque_Hint & b.fHints);
- if (aIsOpaque != bIsOpaque) {
- const GrDrawState* opaque;
- const GrDrawState* nonOpaque;
- if (aIsOpaque) {
- opaque = &a;
- nonOpaque = &b;
- } else {
- opaque = &b;
- nonOpaque = &a;
- }
- if (!opaque->hasSolidCoverage() && opaque->couldApplyCoverage(caps)) {
- SkASSERT(!nonOpaque->hasSolidCoverage());
- if (!nonOpaque->couldApplyCoverage(caps)) {
- return kIncompatible_CombinedState;
- }
- }
- return aIsOpaque ? kB_CombinedState : kA_CombinedState;
- }
- }
- return kAOrB_CombinedState;
-}
-
//////////////////////////////////////////////////////////////////////////////s
GrDrawState::GrDrawState(const GrDrawState& state, const SkMatrix& preConcatMatrix) {
@@ -125,10 +88,7 @@ GrDrawState::GrDrawState(const GrDrawState& state, const SkMatrix& preConcatMatr
}
GrDrawState& GrDrawState::operator=(const GrDrawState& that) {
- SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages());
- SkASSERT(!that.fRenderTarget.ownsPendingIO());
- SkASSERT(!this->fRenderTarget.ownsPendingIO());
- this->setRenderTarget(that.getRenderTarget());
+ fRenderTarget.reset(SkSafeRef(that.fRenderTarget.get()));
fColor = that.fColor;
fViewMatrix = that.fViewMatrix;
fSrcBlend = that.fSrcBlend;
@@ -141,11 +101,7 @@ GrDrawState& GrDrawState::operator=(const GrDrawState& that) {
fStencilSettings = that.fStencilSettings;
fCoverage = that.fCoverage;
fDrawFace = that.fDrawFace;
- if (that.hasGeometryProcessor()) {
- fGeometryProcessor.initAndRef(that.fGeometryProcessor);
- } else {
- fGeometryProcessor.reset(NULL);
- }
+ fGeometryProcessor.reset(SkSafeRef(that.fGeometryProcessor.get()));
fColorStages = that.fColorStages;
fCoverageStages = that.fCoverageStages;
@@ -168,13 +124,12 @@ GrDrawState& GrDrawState::operator=(const GrDrawState& that) {
void GrDrawState::onReset(const SkMatrix* initialViewMatrix) {
SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages());
- SkASSERT(!fRenderTarget.ownsPendingIO());
+ fRenderTarget.reset(NULL);
fGeometryProcessor.reset(NULL);
fColorStages.reset();
fCoverageStages.reset();
- fRenderTarget.reset();
this->setDefaultVertexAttribs();
@@ -577,22 +532,6 @@ void GrDrawState::AutoViewMatrixRestore::doEffectCoordChanges(const SkMatrix& co
////////////////////////////////////////////////////////////////////////////////
-void GrDrawState::convertToPendingExec() {
- fRenderTarget.markPendingIO();
- fRenderTarget.removeRef();
- for (int i = 0; i < fColorStages.count(); ++i) {
- fColorStages[i].convertToPendingExec();
- }
- if (fGeometryProcessor) {
- fGeometryProcessor.convertToPendingExec();
- }
- for (int i = 0; i < fCoverageStages.count(); ++i) {
- fCoverageStages[i].convertToPendingExec();
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
GrDrawState::~GrDrawState() {
SkASSERT(0 == fBlockEffectRemovalCnt);
}
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698