aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrOpList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrOpList.cpp')
-rw-r--r--src/gpu/GrOpList.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/gpu/GrOpList.cpp b/src/gpu/GrOpList.cpp
index 313c38f14c..12d15afe6a 100644
--- a/src/gpu/GrOpList.cpp
+++ b/src/gpu/GrOpList.cpp
@@ -96,6 +96,9 @@ void GrOpList::addDependency(GrOpList* dependedOn) {
}
fDependencies.push_back(dependedOn);
+ dependedOn->addDependent(this);
+
+ SkDEBUGCODE(this->validate());
}
// Convert from a GrSurface-based dependency to a GrOpList one
@@ -134,6 +137,38 @@ bool GrOpList::dependsOn(const GrOpList* dependedOn) const {
return false;
}
+void GrOpList::addDependent(GrOpList* dependent) {
+ fDependents.push_back(dependent);
+}
+
+#ifdef SK_DEBUG
+bool GrOpList::isDependedent(const GrOpList* dependent) const {
+ for (int i = 0; i < fDependents.count(); ++i) {
+ if (fDependents[i] == dependent) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void GrOpList::validate() const {
+ // TODO: check for loops and duplicates
+
+ for (int i = 0; i < fDependencies.count(); ++i) {
+ SkASSERT(fDependencies[i]->isDependedent(this));
+ }
+}
+#endif
+
+void GrOpList::closeThoseWhoDependOnMe(const GrCaps& caps) {
+ for (int i = 0; i < fDependents.count(); ++i) {
+ if (!fDependents[i]->isClosed()) {
+ fDependents[i]->makeClosed(caps);
+ }
+ }
+}
+
bool GrOpList::isInstantiated() const {
return fTarget.get()->priv().isInstantiated();
}
@@ -158,6 +193,12 @@ void GrOpList::dump(bool printDependencies) const {
SkDebugf("%d, ", fDependencies[i]->fUniqueID);
}
SkDebugf("\n");
+
+ SkDebugf("(%d) Rely On Me: ", fDependents.count());
+ for (int i = 0; i < fDependents.count(); ++i) {
+ SkDebugf("%d, ", fDependents[i]->fUniqueID);
+ }
+ SkDebugf("\n");
}
}
#endif