aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrOpList.h
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-08-22 15:01:32 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-22 20:50:08 +0000
commit407b34235750d95dfc13260ff434d6be29eab264 (patch)
treee84b3ca10d0be1efa75e0c8597373662c83d6035 /src/gpu/GrOpList.h
parent223ec293ef3cd02bf2a2a8942d55e2490ee16d66 (diff)
Add GrPrepareCallback, always run at the start of flush
This is like an op, but only has one virtual, and always runs before any ops prepare. To be used in threaded software mask rendering (to schedule ASAP uploads). Bug: skia: Change-Id: I647482e2472d7321f3685e5bdbe49e10ac59c0b1 Reviewed-on: https://skia-review.googlesource.com/37160 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrOpList.h')
-rw-r--r--src/gpu/GrOpList.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/gpu/GrOpList.h b/src/gpu/GrOpList.h
index 00dc344a07..a9fa7bdc49 100644
--- a/src/gpu/GrOpList.h
+++ b/src/gpu/GrOpList.h
@@ -26,6 +26,12 @@ class GrTextureOpList;
struct SkIPoint;
struct SkIRect;
+class GrPrepareCallback : SkNoncopyable {
+public:
+ virtual ~GrPrepareCallback() {}
+ virtual void operator()(GrOpFlushState*) = 0;
+};
+
class GrOpList : public SkRefCnt {
public:
GrOpList(GrResourceProvider*, GrSurfaceProxy*, GrAuditTrail*);
@@ -33,8 +39,8 @@ public:
// These three methods are invoked at flush time
bool instantiate(GrResourceProvider* resourceProvider);
- virtual void prepareOps(GrOpFlushState* flushState) = 0;
- virtual bool executeOps(GrOpFlushState* flushState) = 0;
+ void prepare(GrOpFlushState* flushState);
+ bool execute(GrOpFlushState* flushState) { return this->onExecute(flushState); }
virtual bool copySurface(const GrCaps& caps,
GrSurfaceProxy* dst,
@@ -51,6 +57,10 @@ public:
virtual void reset();
+ void addPrepareCallback(std::unique_ptr<GrPrepareCallback> callback) {
+ fPrepareCallbacks.push_back(std::move(callback));
+ }
+
// TODO: in an MDB world, where the OpLists don't allocate GPU resources, it seems like
// these could go away
virtual void abandonGpuResources() = 0;
@@ -147,6 +157,9 @@ private:
}
};
+ virtual void onPrepare(GrOpFlushState* flushState) = 0;
+ virtual bool onExecute(GrOpFlushState* flushState) = 0;
+
void addDependency(GrOpList* dependedOn);
uint32_t fUniqueID;
@@ -155,6 +168,9 @@ private:
// 'this' GrOpList relies on the output of the GrOpLists in 'fDependencies'
SkTDArray<GrOpList*> fDependencies;
+ // These are used rarely, most clients never produce any
+ SkTArray<std::unique_ptr<GrPrepareCallback>> fPrepareCallbacks;
+
typedef SkRefCnt INHERITED;
};