Chromium Code Reviews| Index: src/gpu/GrInOrderDrawBuffer.h |
| diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h |
| index ce82c889a76037d7ed751308d8f630bf77dff12a..b253768f84bdde01d8b8844fc039dcb9dc6fa334 100644 |
| --- a/src/gpu/GrInOrderDrawBuffer.h |
| +++ b/src/gpu/GrInOrderDrawBuffer.h |
| @@ -72,6 +72,17 @@ protected: |
| private: |
| friend class GrTargetCommands; |
| + typedef GrTargetCommands::State State; |
| + |
| + State* allocState(const GrPrimitiveProcessor* primProc = NULL) { |
| + void* allocation = fPipelineBuffer.alloc(sizeof(State), SkChunkAlloc::kThrow_AllocFailType); |
| + return SkNEW_PLACEMENT_ARGS(allocation, State, (primProc)); |
| + } |
| + |
| + void unallocState(State* state) { |
| + state->unref(); |
| + fPipelineBuffer.unalloc(state); |
| + } |
| void onReset() override; |
| void onFlush() override; |
| @@ -84,7 +95,6 @@ private: |
| const SkRect& rect, |
| const SkRect* localRect, |
| const SkMatrix* localMatrix) override; |
| - |
| void onStencilPath(const GrPipelineBuilder&, |
| const GrPathProcessor*, |
| const GrPath*, |
| @@ -122,17 +132,29 @@ private: |
| } |
| bool isIssued(uint32_t drawID) override { return drawID != fDrawID; } |
| + State* SK_WARN_UNUSED_RESULT setupPipelineAndShouldDraw(const GrPrimitiveProcessor*, |
| + const GrDrawTarget::PipelineInfo&); |
| + State* SK_WARN_UNUSED_RESULT setupPipelineAndShouldDraw(GrBatch*, |
| + const GrDrawTarget::PipelineInfo&); |
| + |
| // TODO: Use a single allocator for commands and records |
| enum { |
| kPathIdxBufferMinReserve = 2 * 64, // 64 uint16_t's |
| kPathXformBufferMinReserve = 2 * 64, // 64 two-float transforms |
| + kPipelineBufferMinReserve = 32 * sizeof(State), |
|
joshualitt
2015/05/01 19:55:02
Not sure what we should preallocate
|
| }; |
| + // every 100 flushes we should reset our fPipelineBuffer to prevent us from holding at a |
| + // highwater mark |
| + static const int kPipelineBufferHighWaterMark = 100; |
| + |
| GrTargetCommands fCommands; |
| SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers; |
| SkChunkAlloc fPathIndexBuffer; |
| SkChunkAlloc fPathTransformBuffer; |
| + SkChunkAlloc fPipelineBuffer; |
| uint32_t fDrawID; |
| + SkAutoTUnref<State> fPrevState; |
| typedef GrClipTarget INHERITED; |
| }; |