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 GrInOrderDrawBuffer_DEFINED | 8 #ifndef GrInOrderDrawBuffer_DEFINED |
9 #define GrInOrderDrawBuffer_DEFINED | 9 #define GrInOrderDrawBuffer_DEFINED |
10 | 10 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 SkIPoint fDstPoint; | 170 SkIPoint fDstPoint; |
171 SkIRect fSrcRect; | 171 SkIRect fSrcRect; |
172 | 172 |
173 private: | 173 private: |
174 GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst; | 174 GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst; |
175 GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc; | 175 GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc; |
176 }; | 176 }; |
177 | 177 |
178 struct SetState : public Cmd { | 178 struct SetState : public Cmd { |
179 SetState(const GrDrawState& drawState, const GrGeometryProcessor* gp, | 179 SetState(const GrDrawState& drawState, const GrPrimitiveProcessor* primP
roc, |
180 const GrPathProcessor* pp, const GrDrawTargetCaps& caps, | 180 const GrDrawTargetCaps& caps, |
181 const GrScissorState& scissor, const GrDeviceCoordTexture* dstC
opy, | 181 const GrScissorState& scissor, const GrDeviceCoordTexture* dstC
opy, |
182 GrGpu::DrawType drawType) | 182 GrGpu::DrawType drawType) |
183 : Cmd(kSetState_Cmd) | 183 : Cmd(kSetState_Cmd) |
184 , fState(drawState, gp, pp, caps, scissor, dstCopy, drawType) {} | 184 , fState(drawState, primProc, caps, scissor, dstCopy, drawType) {} |
185 | 185 |
186 void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; | 186 void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
187 | 187 |
188 GrOptDrawState fState; | 188 GrOptDrawState fState; |
189 }; | 189 }; |
190 | 190 |
191 typedef void* TCmdAlign; // This wouldn't be enough align if a command used
long double. | 191 typedef void* TCmdAlign; // This wouldn't be enough align if a command used
long double. |
192 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; | 192 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; |
193 | 193 |
194 void onReset() SK_OVERRIDE; | 194 void onReset() SK_OVERRIDE; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 const SkIPoint& dstPoint) SK_OVERRIDE; | 239 const SkIPoint& dstPoint) SK_OVERRIDE; |
240 | 240 |
241 // Attempts to concat instances from info onto the previous draw. info must
represent an | 241 // Attempts to concat instances from info onto the previous draw. info must
represent an |
242 // instanced draw. The caller must have already recorded a new draw state an
d clip if necessary. | 242 // instanced draw. The caller must have already recorded a new draw state an
d clip if necessary. |
243 int concatInstancedDraw(const GrDrawState&, const DrawInfo&); | 243 int concatInstancedDraw(const GrDrawState&, const DrawInfo&); |
244 | 244 |
245 // Determines whether the current draw operation requires a new GrOptDrawSta
te and if so | 245 // Determines whether the current draw operation requires a new GrOptDrawSta
te and if so |
246 // records it. If the draw can be skipped false is returned and no new GrOpt
DrawState is | 246 // records it. If the draw can be skipped false is returned and no new GrOpt
DrawState is |
247 // recorded. | 247 // recorded. |
248 bool SK_WARN_UNUSED_RESULT recordStateAndShouldDraw(const GrDrawState&, | 248 bool SK_WARN_UNUSED_RESULT recordStateAndShouldDraw(const GrDrawState&, |
249 const GrGeometryProcesso
r*, | 249 const GrPrimitiveProcess
or*, |
250 const GrPathProcessor*, | |
251 GrGpu::DrawType, | 250 GrGpu::DrawType, |
252 const GrScissorState&, | 251 const GrScissorState&, |
253 const GrDeviceCoordTextu
re*); | 252 const GrDeviceCoordTextu
re*); |
254 // We lazily record clip changes in order to skip clips that have no effect. | 253 // We lazily record clip changes in order to skip clips that have no effect. |
255 void recordClipIfNecessary(); | 254 void recordClipIfNecessary(); |
256 // Records any trace markers for a command after adding it to the buffer. | 255 // Records any trace markers for a command after adding it to the buffer. |
257 void recordTraceMarkersIfNecessary(); | 256 void recordTraceMarkersIfNecessary(); |
258 | 257 |
259 bool isIssued(uint32_t drawID) SK_OVERRIDE { return drawID != fDrawID; } | 258 bool isIssued(uint32_t drawID) SK_OVERRIDE { return drawID != fDrawID; } |
260 | 259 |
261 // TODO: Use a single allocator for commands and records | 260 // TODO: Use a single allocator for commands and records |
262 enum { | 261 enum { |
263 kCmdBufferInitialSizeInBytes = 8 * 1024, | 262 kCmdBufferInitialSizeInBytes = 8 * 1024, |
264 kPathIdxBufferMinReserve = 2 * 64, // 64 uint16_t's | 263 kPathIdxBufferMinReserve = 2 * 64, // 64 uint16_t's |
265 kPathXformBufferMinReserve = 2 * 64, // 64 two-float transforms | 264 kPathXformBufferMinReserve = 2 * 64, // 64 two-float transforms |
266 }; | 265 }; |
267 | 266 |
268 CmdBuffer fCmdBuffer; | 267 CmdBuffer fCmdBuffer; |
269 GrOptDrawState* fPrevState; | 268 GrOptDrawState* fPrevState; |
270 SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers; | 269 SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers; |
271 SkTDArray<char> fPathIndexBuffer; | 270 SkTDArray<char> fPathIndexBuffer; |
272 SkTDArray<float> fPathTransformBuffer; | 271 SkTDArray<float> fPathTransformBuffer; |
273 uint32_t fDrawID; | 272 uint32_t fDrawID; |
274 | 273 |
275 typedef GrFlushToGpuDrawTarget INHERITED; | 274 typedef GrFlushToGpuDrawTarget INHERITED; |
276 }; | 275 }; |
277 | 276 |
278 #endif | 277 #endif |
OLD | NEW |