Chromium Code Reviews| Index: src/gpu/GrDrawTarget.h |
| diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h |
| index db637d52b10add9e59421d726cb1bab2d44710a5..112357d1f92d165195dad77b3aaa9c2136447ec6 100644 |
| --- a/src/gpu/GrDrawTarget.h |
| +++ b/src/gpu/GrDrawTarget.h |
| @@ -49,14 +49,48 @@ public: |
| ~GrDrawTarget() override; |
| + enum Flags { |
| + kClosed_Flag = 0x01, //!< This drawTarget can't accept any more batches |
| + |
| + kWasOutput_Flag = 0x02, //!< Flag for topological sorting |
| + kTempMark_Flag = 0x04, //!< Flag for topological sorting |
| + }; |
| + |
| void makeClosed() { |
| // We only close drawTargets When MDB is enabled. When MDB is disabled there is only |
| // ever one drawTarget and all calls will be funnelled into it. |
| #ifdef ENABLE_MDB |
| - fClosed = true; |
| + this->setFlag(kClosed_Flag); |
| #endif |
| } |
| - bool isClosed() const { return fClosed; } |
| + bool isClosed() const { return this->isSetFlag(kClosed_Flag); } |
| + |
| + void setFlag(uint32_t flag) { |
|
bsalomon
2015/10/20 13:57:19
I'm wondering if all this stuff needs to be public
robertphillips
2015/10/20 14:10:49
Done.
|
| + fFlags |= flag; |
| + } |
| + |
| + void resetFlag(uint32_t flag) { |
| + fFlags &= ~flag; |
| + } |
| + |
| + bool isSetFlag(uint32_t flag) const { |
| + return SkToBool(fFlags & flag); |
| + } |
| + |
| + // This drawTarget relies on the contents of 'dependedOn' |
| + void addDependency(GrSurface* dependedOn); |
| + |
| + bool dependsOn(GrDrawTarget* dependedOn) const { |
| + return fDependencies.find(dependedOn) >= 0; |
| + } |
| + |
| + int numDependencies() const { |
| + return fDependencies.count(); |
| + } |
| + |
| + GrDrawTarget* dependency(int index) { |
| + return fDependencies[index]; |
| + } |
| /** |
| * Empties the draw buffer of any queued up draws. |
| @@ -231,6 +265,8 @@ private: |
| GrScissorState*, |
| const SkRect* devBounds); |
| + void addDependency(GrDrawTarget* dependedOn); |
| + |
| // Used only by CMM. |
| void clearStencilClip(const SkIRect&, bool insideClip, GrRenderTarget*); |
| @@ -244,7 +280,10 @@ private: |
| bool fFlushing; |
| int fFirstUnpreparedBatch; |
| - bool fClosed; |
| + uint32_t fFlags; |
| + |
| + // 'this' drawTarget relies on the output of the drawTargets in 'fDependencies' |
| + SkTDArray<GrDrawTarget*> fDependencies; |
| typedef SkRefCnt INHERITED; |
| }; |