| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 * is destructive). This buffer must not have an active reserved vertex or i
ndex source. Any | 66 * is destructive). This buffer must not have an active reserved vertex or i
ndex source. Any |
| 67 * reserved geometry on the target will be finalized because it's geometry s
ource will be pushed | 67 * reserved geometry on the target will be finalized because it's geometry s
ource will be pushed |
| 68 * before flushing and popped afterwards. | 68 * before flushing and popped afterwards. |
| 69 */ | 69 */ |
| 70 void flush(); | 70 void flush(); |
| 71 | 71 |
| 72 // tracking for draws | 72 // tracking for draws |
| 73 virtual DrawToken getCurrentDrawToken() { return DrawToken(this, fDrawID); } | 73 virtual DrawToken getCurrentDrawToken() { return DrawToken(this, fDrawID); } |
| 74 | 74 |
| 75 // overrides from GrDrawTarget | 75 // overrides from GrDrawTarget |
| 76 virtual bool geometryHints(int* vertexCount, | 76 virtual bool geometryHints(size_t vertexStride, |
| 77 int* vertexCount, |
| 77 int* indexCount) const SK_OVERRIDE; | 78 int* indexCount) const SK_OVERRIDE; |
| 78 | 79 |
| 79 virtual bool copySurface(GrSurface* dst, | 80 virtual bool copySurface(GrSurface* dst, |
| 80 GrSurface* src, | 81 GrSurface* src, |
| 81 const SkIRect& srcRect, | 82 const SkIRect& srcRect, |
| 82 const SkIPoint& dstPoint) SK_OVERRIDE; | 83 const SkIPoint& dstPoint) SK_OVERRIDE; |
| 83 | 84 |
| 84 virtual bool canCopySurface(GrSurface* dst, | 85 virtual bool canCopySurface(const GrSurface* dst, |
| 85 GrSurface* src, | 86 const GrSurface* src, |
| 86 const SkIRect& srcRect, | 87 const SkIRect& srcRect, |
| 87 const SkIPoint& dstPoint) SK_OVERRIDE; | 88 const SkIPoint& dstPoint) SK_OVERRIDE; |
| 88 | 89 |
| 89 virtual void clearStencilClip(const SkIRect& rect, | 90 virtual void clearStencilClip(const SkIRect& rect, |
| 90 bool insideClip, | 91 bool insideClip, |
| 91 GrRenderTarget* renderTarget) SK_OVERRIDE; | 92 GrRenderTarget* renderTarget) SK_OVERRIDE; |
| 92 | 93 |
| 93 virtual void discard(GrRenderTarget*) SK_OVERRIDE; | 94 virtual void discard(GrRenderTarget*) SK_OVERRIDE; |
| 94 | 95 |
| 95 virtual void initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* des
c) SK_OVERRIDE; | 96 virtual void initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* des
c) SK_OVERRIDE; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 242 |
| 242 GrDrawState fState; | 243 GrDrawState fState; |
| 243 GrGpu::DrawType fDrawType; | 244 GrGpu::DrawType fDrawType; |
| 244 GrDeviceCoordTexture fDstCopy; | 245 GrDeviceCoordTexture fDstCopy; |
| 245 }; | 246 }; |
| 246 | 247 |
| 247 typedef void* TCmdAlign; // This wouldn't be enough align if a command used
long double. | 248 typedef void* TCmdAlign; // This wouldn't be enough align if a command used
long double. |
| 248 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; | 249 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; |
| 249 | 250 |
| 250 // overrides from GrDrawTarget | 251 // overrides from GrDrawTarget |
| 251 virtual void onDraw(const DrawInfo&, const GrClipMaskManager::ScissorState&)
SK_OVERRIDE; | 252 virtual void onDraw(const GrDrawState&, |
| 252 virtual void onDrawRect(const SkRect& rect, | 253 const DrawInfo&, |
| 254 const GrClipMaskManager::ScissorState&) SK_OVERRIDE; |
| 255 virtual void onDrawRect(GrDrawState*, |
| 256 const SkRect& rect, |
| 253 const SkRect* localRect, | 257 const SkRect* localRect, |
| 254 const SkMatrix* localMatrix) SK_OVERRIDE; | 258 const SkMatrix* localMatrix) SK_OVERRIDE; |
| 255 | 259 |
| 256 virtual void onStencilPath(const GrPath*, | 260 virtual void onStencilPath(const GrDrawState&, |
| 261 const GrPath*, |
| 257 const GrClipMaskManager::ScissorState&, | 262 const GrClipMaskManager::ScissorState&, |
| 258 const GrStencilSettings&) SK_OVERRIDE; | 263 const GrStencilSettings&) SK_OVERRIDE; |
| 259 virtual void onDrawPath(const GrPath*, | 264 virtual void onDrawPath(const GrDrawState&, |
| 265 const GrPath*, |
| 260 const GrClipMaskManager::ScissorState&, | 266 const GrClipMaskManager::ScissorState&, |
| 261 const GrStencilSettings&, | 267 const GrStencilSettings&, |
| 262 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; | 268 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
| 263 virtual void onDrawPaths(const GrPathRange*, | 269 virtual void onDrawPaths(const GrDrawState&, |
| 270 const GrPathRange*, |
| 264 const uint32_t indices[], | 271 const uint32_t indices[], |
| 265 int count, | 272 int count, |
| 266 const float transforms[], | 273 const float transforms[], |
| 267 PathTransformType, | 274 PathTransformType, |
| 268 const GrClipMaskManager::ScissorState&, | 275 const GrClipMaskManager::ScissorState&, |
| 269 const GrStencilSettings&, | 276 const GrStencilSettings&, |
| 270 const GrDeviceCoordTexture*) SK_OVERRIDE; | 277 const GrDeviceCoordTexture*) SK_OVERRIDE; |
| 271 virtual void onClear(const SkIRect* rect, | 278 virtual void onClear(const SkIRect* rect, |
| 272 GrColor color, | 279 GrColor color, |
| 273 bool canIgnoreRect, | 280 bool canIgnoreRect, |
| 274 GrRenderTarget* renderTarget) SK_OVERRIDE; | 281 GrRenderTarget* renderTarget) SK_OVERRIDE; |
| 275 | 282 |
| 276 virtual bool onReserveVertexSpace(size_t vertexSize, | 283 virtual bool onReserveVertexSpace(size_t vertexSize, |
| 277 int vertexCount, | 284 int vertexCount, |
| 278 void** vertices) SK_OVERRIDE; | 285 void** vertices) SK_OVERRIDE; |
| 279 virtual bool onReserveIndexSpace(int indexCount, | 286 virtual bool onReserveIndexSpace(int indexCount, |
| 280 void** indices) SK_OVERRIDE; | 287 void** indices) SK_OVERRIDE; |
| 281 virtual void releaseReservedVertexSpace() SK_OVERRIDE; | 288 virtual void releaseReservedVertexSpace() SK_OVERRIDE; |
| 282 virtual void releaseReservedIndexSpace() SK_OVERRIDE; | 289 virtual void releaseReservedIndexSpace() SK_OVERRIDE; |
| 283 virtual void geometrySourceWillPush() SK_OVERRIDE; | 290 virtual void geometrySourceWillPush() SK_OVERRIDE; |
| 284 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) SK
_OVERRIDE; | 291 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) SK
_OVERRIDE; |
| 285 virtual void willReserveVertexAndIndexSpace(int vertexCount, | 292 virtual void willReserveVertexAndIndexSpace(int vertexCount, |
| 293 size_t vertexStride, |
| 286 int indexCount) SK_OVERRIDE; | 294 int indexCount) SK_OVERRIDE; |
| 287 | 295 |
| 288 // Attempts to concat instances from info onto the previous draw. info must
represent an | 296 // Attempts to concat instances from info onto the previous draw. info must
represent an |
| 289 // instanced draw. The caller must have already recorded a new draw state an
d clip if necessary. | 297 // instanced draw. The caller must have already recorded a new draw state an
d clip if necessary. |
| 290 int concatInstancedDraw(const DrawInfo& info, const GrClipMaskManager::Sciss
orState&); | 298 int concatInstancedDraw(const GrDrawState&, |
| 299 const DrawInfo&, |
| 300 const GrClipMaskManager::ScissorState&); |
| 291 | 301 |
| 292 // Determines whether the current draw operation requieres a new drawstate a
nd if so records it. | 302 // Determines whether the current draw operation requieres a new drawstate a
nd if so records it. |
| 293 void recordStateIfNecessary(GrGpu::DrawType, const GrDeviceCoordTexture*); | 303 void recordStateIfNecessary(const GrDrawState&, GrGpu::DrawType, const GrDev
iceCoordTexture*); |
| 294 // We lazily record clip changes in order to skip clips that have no effect. | 304 // We lazily record clip changes in order to skip clips that have no effect. |
| 295 void recordClipIfNecessary(); | 305 void recordClipIfNecessary(); |
| 296 // Records any trace markers for a command after adding it to the buffer. | 306 // Records any trace markers for a command after adding it to the buffer. |
| 297 void recordTraceMarkersIfNecessary(); | 307 void recordTraceMarkersIfNecessary(); |
| 298 | 308 |
| 299 virtual bool isIssued(uint32_t drawID) { return drawID != fDrawID; } | 309 virtual bool isIssued(uint32_t drawID) { return drawID != fDrawID; } |
| 300 | 310 |
| 301 // TODO: Use a single allocator for commands and records | 311 // TODO: Use a single allocator for commands and records |
| 302 enum { | 312 enum { |
| 303 kCmdBufferInitialSizeInBytes = 8 * 1024, | 313 kCmdBufferInitialSizeInBytes = 8 * 1024, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 326 typedef SkSTArray<kGeoPoolStatePreAllocCnt, GeometryPoolState> GeoPoolStateS
tack; | 336 typedef SkSTArray<kGeoPoolStatePreAllocCnt, GeometryPoolState> GeoPoolStateS
tack; |
| 327 | 337 |
| 328 GeoPoolStateStack fGeoPoolStateStack; | 338 GeoPoolStateStack fGeoPoolStateStack; |
| 329 bool fFlushing; | 339 bool fFlushing; |
| 330 uint32_t fDrawID; | 340 uint32_t fDrawID; |
| 331 | 341 |
| 332 typedef GrClipTarget INHERITED; | 342 typedef GrClipTarget INHERITED; |
| 333 }; | 343 }; |
| 334 | 344 |
| 335 #endif | 345 #endif |
| OLD | NEW |