aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrOpList.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-05-11 16:29:14 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-12 12:10:31 +0000
commit6cdc22cde8e6297d34fdaaa3ed5e69ae86c30a77 (patch)
treea2462bae16096f92b528d059ff1fb95881ed8d0d /src/gpu/GrOpList.cpp
parent5c7960be57010bf61db3d4ce879a3194687b5af9 (diff)
Split up opLists (take 3)
Reland of: https://skia-review.googlesource.com/c/11581/ (Split up opLists) https://skia-review.googlesource.com/c/13860/ (Make InstancedRendering more opList-splitting friendly) has landed so this should be good for another attempt. TBR=egdaniel@google.com Change-Id: I2a09729342bb035af3a16807c1895adbae432ade Reviewed-on: https://skia-review.googlesource.com/14186 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrOpList.cpp')
-rw-r--r--src/gpu/GrOpList.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/gpu/GrOpList.cpp b/src/gpu/GrOpList.cpp
index a088c447ae..cf67dab910 100644
--- a/src/gpu/GrOpList.cpp
+++ b/src/gpu/GrOpList.cpp
@@ -21,21 +21,28 @@ uint32_t GrOpList::CreateUniqueID() {
}
GrOpList::GrOpList(GrSurfaceProxy* surfaceProxy, GrAuditTrail* auditTrail)
- // MDB TODO: in the future opLists will own the GrSurfaceProxy they target.
- // For now, preserve the status quo.
- : fTarget(surfaceProxy)
- , fAuditTrail(auditTrail)
+ : fAuditTrail(auditTrail)
, fUniqueID(CreateUniqueID())
, fFlags(0) {
- surfaceProxy->setLastOpList(this);
+ fTarget.reset(surfaceProxy);
+ fTarget.get()->setLastOpList(this);
}
GrOpList::~GrOpList() {
- if (fTarget && this == fTarget->getLastOpList()) {
- fTarget->setLastOpList(nullptr);
+ if (fTarget.get() && this == fTarget.get()->getLastOpList()) {
+ fTarget.get()->setLastOpList(nullptr);
}
}
+void GrOpList::reset() {
+ if (fTarget.get() && this == fTarget.get()->getLastOpList()) {
+ fTarget.get()->setLastOpList(nullptr);
+ }
+
+ fTarget.reset(nullptr);
+ fAuditTrail = nullptr;
+}
+
// Add a GrOpList-based dependency
void GrOpList::addDependency(GrOpList* dependedOn) {
SkASSERT(!dependedOn->dependsOn(this)); // loops are bad
@@ -68,7 +75,8 @@ void GrOpList::addDependency(GrSurfaceProxy* dependedOn, const GrCaps& caps) {
#ifdef SK_DEBUG
void GrOpList::dump() const {
SkDebugf("--------------------------------------------------------------\n");
- SkDebugf("node: %d -> RT: %d\n", fUniqueID, fTarget ? fTarget->uniqueID().asUInt() : -1);
+ SkDebugf("node: %d -> RT: %d\n", fUniqueID, fTarget.get() ? fTarget.get()->uniqueID().asUInt()
+ : -1);
SkDebugf("relies On (%d): ", fDependencies.count());
for (int i = 0; i < fDependencies.count(); ++i) {
SkDebugf("%d, ", fDependencies[i]->fUniqueID);