| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 struct DrawPaths : public Cmd { | 152 struct DrawPaths : public Cmd { |
| 153 DrawPaths(const GrPathRange* pathRange) : Cmd(kDrawPaths_Cmd), fPathRang
e(pathRange) {} | 153 DrawPaths(const GrPathRange* pathRange) : Cmd(kDrawPaths_Cmd), fPathRang
e(pathRange) {} |
| 154 | 154 |
| 155 const GrPathRange* pathRange() const { return fPathRange.get(); } | 155 const GrPathRange* pathRange() const { return fPathRange.get(); } |
| 156 | 156 |
| 157 void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; | 157 void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
| 158 | 158 |
| 159 int fIndicesLocation; | 159 int fIndicesLocation; |
| 160 size_t fCount; | 160 PathIndexType fIndexType; |
| 161 int fTransformsLocation; | 161 int fTransformsLocation; |
| 162 PathTransformType fTransformsType; | 162 PathTransformType fTransformType; |
| 163 int fCount; |
| 163 GrStencilSettings fStencilSettings; | 164 GrStencilSettings fStencilSettings; |
| 164 | 165 |
| 165 private: | 166 private: |
| 166 GrPendingIOResource<const GrPathRange, kRead_GrIOType> fPathRange; | 167 GrPendingIOResource<const GrPathRange, kRead_GrIOType> fPathRange; |
| 167 }; | 168 }; |
| 168 | 169 |
| 169 // This is also used to record a discard by setting the color to GrColor_ILL
EGAL | 170 // This is also used to record a discard by setting the color to GrColor_ILL
EGAL |
| 170 struct Clear : public Cmd { | 171 struct Clear : public Cmd { |
| 171 Clear(GrRenderTarget* rt) : Cmd(kClear_Cmd), fRenderTarget(rt) {} | 172 Clear(GrRenderTarget* rt) : Cmd(kClear_Cmd), fRenderTarget(rt) {} |
| 172 | 173 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 const GrPath*, | 243 const GrPath*, |
| 243 const ScissorState&, | 244 const ScissorState&, |
| 244 const GrStencilSettings&) SK_OVERRIDE; | 245 const GrStencilSettings&) SK_OVERRIDE; |
| 245 void onDrawPath(const GrDrawState&, | 246 void onDrawPath(const GrDrawState&, |
| 246 const GrPath*, | 247 const GrPath*, |
| 247 const ScissorState&, | 248 const ScissorState&, |
| 248 const GrStencilSettings&, | 249 const GrStencilSettings&, |
| 249 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; | 250 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
| 250 void onDrawPaths(const GrDrawState&, | 251 void onDrawPaths(const GrDrawState&, |
| 251 const GrPathRange*, | 252 const GrPathRange*, |
| 252 const uint32_t indices[], | 253 const void* indices, |
| 254 PathIndexType, |
| 255 const float transformValues[], |
| 256 PathTransformType, |
| 253 int count, | 257 int count, |
| 254 const float transforms[], | |
| 255 PathTransformType, | |
| 256 const ScissorState&, | 258 const ScissorState&, |
| 257 const GrStencilSettings&, | 259 const GrStencilSettings&, |
| 258 const GrDeviceCoordTexture*) SK_OVERRIDE; | 260 const GrDeviceCoordTexture*) SK_OVERRIDE; |
| 259 void onClear(const SkIRect* rect, | 261 void onClear(const SkIRect* rect, |
| 260 GrColor color, | 262 GrColor color, |
| 261 bool canIgnoreRect, | 263 bool canIgnoreRect, |
| 262 GrRenderTarget* renderTarget) SK_OVERRIDE; | 264 GrRenderTarget* renderTarget) SK_OVERRIDE; |
| 263 void setDrawBuffers(DrawInfo*) SK_OVERRIDE; | 265 void setDrawBuffers(DrawInfo*) SK_OVERRIDE; |
| 264 | 266 |
| 265 bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void** vertice
s) SK_OVERRIDE; | 267 bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void** vertice
s) SK_OVERRIDE; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 286 // We lazily record clip changes in order to skip clips that have no effect. | 288 // We lazily record clip changes in order to skip clips that have no effect. |
| 287 void recordClipIfNecessary(); | 289 void recordClipIfNecessary(); |
| 288 // Records any trace markers for a command after adding it to the buffer. | 290 // Records any trace markers for a command after adding it to the buffer. |
| 289 void recordTraceMarkersIfNecessary(); | 291 void recordTraceMarkersIfNecessary(); |
| 290 | 292 |
| 291 virtual bool isIssued(uint32_t drawID) { return drawID != fDrawID; } | 293 virtual bool isIssued(uint32_t drawID) { return drawID != fDrawID; } |
| 292 | 294 |
| 293 // TODO: Use a single allocator for commands and records | 295 // TODO: Use a single allocator for commands and records |
| 294 enum { | 296 enum { |
| 295 kCmdBufferInitialSizeInBytes = 8 * 1024, | 297 kCmdBufferInitialSizeInBytes = 8 * 1024, |
| 296 kPathIdxBufferMinReserve = 64, | 298 kPathIdxBufferMinReserve = 2 * 64, // 64 uint16_t's |
| 297 kPathXformBufferMinReserve = 2 * kPathIdxBufferMinReserve, | 299 kPathXformBufferMinReserve = 2 * 64, // 64 two-float transforms |
| 298 kGeoPoolStatePreAllocCnt = 4, | 300 kGeoPoolStatePreAllocCnt = 4, |
| 299 }; | 301 }; |
| 300 | 302 |
| 301 struct GeometryPoolState { | 303 struct GeometryPoolState { |
| 302 const GrVertexBuffer* fPoolVertexBuffer; | 304 const GrVertexBuffer* fPoolVertexBuffer; |
| 303 int fPoolStartVertex; | 305 int fPoolStartVertex; |
| 304 const GrIndexBuffer* fPoolIndexBuffer; | 306 const GrIndexBuffer* fPoolIndexBuffer; |
| 305 int fPoolStartIndex; | 307 int fPoolStartIndex; |
| 306 // caller may conservatively over reserve vertices / indices. | 308 // caller may conservatively over reserve vertices / indices. |
| 307 // we release unused space back to allocator if possible | 309 // we release unused space back to allocator if possible |
| 308 // can only do this if there isn't an intervening pushGeometrySource() | 310 // can only do this if there isn't an intervening pushGeometrySource() |
| 309 size_t fUsedPoolVertexBytes; | 311 size_t fUsedPoolVertexBytes; |
| 310 size_t fUsedPoolIndexBytes; | 312 size_t fUsedPoolIndexBytes; |
| 311 }; | 313 }; |
| 312 | 314 |
| 313 typedef SkSTArray<kGeoPoolStatePreAllocCnt, GeometryPoolState> GeoPoolStateS
tack; | 315 typedef SkSTArray<kGeoPoolStatePreAllocCnt, GeometryPoolState> GeoPoolStateS
tack; |
| 314 | 316 |
| 315 CmdBuffer fCmdBuffer; | 317 CmdBuffer fCmdBuffer; |
| 316 const GrOptDrawState* fPrevState; | 318 const GrOptDrawState* fPrevState; |
| 317 SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers; | 319 SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers; |
| 318 GrGpu* fDstGpu; | 320 GrGpu* fDstGpu; |
| 319 GrVertexBufferAllocPool& fVertexPool; | 321 GrVertexBufferAllocPool& fVertexPool; |
| 320 GrIndexBufferAllocPool& fIndexPool; | 322 GrIndexBufferAllocPool& fIndexPool; |
| 321 SkTDArray<uint32_t> fPathIndexBuffer; | 323 SkTDArray<char> fPathIndexBuffer; |
| 322 SkTDArray<float> fPathTransformBuffer; | 324 SkTDArray<float> fPathTransformBuffer; |
| 323 GeoPoolStateStack fGeoPoolStateStack; | 325 GeoPoolStateStack fGeoPoolStateStack; |
| 324 bool fFlushing; | 326 bool fFlushing; |
| 325 uint32_t fDrawID; | 327 uint32_t fDrawID; |
| 326 | 328 |
| 327 typedef GrClipTarget INHERITED; | 329 typedef GrClipTarget INHERITED; |
| 328 }; | 330 }; |
| 329 | 331 |
| 330 #endif | 332 #endif |
| OLD | NEW |