OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrBufferedDrawTarget_DEFINED | 8 #ifndef GrBufferedDrawTarget_DEFINED |
9 #define GrBufferedDrawTarget_DEFINED | 9 #define GrBufferedDrawTarget_DEFINED |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 const GrStencilSettings&, | 98 const GrStencilSettings&, |
99 const PipelineInfo&) override; | 99 const PipelineInfo&) override; |
100 void onClear(const SkIRect& rect, | 100 void onClear(const SkIRect& rect, |
101 GrColor color, | 101 GrColor color, |
102 GrRenderTarget* renderTarget) override; | 102 GrRenderTarget* renderTarget) override; |
103 void onCopySurface(GrSurface* dst, | 103 void onCopySurface(GrSurface* dst, |
104 GrSurface* src, | 104 GrSurface* src, |
105 const SkIRect& srcRect, | 105 const SkIRect& srcRect, |
106 const SkIPoint& dstPoint) override; | 106 const SkIPoint& dstPoint) override; |
107 | 107 |
108 // Records any trace markers for a command | |
109 void recordTraceMarkersIfNecessary(GrTargetCommands::Cmd*); | |
110 SkString getCmdString(int index) const { | |
111 SkASSERT(index < fGpuCmdMarkers.count()); | |
112 return fGpuCmdMarkers[index].toString(); | |
113 } | |
114 bool isIssued(uint32_t drawID) override { return drawID != fDrawID; } | 108 bool isIssued(uint32_t drawID) override { return drawID != fDrawID; } |
115 | 109 |
116 StateForPathDraw* SK_WARN_UNUSED_RESULT createStateForPathDraw( | 110 StateForPathDraw* SK_WARN_UNUSED_RESULT createStateForPathDraw( |
117 const GrPrimitiveProcessor*, | 111 const GrPrimitiveProcessor*, |
118 const GrDrawTarget::PipelineInfo&, | 112 const GrDrawTarget::PipelineInfo&, |
119 GrPipelineOptimizations* opts); | 113 GrPipelineOptimizations* opts); |
120 | 114 |
121 // TODO: Use a single allocator for commands and records | 115 // TODO: Use a single allocator for commands and records |
122 enum { | 116 enum { |
123 kPathIdxBufferMinReserve = 2 * 64, // 64 uint16_t's | 117 kPathIdxBufferMinReserve = 2 * 64, // 64 uint16_t's |
124 kPathXformBufferMinReserve = 2 * 64, // 64 two-float transforms | 118 kPathXformBufferMinReserve = 2 * 64, // 64 two-float transforms |
125 kPipelineBufferMinReserve = 32 * sizeof(StateForPathDraw), | 119 kPipelineBufferMinReserve = 32 * sizeof(StateForPathDraw), |
126 }; | 120 }; |
127 | 121 |
128 // every 100 flushes we should reset our fPipelineBuffer to prevent us from
holding at a | 122 // every 100 flushes we should reset our fPipelineBuffer to prevent us from
holding at a |
129 // highwater mark | 123 // highwater mark |
130 static const int kPipelineBufferHighWaterMark = 100; | 124 static const int kPipelineBufferHighWaterMark = 100; |
131 | 125 |
132 SkAutoTDelete<GrCommandBuilder> fCommands; | 126 SkAutoTDelete<GrCommandBuilder> fCommands; |
133 SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers; | |
134 SkChunkAlloc fPathIndexBuffer; | 127 SkChunkAlloc fPathIndexBuffer; |
135 SkChunkAlloc fPathTransformBuffer; | 128 SkChunkAlloc fPathTransformBuffer; |
136 SkChunkAlloc fPipelineBuffer; | 129 SkChunkAlloc fPipelineBuffer; |
137 uint32_t fDrawID; | 130 uint32_t fDrawID; |
138 SkAutoTUnref<StateForPathDraw> fPrevState; | 131 SkAutoTUnref<StateForPathDraw> fPrevState; |
139 | 132 |
140 typedef GrClipTarget INHERITED; | 133 typedef GrClipTarget INHERITED; |
141 }; | 134 }; |
142 | 135 |
143 #endif | 136 #endif |
OLD | NEW |