Add method to iterate over a GrOp's GrSurfaceProxies
The extra generality of having a std::function is for MDB reordering. In the current MDB reordering world there is one pass through the surfaceProxies at creation time and a second pass after flush to create the usage intervals.
Change-Id: I3f548417eddc1dad7503d919241301e404255ffe
Reviewed-on: https://skia-review.googlesource.com/46200
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h
index ef4bdac..d80f667 100644
--- a/src/gpu/GrRenderTargetOpList.h
+++ b/src/gpu/GrRenderTargetOpList.h
@@ -68,12 +68,28 @@
bool onExecute(GrOpFlushState* flushState) override;
uint32_t addOp(std::unique_ptr<GrOp> op, const GrCaps& caps) {
+ auto addDependency = [ &caps, this ] (GrSurfaceProxy* p) {
+ this->addDependency(p, caps);
+ };
+
+ op->visitProxies(addDependency);
+
this->recordOp(std::move(op), caps, nullptr, nullptr);
+
return this->uniqueID();
}
+
uint32_t addOp(std::unique_ptr<GrOp> op, const GrCaps& caps,
GrAppliedClip&& clip, const DstProxy& dstProxy) {
+ auto addDependency = [ &caps, this ] (GrSurfaceProxy* p) {
+ this->addDependency(p, caps);
+ };
+
+ op->visitProxies(addDependency);
+ clip.visitProxies(addDependency);
+
this->recordOp(std::move(op), caps, clip.doesClip() ? &clip : nullptr, &dstProxy);
+
return this->uniqueID();
}