| epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 2 | /* |
| epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | |
| epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 10 | |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 11 | #ifndef GrInOrderDrawBuffer_DEFINED |
| 12 | #define GrInOrderDrawBuffer_DEFINED |
| 13 | |
| 14 | #include "GrDrawTarget.h" |
| 15 | #include "GrAllocPool.h" |
| 16 | #include "GrAllocator.h" |
| bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 17 | #include "GrPath.h" |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 18 | |
| robertphillips@google.com | 641f8b1 | 2012-07-31 19:15:58 +0000 | [diff] [blame] | 19 | #include "SkClipStack.h" |
| sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame^] | 20 | #include "SkStroke.h" |
| bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 21 | #include "SkTemplates.h" |
| 22 | |
| bsalomon@google.com | 471d471 | 2011-08-23 15:45:25 +0000 | [diff] [blame] | 23 | class GrGpu; |
| bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 24 | class GrIndexBufferAllocPool; |
| bsalomon@google.com | 471d471 | 2011-08-23 15:45:25 +0000 | [diff] [blame] | 25 | class GrVertexBufferAllocPool; |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 26 | |
| bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 27 | /** |
| 28 | * GrInOrderDrawBuffer is an implementation of GrDrawTarget that queues up |
| 29 | * draws for eventual playback into a GrGpu. In theory one draw buffer could |
| 30 | * playback into another. When index or vertex buffers are used as geometry |
| 31 | * sources it is the callers the draw buffer only holds references to the |
| 32 | * buffers. It is the callers responsibility to ensure that the data is still |
| 33 | * valid when the draw buffer is played back into a GrGpu. Similarly, it is the |
| 34 | * caller's responsibility to ensure that all referenced textures, buffers, |
| 35 | * and rendertargets are associated in the GrGpu object that the buffer is |
| 36 | * played back into. The buffer requires VB and IB pools to store geometry. |
| 37 | */ |
| 38 | |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 39 | class GrInOrderDrawBuffer : public GrDrawTarget { |
| 40 | public: |
| 41 | |
| bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 42 | /** |
| 43 | * Creates a GrInOrderDrawBuffer |
| 44 | * |
| bsalomon@google.com | 471d471 | 2011-08-23 15:45:25 +0000 | [diff] [blame] | 45 | * @param gpu the gpu object where this will be played back |
| 46 | * (possible indirectly). GrResources used with the draw |
| 47 | * buffer are created by this gpu object. |
| bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 48 | * @param vertexPool pool where vertices for queued draws will be saved when |
| 49 | * the vertex source is either reserved or array. |
| 50 | * @param indexPool pool where indices for queued draws will be saved when |
| 51 | * the index source is either reserved or array. |
| 52 | */ |
| bsalomon@google.com | 471d471 | 2011-08-23 15:45:25 +0000 | [diff] [blame] | 53 | GrInOrderDrawBuffer(const GrGpu* gpu, |
| 54 | GrVertexBufferAllocPool* vertexPool, |
| bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 55 | GrIndexBufferAllocPool* indexPool); |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 56 | |
| 57 | virtual ~GrInOrderDrawBuffer(); |
| 58 | |
| bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 59 | /** |
| bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 60 | * Provides the buffer with an index buffer that can be used for quad rendering. |
| 61 | * The buffer may be able to batch consecutive drawRects if this is provided. |
| 62 | * @param indexBuffer index buffer with quad indices. |
| 63 | */ |
| 64 | void setQuadIndexBuffer(const GrIndexBuffer* indexBuffer); |
| 65 | |
| 66 | /** |
| bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 67 | * Empties the draw buffer of any queued up draws. This must not be called |
| 68 | * while inside an unbalanced pushGeometrySource(). |
| bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 69 | */ |
| 70 | void reset(); |
| 71 | |
| 72 | /** |
| bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 73 | * plays the queued up draws to another target. Does not empty this buffer |
| 74 | * so that it can be played back multiple times. This buffer must not have |
| 75 | * an active reserved vertex or index source. Any reserved geometry on |
| 76 | * the target will be finalized because it's geometry source will be pushed |
| 77 | * before playback and popped afterwards. |
| 78 | * |
| bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 79 | * @return false if the playback trivially drew nothing because nothing was |
| 80 | * recorded. |
| 81 | * |
| bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 82 | * @param target the target to receive the playback |
| 83 | */ |
| bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 84 | bool playback(GrDrawTarget* target); |
| bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 85 | |
| 86 | /** |
| 87 | * A convenience method to do a playback followed by a reset. All the |
| 88 | * constraints and side-effects or playback() and reset apply(). |
| 89 | */ |
| 90 | void flushTo(GrDrawTarget* target) { |
| robertphillips@google.com | c82a8b7 | 2012-06-21 20:15:48 +0000 | [diff] [blame] | 91 | if (fFlushing) { |
| 92 | // When creating SW-only clip masks, the GrClipMaskManager can |
| 93 | // cause a GrContext::flush (when copying the mask results back |
| 94 | // to the GPU). Without a guard this results in a recursive call |
| 95 | // to this method. |
| 96 | return; |
| 97 | } |
| 98 | |
| 99 | fFlushing = true; |
| bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 100 | if (this->playback(target)) { |
| 101 | this->reset(); |
| 102 | } |
| robertphillips@google.com | c82a8b7 | 2012-06-21 20:15:48 +0000 | [diff] [blame] | 103 | fFlushing = false; |
| bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | /** |
| 107 | * This function allows the draw buffer to automatically flush itself to |
| rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 108 | * another target. This means the buffer may internally call |
| bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 109 | * this->flushTo(target) when it is safe to do so. |
| rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 110 | * |
| bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 111 | * When the auto flush target is set to NULL (as it initially is) the draw |
| 112 | * buffer will never automatically flush itself. |
| 113 | */ |
| 114 | void setAutoFlushTarget(GrDrawTarget* target); |
| 115 | |
| bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 116 | // overrides from GrDrawTarget |
| rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 117 | virtual void drawRect(const GrRect& rect, |
| bsalomon@google.com | b9086a0 | 2012-11-01 18:02:54 +0000 | [diff] [blame] | 118 | const SkMatrix* matrix = NULL, |
| bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 119 | const GrRect* srcRects[] = NULL, |
| bsalomon@google.com | b9086a0 | 2012-11-01 18:02:54 +0000 | [diff] [blame] | 120 | const SkMatrix* srcMatrices[] = NULL) SK_OVERRIDE; |
| bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 121 | |
| bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 122 | virtual void drawIndexedInstances(GrPrimitiveType type, |
| 123 | int instanceCount, |
| 124 | int verticesPerInstance, |
| 125 | int indicesPerInstance) |
| 126 | SK_OVERRIDE; |
| 127 | |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 128 | virtual bool geometryHints(GrVertexLayout vertexLayout, |
| bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 129 | int* vertexCount, |
| bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 130 | int* indexCount) const SK_OVERRIDE; |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 131 | |
| rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 132 | virtual void clear(const GrIRect* rect, |
| robertphillips@google.com | c82a8b7 | 2012-06-21 20:15:48 +0000 | [diff] [blame] | 133 | GrColor color, |
| 134 | GrRenderTarget* renderTarget = NULL) SK_OVERRIDE; |
| bsalomon@google.com | 0b335c1 | 2011-04-25 19:17:44 +0000 | [diff] [blame] | 135 | |
| bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 136 | protected: |
| bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 137 | virtual void willReserveVertexAndIndexSpace(GrVertexLayout vertexLayout, |
| 138 | int vertexCount, |
| 139 | int indexCount) SK_OVERRIDE; |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 140 | private: |
| bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 141 | enum Cmd { |
| bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 142 | kDraw_Cmd = 1, |
| 143 | kStencilPath_Cmd = 2, |
| 144 | kSetState_Cmd = 3, |
| 145 | kSetClip_Cmd = 4, |
| 146 | kClear_Cmd = 5, |
| bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 147 | }; |
| 148 | |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 149 | struct Draw { |
| bsalomon@google.com | ffca400 | 2011-02-22 20:34:01 +0000 | [diff] [blame] | 150 | GrPrimitiveType fPrimitiveType; |
| bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 151 | int fStartVertex; |
| 152 | int fStartIndex; |
| 153 | int fVertexCount; |
| 154 | int fIndexCount; |
| bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 155 | GrVertexLayout fVertexLayout; |
| 156 | const GrVertexBuffer* fVertexBuffer; |
| 157 | const GrIndexBuffer* fIndexBuffer; |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 158 | }; |
| 159 | |
| bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 160 | struct StencilPath { |
| 161 | SkAutoTUnref<const GrPath> fPath; |
| sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame^] | 162 | SkStroke fStroke; |
| 163 | SkPath::FillType fFill; |
| bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 164 | }; |
| 165 | |
| bsalomon@google.com | 0b335c1 | 2011-04-25 19:17:44 +0000 | [diff] [blame] | 166 | struct Clear { |
| robertphillips@google.com | c82a8b7 | 2012-06-21 20:15:48 +0000 | [diff] [blame] | 167 | Clear() : fRenderTarget(NULL) {} |
| 168 | ~Clear() { GrSafeUnref(fRenderTarget); } |
| 169 | |
| robertphillips@google.com | c82a8b7 | 2012-06-21 20:15:48 +0000 | [diff] [blame] | 170 | GrIRect fRect; |
| 171 | GrColor fColor; |
| 172 | GrRenderTarget* fRenderTarget; |
| bsalomon@google.com | 0b335c1 | 2011-04-25 19:17:44 +0000 | [diff] [blame] | 173 | }; |
| 174 | |
| bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 175 | // overrides from GrDrawTarget |
| 176 | virtual void onDrawIndexed(GrPrimitiveType primitiveType, |
| 177 | int startVertex, |
| 178 | int startIndex, |
| 179 | int vertexCount, |
| bsalomon@google.com | 13f1b6f | 2012-05-31 12:52:43 +0000 | [diff] [blame] | 180 | int indexCount) SK_OVERRIDE; |
| bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 181 | virtual void onDrawNonIndexed(GrPrimitiveType primitiveType, |
| 182 | int startVertex, |
| bsalomon@google.com | 13f1b6f | 2012-05-31 12:52:43 +0000 | [diff] [blame] | 183 | int vertexCount) SK_OVERRIDE; |
| sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame^] | 184 | virtual void onStencilPath(const GrPath*, const SkStroke& stroke, SkPath::FillType) SK_OVERRIDE; |
| rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 185 | virtual bool onReserveVertexSpace(GrVertexLayout layout, |
| bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 186 | int vertexCount, |
| bsalomon@google.com | 13f1b6f | 2012-05-31 12:52:43 +0000 | [diff] [blame] | 187 | void** vertices) SK_OVERRIDE; |
| 188 | virtual bool onReserveIndexSpace(int indexCount, |
| 189 | void** indices) SK_OVERRIDE; |
| 190 | virtual void releaseReservedVertexSpace() SK_OVERRIDE; |
| 191 | virtual void releaseReservedIndexSpace() SK_OVERRIDE; |
| bsalomon@google.com | bcdbbe6 | 2011-04-12 15:40:00 +0000 | [diff] [blame] | 192 | virtual void onSetVertexSourceToArray(const void* vertexArray, |
| bsalomon@google.com | 13f1b6f | 2012-05-31 12:52:43 +0000 | [diff] [blame] | 193 | int vertexCount) SK_OVERRIDE; |
| bsalomon@google.com | bcdbbe6 | 2011-04-12 15:40:00 +0000 | [diff] [blame] | 194 | virtual void onSetIndexSourceToArray(const void* indexArray, |
| bsalomon@google.com | 13f1b6f | 2012-05-31 12:52:43 +0000 | [diff] [blame] | 195 | int indexCount) SK_OVERRIDE; |
| 196 | virtual void releaseVertexArray() SK_OVERRIDE; |
| 197 | virtual void releaseIndexArray() SK_OVERRIDE; |
| 198 | virtual void geometrySourceWillPush() SK_OVERRIDE; |
| 199 | virtual void geometrySourceWillPop( |
| 200 | const GeometrySrcState& restoredState) SK_OVERRIDE; |
| robertphillips@google.com | beb1af7 | 2012-07-26 18:52:16 +0000 | [diff] [blame] | 201 | virtual void clipWillBeSet(const GrClipData* newClip) SK_OVERRIDE; |
| bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 202 | |
| bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 203 | // we lazily record state and clip changes in order to skip clips and states |
| 204 | // that have no effect. |
| bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 205 | bool needsNewState() const; |
| 206 | bool needsNewClip() const; |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 207 | |
| bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 208 | // these functions record a command |
| bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 209 | void recordState(); |
| 210 | void recordDefaultState(); |
| 211 | void recordClip(); |
| 212 | void recordDefaultClip(); |
| 213 | Draw* recordDraw(); |
| 214 | StencilPath* recordStencilPath(); |
| 215 | Clear* recordClear(); |
| bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 216 | |
| rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 217 | // call this to invalidate the tracking data that is used to concatenate |
| bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 218 | // multiple draws into a single draw. |
| 219 | void resetDrawTracking(); |
| 220 | |
| bsalomon@google.com | 4b90c62 | 2011-09-28 17:52:15 +0000 | [diff] [blame] | 221 | enum { |
| bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 222 | kCmdPreallocCnt = 32, |
| bsalomon@google.com | 4b90c62 | 2011-09-28 17:52:15 +0000 | [diff] [blame] | 223 | kDrawPreallocCnt = 8, |
| bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 224 | kStencilPathPreallocCnt = 8, |
| bsalomon@google.com | 4b90c62 | 2011-09-28 17:52:15 +0000 | [diff] [blame] | 225 | kStatePreallocCnt = 8, |
| 226 | kClipPreallocCnt = 8, |
| 227 | kClearPreallocCnt = 4, |
| 228 | kGeoPoolStatePreAllocCnt = 4, |
| 229 | }; |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 230 | |
| bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 231 | SkSTArray<kCmdPreallocCnt, uint8_t, true> fCmds; |
| bsalomon@google.com | 4b90c62 | 2011-09-28 17:52:15 +0000 | [diff] [blame] | 232 | GrSTAllocator<kDrawPreallocCnt, Draw> fDraws; |
| bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 233 | GrSTAllocator<kStatePreallocCnt, StencilPath> fStencilPaths; |
| bsalomon@google.com | 873ea0c | 2012-03-30 15:55:32 +0000 | [diff] [blame] | 234 | GrSTAllocator<kStatePreallocCnt, GrDrawState> fStates; |
| bsalomon@google.com | 4b90c62 | 2011-09-28 17:52:15 +0000 | [diff] [blame] | 235 | GrSTAllocator<kClearPreallocCnt, Clear> fClears; |
| robertphillips@google.com | beb1af7 | 2012-07-26 18:52:16 +0000 | [diff] [blame] | 236 | |
| robertphillips@google.com | 641f8b1 | 2012-07-31 19:15:58 +0000 | [diff] [blame] | 237 | GrSTAllocator<kClipPreallocCnt, SkClipStack> fClips; |
| robertphillips@google.com | beb1af7 | 2012-07-26 18:52:16 +0000 | [diff] [blame] | 238 | GrSTAllocator<kClipPreallocCnt, SkIPoint> fClipOrigins; |
| bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 239 | |
| 240 | GrDrawTarget* fAutoFlushTarget; |
| 241 | |
| bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 242 | bool fClipSet; |
| 243 | |
| bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 244 | GrVertexBufferAllocPool& fVertexPool; |
| 245 | |
| 246 | GrIndexBufferAllocPool& fIndexPool; |
| 247 | |
| 248 | // these are used to attempt to concatenate drawRect calls |
| bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 249 | GrVertexLayout fLastRectVertexLayout; |
| 250 | const GrIndexBuffer* fQuadIndexBuffer; |
| 251 | int fMaxQuads; |
| 252 | int fCurrQuad; |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 253 | |
| bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 254 | // bookkeeping to attempt to concantenate drawIndexedInstances calls |
| 255 | struct { |
| 256 | int fVerticesPerInstance; |
| 257 | int fIndicesPerInstance; |
| 258 | void reset() { |
| 259 | fVerticesPerInstance = 0; |
| 260 | fIndicesPerInstance = 0; |
| 261 | } |
| 262 | } fInstancedDrawTracker; |
| bsalomon@google.com | 9266901 | 2011-09-27 19:10:05 +0000 | [diff] [blame] | 263 | |
| bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 264 | struct GeometryPoolState { |
| 265 | const GrVertexBuffer* fPoolVertexBuffer; |
| 266 | int fPoolStartVertex; |
| 267 | const GrIndexBuffer* fPoolIndexBuffer; |
| 268 | int fPoolStartIndex; |
| 269 | // caller may conservatively over reserve vertices / indices. |
| 270 | // we release unused space back to allocator if possible |
| 271 | // can only do this if there isn't an intervening pushGeometrySource() |
| 272 | size_t fUsedPoolVertexBytes; |
| 273 | size_t fUsedPoolIndexBytes; |
| 274 | }; |
| bsalomon@google.com | 9266901 | 2011-09-27 19:10:05 +0000 | [diff] [blame] | 275 | SkSTArray<kGeoPoolStatePreAllocCnt, GeometryPoolState> fGeoPoolStateStack; |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 276 | |
| robertphillips@google.com | c82a8b7 | 2012-06-21 20:15:48 +0000 | [diff] [blame] | 277 | bool fFlushing; |
| 278 | |
| bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 279 | typedef GrDrawTarget INHERITED; |
| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 280 | }; |
| 281 | |
| 282 | #endif |