Chromium Code Reviews| Index: src/gpu/GrInOrderDrawBuffer.h |
| diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h |
| index 7780e402ed2e8b49373dfb01c2e2b1f338593f0d..e402dafd3f658772b74a3dc88496420573837ce6 100644 |
| --- a/src/gpu/GrInOrderDrawBuffer.h |
| +++ b/src/gpu/GrInOrderDrawBuffer.h |
| @@ -55,6 +55,10 @@ public: |
| virtual ~GrInOrderDrawBuffer(); |
| + GrGpu* dstGpu() const { return fDstGpu; } |
|
bsalomon
2014/11/13 17:36:05
Does this need to be public? Otherwise looks good.
Chris Dalton
2014/11/13 19:05:43
Done.
|
| + const uint32_t* pathIndexBuffer() const { return fPathIndexBuffer.begin(); } |
| + const float* pathTransformBuffer() const { return fPathTransformBuffer.begin(); } |
| + |
| /** |
| * Empties the draw buffer of any queued up draws. This must not be called while inside an |
| * unbalanced pushGeometrySource(). The current draw state and clip are preserved. |
| @@ -110,7 +114,7 @@ private: |
| Cmd(uint8_t type) : fType(type) {} |
| virtual ~Cmd() {} |
| - virtual void execute(GrGpu*, const GrOptDrawState*) = 0; |
| + virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) = 0; |
| uint8_t fType; |
| }; |
| @@ -129,7 +133,7 @@ private: |
| const GrVertexBuffer* vertexBuffer() const { return fVertexBuffer.get(); } |
| const GrIndexBuffer* indexBuffer() const { return fIndexBuffer.get(); } |
| - virtual void execute(GrGpu*, const GrOptDrawState*); |
| + virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); |
| DrawInfo fInfo; |
| ScissorState fScissorState; |
| @@ -144,7 +148,7 @@ private: |
| const GrPath* path() const { return fPath.get(); } |
| - virtual void execute(GrGpu*, const GrOptDrawState*); |
| + virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); |
| ScissorState fScissorState; |
| GrStencilSettings fStencilSettings; |
| @@ -158,7 +162,7 @@ private: |
| const GrPath* path() const { return fPath.get(); } |
| - virtual void execute(GrGpu*, const GrOptDrawState*); |
| + virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); |
| GrDeviceCoordTexture fDstCopy; |
| ScissorState fScissorState; |
| @@ -172,12 +176,12 @@ private: |
| DrawPaths(const GrPathRange* pathRange) : Cmd(kDrawPaths_Cmd), fPathRange(pathRange) {} |
| const GrPathRange* pathRange() const { return fPathRange.get(); } |
| - uint32_t* indices() { return reinterpret_cast<uint32_t*>(CmdBuffer::GetDataForItem(this)); } |
| - float* transforms() { return reinterpret_cast<float*>(&this->indices()[fCount]); } |
| - virtual void execute(GrGpu*, const GrOptDrawState*); |
| + virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); |
| + int fIndicesLocation; |
| size_t fCount; |
| + int fTransformsLocation; |
| PathTransformType fTransformsType; |
| GrDeviceCoordTexture fDstCopy; |
| ScissorState fScissorState; |
| @@ -193,7 +197,7 @@ private: |
| GrRenderTarget* renderTarget() const { return fRenderTarget.get(); } |
| - virtual void execute(GrGpu*, const GrOptDrawState*); |
| + virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); |
| SkIRect fRect; |
| GrColor fColor; |
| @@ -209,7 +213,7 @@ private: |
| GrRenderTarget* renderTarget() const { return fRenderTarget.get(); } |
| - virtual void execute(GrGpu*, const GrOptDrawState*); |
| + virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); |
| SkIRect fRect; |
| bool fInsideClip; |
| @@ -224,7 +228,7 @@ private: |
| GrSurface* dst() const { return fDst.get(); } |
| GrSurface* src() const { return fSrc.get(); } |
| - virtual void execute(GrGpu*, const GrOptDrawState*); |
| + virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); |
| SkIPoint fDstPoint; |
| SkIRect fSrcRect; |
| @@ -237,7 +241,7 @@ private: |
| struct SetState : public Cmd { |
| SetState(const GrDrawState& state) : Cmd(kSetState_Cmd), fState(state) {} |
| - virtual void execute(GrGpu*, const GrOptDrawState*); |
| + virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); |
| GrDrawState fState; |
| GrGpu::DrawType fDrawType; |
| @@ -301,6 +305,8 @@ private: |
| // TODO: Use a single allocator for commands and records |
| enum { |
| kCmdBufferInitialSizeInBytes = 8 * 1024, |
| + kPathIdxBufferMinReserve = 64, |
| + kPathXformBufferMinReserve = 2 * kPathIdxBufferMinReserve, |
| kGeoPoolStatePreAllocCnt = 4, |
| }; |
| @@ -310,6 +316,8 @@ private: |
| GrGpu* fDstGpu; |
| GrVertexBufferAllocPool& fVertexPool; |
| GrIndexBufferAllocPool& fIndexPool; |
| + SkTDArray<uint32_t> fPathIndexBuffer; |
| + SkTDArray<float> fPathTransformBuffer; |
| struct GeometryPoolState { |
| const GrVertexBuffer* fPoolVertexBuffer; |