| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrFlushToGpuDrawTarget_DEFINED | 8 #ifndef GrFlushToGpuDrawTarget_DEFINED |
| 9 #define GrFlushToGpuDrawTarget_DEFINED | 9 #define GrFlushToGpuDrawTarget_DEFINED |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 * before flushing and popped afterwards. | 39 * before flushing and popped afterwards. |
| 40 */ | 40 */ |
| 41 void flush(); | 41 void flush(); |
| 42 | 42 |
| 43 bool geometryHints(size_t vertexStride, int* vertexCount, int* indexCount) c
onst SK_OVERRIDE; | 43 bool geometryHints(size_t vertexStride, int* vertexCount, int* indexCount) c
onst SK_OVERRIDE; |
| 44 | 44 |
| 45 protected: | 45 protected: |
| 46 GrGpu* getGpu() { return fGpu; } | 46 GrGpu* getGpu() { return fGpu; } |
| 47 const GrGpu* getGpu() const{ return fGpu; } | 47 const GrGpu* getGpu() const{ return fGpu; } |
| 48 | 48 |
| 49 private: | 49 GrVertexBufferAllocPool* getVertexAllocPool() { return fVertexPool; } |
| 50 GrIndexBufferAllocPool* getIndexAllocPool() { return fIndexPool; } |
| 51 |
| 52 // TODO all of this goes away when batch is everywhere |
| 50 enum { | 53 enum { |
| 51 kGeoPoolStatePreAllocCnt = 4, | 54 kGeoPoolStatePreAllocCnt = 4, |
| 52 }; | 55 }; |
| 53 | 56 |
| 54 struct GeometryPoolState { | 57 struct GeometryPoolState { |
| 55 const GrVertexBuffer* fPoolVertexBuffer; | 58 const GrVertexBuffer* fPoolVertexBuffer; |
| 56 int fPoolStartVertex; | 59 int fPoolStartVertex; |
| 57 const GrIndexBuffer* fPoolIndexBuffer; | 60 const GrIndexBuffer* fPoolIndexBuffer; |
| 58 int fPoolStartIndex; | 61 int fPoolStartIndex; |
| 59 // caller may conservatively over reserve vertices / indices. | 62 // caller may conservatively over reserve vertices / indices. |
| 60 // we release unused space back to allocator if possible | 63 // we release unused space back to allocator if possible |
| 61 // can only do this if there isn't an intervening pushGeometrySource() | 64 // can only do this if there isn't an intervening pushGeometrySource() |
| 62 size_t fUsedPoolVertexBytes; | 65 size_t fUsedPoolVertexBytes; |
| 63 size_t fUsedPoolIndexBytes; | 66 size_t fUsedPoolIndexBytes; |
| 64 }; | 67 }; |
| 65 | 68 |
| 66 typedef SkSTArray<kGeoPoolStatePreAllocCnt, GeometryPoolState> GeoPoolStateS
tack; | 69 typedef SkSTArray<kGeoPoolStatePreAllocCnt, GeometryPoolState> GeoPoolStateS
tack; |
| 70 const GeoPoolStateStack& getGeoPoolStateStack() const { return fGeoPoolState
Stack; } |
| 67 | 71 |
| 72 private: |
| 68 virtual void onReset() = 0; | 73 virtual void onReset() = 0; |
| 69 | 74 |
| 70 virtual void onFlush() = 0; | 75 virtual void onFlush() = 0; |
| 71 | 76 |
| 72 void setDrawBuffers(DrawInfo*, size_t stride) SK_OVERRIDE; | 77 void setDrawBuffers(DrawInfo*, size_t stride) SK_OVERRIDE; |
| 73 bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void** vertice
s) SK_OVERRIDE; | 78 bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void** vertice
s) SK_OVERRIDE; |
| 74 bool onReserveIndexSpace(int indexCount, void** indices) SK_OVERRIDE; | 79 bool onReserveIndexSpace(int indexCount, void** indices) SK_OVERRIDE; |
| 75 void releaseReservedVertexSpace() SK_OVERRIDE; | 80 void releaseReservedVertexSpace() SK_OVERRIDE; |
| 76 void releaseReservedIndexSpace() SK_OVERRIDE; | 81 void releaseReservedIndexSpace() SK_OVERRIDE; |
| 77 void geometrySourceWillPush() SK_OVERRIDE; | 82 void geometrySourceWillPush() SK_OVERRIDE; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 88 GeoPoolStateStack fGeoPoolStateStack; | 93 GeoPoolStateStack fGeoPoolStateStack; |
| 89 SkAutoTUnref<GrGpu> fGpu; | 94 SkAutoTUnref<GrGpu> fGpu; |
| 90 GrVertexBufferAllocPool* fVertexPool; | 95 GrVertexBufferAllocPool* fVertexPool; |
| 91 GrIndexBufferAllocPool* fIndexPool; | 96 GrIndexBufferAllocPool* fIndexPool; |
| 92 bool fFlushing; | 97 bool fFlushing; |
| 93 | 98 |
| 94 typedef GrClipTarget INHERITED; | 99 typedef GrClipTarget INHERITED; |
| 95 }; | 100 }; |
| 96 | 101 |
| 97 #endif | 102 #endif |
| OLD | NEW |