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

Unified Diff: src/gpu/GrDrawState.cpp

Issue 647183002: Revert of Opt state takes a GP instead of a GeometryStage (Closed) Base URL: https://skia.googlesource.com/skia.git@builder_cleanup
Patch Set: Created 6 years, 2 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/GrDrawTarget.cpp » ('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 e1fa6da8774307cf1c115db2ba64d6e772e857a6..288fa12730850316750b1992446ee7381a860d83 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -43,7 +43,9 @@
if (this->hasGeometryProcessor()) {
if (!that.hasGeometryProcessor()) {
return false;
- } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProcessor())) {
+ } else if (!GrProcessorStage::AreCompatible(*this->getGeometryProcessor(),
+ *that.getGeometryProcessor(),
+ explicitLocalCoords)) {
return false;
}
} else if (that.hasGeometryProcessor()) {
@@ -51,13 +53,13 @@
}
for (int i = 0; i < this->numColorStages(); i++) {
- if (!GrFragmentStage::AreCompatible(this->getColorStage(i), that.getColorStage(i),
+ if (!GrProcessorStage::AreCompatible(this->getColorStage(i), that.getColorStage(i),
explicitLocalCoords)) {
return false;
}
}
for (int i = 0; i < this->numCoverageStages(); i++) {
- if (!GrFragmentStage::AreCompatible(this->getCoverageStage(i), that.getCoverageStage(i),
+ if (!GrProcessorStage::AreCompatible(this->getCoverageStage(i), that.getCoverageStage(i),
explicitLocalCoords)) {
return false;
}
@@ -114,6 +116,9 @@
SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
*this = state;
if (!preConcatMatrix.isIdentity()) {
+ if (this->hasGeometryProcessor()) {
+ fGeometryProcessor->localCoordChange(preConcatMatrix);
+ }
for (int i = 0; i < this->numColorStages(); ++i) {
fColorStages[i].localCoordChange(preConcatMatrix);
}
@@ -142,7 +147,7 @@
fCoverage = that.fCoverage;
fDrawFace = that.fDrawFace;
if (that.hasGeometryProcessor()) {
- fGeometryProcessor.initAndRef(that.fGeometryProcessor);
+ fGeometryProcessor.reset(SkNEW_ARGS(GrGeometryStage, (*that.fGeometryProcessor.get())));
} else {
fGeometryProcessor.reset(NULL);
}
@@ -197,6 +202,9 @@
// sad trombone sound
return false;
}
+ if (this->hasGeometryProcessor()) {
+ fGeometryProcessor->localCoordChange(invVM);
+ }
for (int s = 0; s < this->numColorStages(); ++s) {
fColorStages[s].localCoordChange(invVM);
}
@@ -257,7 +265,9 @@
}
if (this->hasGeometryProcessor()) {
- const GrGeometryProcessor* gp = this->getGeometryProcessor();
+ const GrGeometryStage& stage = *this->getGeometryProcessor();
+ const GrGeometryProcessor* gp = stage.getProcessor();
+ SkASSERT(gp);
// make sure that any attribute indices have the correct binding type, that the attrib
// type and effect's shader lang type are compatible, and that attributes shared by
// multiple effects use the same shader lang type.
@@ -400,7 +410,8 @@
// Run through the coverage stages and see if the coverage will be all ones at the end.
if (this->hasGeometryProcessor()) {
- fGeometryProcessor->computeInvariantOutput(&inout);
+ const GrGeometryProcessor* gp = fGeometryProcessor->getProcessor();
+ gp->computeInvariantOutput(&inout);
}
for (int s = 0; s < this->numCoverageStages(); ++s) {
@@ -445,7 +456,7 @@
if (SK_InvalidUniqueID == fOriginalGPID) {
fDrawState->fGeometryProcessor.reset(NULL);
} else {
- SkASSERT(fDrawState->getGeometryProcessor()->getUniqueID() ==
+ SkASSERT(fDrawState->getGeometryProcessor()->getProcessor()->getUniqueID() ==
fOriginalGPID);
fOriginalGPID = SK_InvalidUniqueID;
}
@@ -466,7 +477,7 @@
if (NULL != ds) {
SkASSERT(SK_InvalidUniqueID == fOriginalGPID);
if (NULL != ds->getGeometryProcessor()) {
- fOriginalGPID = ds->getGeometryProcessor()->getUniqueID();
+ fOriginalGPID = ds->getGeometryProcessor()->getProcessor()->getUniqueID();
}
fColorEffectCnt = ds->numColorStages();
fCoverageEffectCnt = ds->numCoverageStages();
@@ -504,9 +515,14 @@
fDrawState->fViewMatrix = fViewMatrix;
SkASSERT(fDrawState->numColorStages() >= fNumColorStages);
int numCoverageStages = fSavedCoordChanges.count() - fNumColorStages;
+ numCoverageStages -= fHasGeometryProcessor ? 1 : 0;
SkASSERT(fDrawState->numCoverageStages() >= numCoverageStages);
int i = 0;
+ if (fHasGeometryProcessor) {
+ SkASSERT(fDrawState->hasGeometryProcessor());
+ fDrawState->fGeometryProcessor->restoreCoordChange(fSavedCoordChanges[i++]);
+ }
for (int s = 0; s < fNumColorStages; ++s, ++i) {
fDrawState->fColorStages[s].restoreCoordChange(fSavedCoordChanges[i]);
}
@@ -552,6 +568,7 @@
if (0 == drawState->numTotalStages()) {
drawState->fViewMatrix.reset();
fDrawState = drawState;
+ fHasGeometryProcessor = false;
fNumColorStages = 0;
fSavedCoordChanges.reset(0);
SkDEBUGCODE(++fDrawState->fBlockEffectRemovalCnt;)
@@ -573,6 +590,13 @@
fSavedCoordChanges.reset(fDrawState->numTotalStages());
int i = 0;
+ fHasGeometryProcessor = false;
+ if (fDrawState->hasGeometryProcessor()) {
+ fDrawState->fGeometryProcessor->saveCoordChange(&fSavedCoordChanges[i++]);
+ fDrawState->fGeometryProcessor->localCoordChange(coordChangeMatrix);
+ fHasGeometryProcessor = true;
+ }
+
fNumColorStages = fDrawState->numColorStages();
for (int s = 0; s < fNumColorStages; ++s, ++i) {
fDrawState->getColorStage(s).saveCoordChange(&fSavedCoordChanges[i]);
@@ -595,7 +619,7 @@
fColorStages[i].convertToPendingExec();
}
if (fGeometryProcessor) {
- fGeometryProcessor.convertToPendingExec();
+ fGeometryProcessor->convertToPendingExec();
}
for (int i = 0; i < fCoverageStages.count(); ++i) {
fCoverageStages[i].convertToPendingExec();
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698