reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 1 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 8 | #ifndef GrInOrderDrawBuffer_DEFINED |
| 9 | #define GrInOrderDrawBuffer_DEFINED |
| 10 | |
bsalomon | 371bcbc | 2014-12-01 08:19:34 -0800 | [diff] [blame^] | 11 | #include "GrFlushToGpuDrawTarget.h" |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 12 | #include "GrOptDrawState.h" |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 13 | #include "GrPath.h" |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 14 | #include "GrTRecorder.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 15 | |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 16 | /** |
bsalomon@google.com | 55e4a20 | 2013-01-11 13:54:21 +0000 | [diff] [blame] | 17 | * GrInOrderDrawBuffer is an implementation of GrDrawTarget that queues up draws for eventual |
| 18 | * playback into a GrGpu. In theory one draw buffer could playback into another. When index or |
| 19 | * vertex buffers are used as geometry sources it is the callers the draw buffer only holds |
| 20 | * references to the buffers. It is the callers responsibility to ensure that the data is still |
| 21 | * valid when the draw buffer is played back into a GrGpu. Similarly, it is the caller's |
| 22 | * responsibility to ensure that all referenced textures, buffers, and render-targets are associated |
| 23 | * in the GrGpu object that the buffer is played back into. The buffer requires VB and IB pools to |
| 24 | * store geometry. |
skia.committer@gmail.com | 07d3a65 | 2013-04-10 07:01:15 +0000 | [diff] [blame] | 25 | */ |
bsalomon | 371bcbc | 2014-12-01 08:19:34 -0800 | [diff] [blame^] | 26 | class GrInOrderDrawBuffer : public GrFlushToGpuDrawTarget { |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 27 | public: |
| 28 | |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 29 | /** |
| 30 | * Creates a GrInOrderDrawBuffer |
| 31 | * |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 32 | * @param gpu the gpu object that this draw buffer flushes to. |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 33 | * @param vertexPool pool where vertices for queued draws will be saved when |
| 34 | * the vertex source is either reserved or array. |
| 35 | * @param indexPool pool where indices for queued draws will be saved when |
| 36 | * the index source is either reserved or array. |
| 37 | */ |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 38 | GrInOrderDrawBuffer(GrGpu* gpu, |
bsalomon@google.com | 471d471 | 2011-08-23 15:45:25 +0000 | [diff] [blame] | 39 | GrVertexBufferAllocPool* vertexPool, |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 40 | GrIndexBufferAllocPool* indexPool); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 41 | |
bsalomon | f90a02b | 2014-11-26 12:28:00 -0800 | [diff] [blame] | 42 | ~GrInOrderDrawBuffer() SK_OVERRIDE; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 43 | |
commit-bot@chromium.org | a8916ff | 2013-08-16 15:53:46 +0000 | [diff] [blame] | 44 | // tracking for draws |
bsalomon | f90a02b | 2014-11-26 12:28:00 -0800 | [diff] [blame] | 45 | DrawToken getCurrentDrawToken() { return DrawToken(this, fDrawID); } |
commit-bot@chromium.org | a8916ff | 2013-08-16 15:53:46 +0000 | [diff] [blame] | 46 | |
bsalomon | f90a02b | 2014-11-26 12:28:00 -0800 | [diff] [blame] | 47 | void clearStencilClip(const SkIRect& rect, |
| 48 | bool insideClip, |
| 49 | GrRenderTarget* renderTarget) SK_OVERRIDE; |
joshualitt | a702415 | 2014-11-03 14:16:35 -0800 | [diff] [blame] | 50 | |
bsalomon | f90a02b | 2014-11-26 12:28:00 -0800 | [diff] [blame] | 51 | void discard(GrRenderTarget*) SK_OVERRIDE; |
bsalomon@google.com | eb85117 | 2013-04-15 13:51:00 +0000 | [diff] [blame] | 52 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 53 | private: |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 54 | typedef GrClipMaskManager::ScissorState ScissorState; |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 55 | enum { |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 56 | kDraw_Cmd = 1, |
| 57 | kStencilPath_Cmd = 2, |
| 58 | kSetState_Cmd = 3, |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 59 | kClear_Cmd = 4, |
| 60 | kCopySurface_Cmd = 5, |
| 61 | kDrawPath_Cmd = 6, |
| 62 | kDrawPaths_Cmd = 7, |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 63 | }; |
| 64 | |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 65 | struct Cmd : ::SkNoncopyable { |
| 66 | Cmd(uint8_t type) : fType(type) {} |
| 67 | virtual ~Cmd() {} |
| 68 | |
cdalton | 3fc6a2f | 2014-11-13 11:54:20 -0800 | [diff] [blame] | 69 | virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) = 0; |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 70 | |
| 71 | uint8_t fType; |
| 72 | }; |
| 73 | |
| 74 | struct Draw : public Cmd { |
joshualitt | 54e0c12 | 2014-11-19 09:38:51 -0800 | [diff] [blame] | 75 | Draw(const DrawInfo& info) : Cmd(kDraw_Cmd), fInfo(info) {} |
bsalomon | b3e3a95 | 2014-09-19 11:10:40 -0700 | [diff] [blame] | 76 | |
bsalomon | 932f866 | 2014-11-24 06:47:48 -0800 | [diff] [blame] | 77 | void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 78 | |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 79 | DrawInfo fInfo; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 80 | }; |
| 81 | |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 82 | struct StencilPath : public Cmd { |
| 83 | StencilPath(const GrPath* path) : Cmd(kStencilPath_Cmd), fPath(path) {} |
sugoi@google.com | 5f74cf8 | 2012-12-17 21:16:45 +0000 | [diff] [blame] | 84 | |
bsalomon | b3e3a95 | 2014-09-19 11:10:40 -0700 | [diff] [blame] | 85 | const GrPath* path() const { return fPath.get(); } |
| 86 | |
bsalomon | 932f866 | 2014-11-24 06:47:48 -0800 | [diff] [blame] | 87 | void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 88 | |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 89 | GrStencilSettings fStencilSettings; |
bsalomon | b3e3a95 | 2014-09-19 11:10:40 -0700 | [diff] [blame] | 90 | |
| 91 | private: |
bsalomon | bcf0a52 | 2014-10-08 08:40:09 -0700 | [diff] [blame] | 92 | GrPendingIOResource<const GrPath, kRead_GrIOType> fPath; |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 93 | }; |
| 94 | |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 95 | struct DrawPath : public Cmd { |
| 96 | DrawPath(const GrPath* path) : Cmd(kDrawPath_Cmd), fPath(path) {} |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 97 | |
bsalomon | b3e3a95 | 2014-09-19 11:10:40 -0700 | [diff] [blame] | 98 | const GrPath* path() const { return fPath.get(); } |
| 99 | |
bsalomon | 932f866 | 2014-11-24 06:47:48 -0800 | [diff] [blame] | 100 | void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 101 | |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 102 | GrStencilSettings fStencilSettings; |
bsalomon | b3e3a95 | 2014-09-19 11:10:40 -0700 | [diff] [blame] | 103 | |
| 104 | private: |
bsalomon | bcf0a52 | 2014-10-08 08:40:09 -0700 | [diff] [blame] | 105 | GrPendingIOResource<const GrPath, kRead_GrIOType> fPath; |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 106 | }; |
| 107 | |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 108 | struct DrawPaths : public Cmd { |
| 109 | DrawPaths(const GrPathRange* pathRange) : Cmd(kDrawPaths_Cmd), fPathRange(pathRange) {} |
bsalomon | b3e3a95 | 2014-09-19 11:10:40 -0700 | [diff] [blame] | 110 | |
| 111 | const GrPathRange* pathRange() const { return fPathRange.get(); } |
| 112 | |
bsalomon | 932f866 | 2014-11-24 06:47:48 -0800 | [diff] [blame] | 113 | void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 114 | |
cdalton | 3fc6a2f | 2014-11-13 11:54:20 -0800 | [diff] [blame] | 115 | int fIndicesLocation; |
cdalton | 55b24af | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 116 | PathIndexType fIndexType; |
cdalton | 3fc6a2f | 2014-11-13 11:54:20 -0800 | [diff] [blame] | 117 | int fTransformsLocation; |
cdalton | 55b24af | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 118 | PathTransformType fTransformType; |
| 119 | int fCount; |
joshualitt | 2c93efe | 2014-11-06 12:57:13 -0800 | [diff] [blame] | 120 | GrStencilSettings fStencilSettings; |
bsalomon | b3e3a95 | 2014-09-19 11:10:40 -0700 | [diff] [blame] | 121 | |
| 122 | private: |
bsalomon | bcf0a52 | 2014-10-08 08:40:09 -0700 | [diff] [blame] | 123 | GrPendingIOResource<const GrPathRange, kRead_GrIOType> fPathRange; |
commit-bot@chromium.org | 9b62aa1 | 2014-03-25 11:59:40 +0000 | [diff] [blame] | 124 | }; |
| 125 | |
commit-bot@chromium.org | 28361fa | 2014-03-28 16:08:05 +0000 | [diff] [blame] | 126 | // This is also used to record a discard by setting the color to GrColor_ILLEGAL |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 127 | struct Clear : public Cmd { |
| 128 | Clear(GrRenderTarget* rt) : Cmd(kClear_Cmd), fRenderTarget(rt) {} |
| 129 | |
bsalomon | b3e3a95 | 2014-09-19 11:10:40 -0700 | [diff] [blame] | 130 | GrRenderTarget* renderTarget() const { return fRenderTarget.get(); } |
robertphillips@google.com | c82a8b7 | 2012-06-21 20:15:48 +0000 | [diff] [blame] | 131 | |
bsalomon | 932f866 | 2014-11-24 06:47:48 -0800 | [diff] [blame] | 132 | void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 133 | |
bsalomon | b3e3a95 | 2014-09-19 11:10:40 -0700 | [diff] [blame] | 134 | SkIRect fRect; |
| 135 | GrColor fColor; |
| 136 | bool fCanIgnoreRect; |
| 137 | |
| 138 | private: |
bsalomon | bcf0a52 | 2014-10-08 08:40:09 -0700 | [diff] [blame] | 139 | GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
bsalomon@google.com | 0b335c1 | 2011-04-25 19:17:44 +0000 | [diff] [blame] | 140 | }; |
| 141 | |
joshualitt | 6db519c | 2014-10-29 08:48:18 -0700 | [diff] [blame] | 142 | // This command is ONLY used by the clip mask manager to clear the stencil clip bits |
| 143 | struct ClearStencilClip : public Cmd { |
| 144 | ClearStencilClip(GrRenderTarget* rt) : Cmd(kClear_Cmd), fRenderTarget(rt) {} |
| 145 | |
| 146 | GrRenderTarget* renderTarget() const { return fRenderTarget.get(); } |
| 147 | |
bsalomon | 932f866 | 2014-11-24 06:47:48 -0800 | [diff] [blame] | 148 | void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
joshualitt | 6db519c | 2014-10-29 08:48:18 -0700 | [diff] [blame] | 149 | |
| 150 | SkIRect fRect; |
| 151 | bool fInsideClip; |
| 152 | |
| 153 | private: |
| 154 | GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
| 155 | }; |
| 156 | |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 157 | struct CopySurface : public Cmd { |
| 158 | CopySurface(GrSurface* dst, GrSurface* src) : Cmd(kCopySurface_Cmd), fDst(dst), fSrc(src) {} |
bsalomon | b3e3a95 | 2014-09-19 11:10:40 -0700 | [diff] [blame] | 159 | |
| 160 | GrSurface* dst() const { return fDst.get(); } |
| 161 | GrSurface* src() const { return fSrc.get(); } |
| 162 | |
bsalomon | 932f866 | 2014-11-24 06:47:48 -0800 | [diff] [blame] | 163 | void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 164 | |
bsalomon | b3e3a95 | 2014-09-19 11:10:40 -0700 | [diff] [blame] | 165 | SkIPoint fDstPoint; |
| 166 | SkIRect fSrcRect; |
| 167 | |
| 168 | private: |
bsalomon | bcf0a52 | 2014-10-08 08:40:09 -0700 | [diff] [blame] | 169 | GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst; |
| 170 | GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc; |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 171 | }; |
| 172 | |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 173 | struct SetState : public Cmd { |
bsalomon | 932f866 | 2014-11-24 06:47:48 -0800 | [diff] [blame] | 174 | SetState(const GrDrawState& drawState, GrGpu* gpu, const ScissorState& scissor, |
| 175 | const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType drawType) |
| 176 | : Cmd(kSetState_Cmd) |
| 177 | , fState(drawState, gpu, scissor, dstCopy, drawType) {} |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 178 | |
bsalomon | 932f866 | 2014-11-24 06:47:48 -0800 | [diff] [blame] | 179 | void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 180 | |
bsalomon | 932f866 | 2014-11-24 06:47:48 -0800 | [diff] [blame] | 181 | const GrOptDrawState fState; |
| 182 | GrGpu::DrawType fDrawType; |
bsalomon | f0480b1 | 2014-07-02 12:11:24 -0700 | [diff] [blame] | 183 | }; |
| 184 | |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 185 | typedef void* TCmdAlign; // This wouldn't be enough align if a command used long double. |
| 186 | typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; |
| 187 | |
bsalomon | 371bcbc | 2014-12-01 08:19:34 -0800 | [diff] [blame^] | 188 | void onReset() SK_OVERRIDE; |
| 189 | void onFlush() SK_OVERRIDE; |
| 190 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 191 | // overrides from GrDrawTarget |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 192 | void onDraw(const GrDrawState&, |
| 193 | const DrawInfo&, |
joshualitt | 9176e2c | 2014-11-20 07:28:52 -0800 | [diff] [blame] | 194 | const ScissorState&, |
| 195 | const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 196 | void onDrawRect(GrDrawState*, |
| 197 | const SkRect& rect, |
| 198 | const SkRect* localRect, |
| 199 | const SkMatrix* localMatrix) SK_OVERRIDE; |
commit-bot@chromium.org | 32184d8 | 2013-10-09 15:14:18 +0000 | [diff] [blame] | 200 | |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 201 | void onStencilPath(const GrDrawState&, |
| 202 | const GrPath*, |
joshualitt | 54e0c12 | 2014-11-19 09:38:51 -0800 | [diff] [blame] | 203 | const ScissorState&, |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 204 | const GrStencilSettings&) SK_OVERRIDE; |
| 205 | void onDrawPath(const GrDrawState&, |
| 206 | const GrPath*, |
joshualitt | 54e0c12 | 2014-11-19 09:38:51 -0800 | [diff] [blame] | 207 | const ScissorState&, |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 208 | const GrStencilSettings&, |
| 209 | const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
| 210 | void onDrawPaths(const GrDrawState&, |
| 211 | const GrPathRange*, |
cdalton | 55b24af | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 212 | const void* indices, |
| 213 | PathIndexType, |
| 214 | const float transformValues[], |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 215 | PathTransformType, |
cdalton | 55b24af | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 216 | int count, |
joshualitt | 54e0c12 | 2014-11-19 09:38:51 -0800 | [diff] [blame] | 217 | const ScissorState&, |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 218 | const GrStencilSettings&, |
| 219 | const GrDeviceCoordTexture*) SK_OVERRIDE; |
| 220 | void onClear(const SkIRect* rect, |
| 221 | GrColor color, |
| 222 | bool canIgnoreRect, |
| 223 | GrRenderTarget* renderTarget) SK_OVERRIDE; |
bsalomon | f90a02b | 2014-11-26 12:28:00 -0800 | [diff] [blame] | 224 | bool onCopySurface(GrSurface* dst, |
| 225 | GrSurface* src, |
| 226 | const SkIRect& srcRect, |
| 227 | const SkIPoint& dstPoint) SK_OVERRIDE; |
| 228 | bool onCanCopySurface(const GrSurface* dst, |
| 229 | const GrSurface* src, |
| 230 | const SkIRect& srcRect, |
| 231 | const SkIPoint& dstPoint) SK_OVERRIDE; |
| 232 | bool onInitCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) SK_OVERRIDE; |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 233 | |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 234 | // Attempts to concat instances from info onto the previous draw. info must represent an |
| 235 | // instanced draw. The caller must have already recorded a new draw state and clip if necessary. |
joshualitt | 54e0c12 | 2014-11-19 09:38:51 -0800 | [diff] [blame] | 236 | int concatInstancedDraw(const GrDrawState&, const DrawInfo&); |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 237 | |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 238 | // Determines whether the current draw operation requires a new GrOptDrawState and if so |
| 239 | // records it. If the draw can be skipped false is returned and no new GrOptDrawState is |
| 240 | // recorded. |
| 241 | bool SK_WARN_UNUSED_RESULT recordStateAndShouldDraw(const GrDrawState&, |
| 242 | GrGpu::DrawType, |
joshualitt | 54e0c12 | 2014-11-19 09:38:51 -0800 | [diff] [blame] | 243 | const GrClipMaskManager::ScissorState&, |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 244 | const GrDeviceCoordTexture*); |
bsalomon | 838f62d | 2014-08-05 07:15:57 -0700 | [diff] [blame] | 245 | // We lazily record clip changes in order to skip clips that have no effect. |
cdalton | 6819df3 | 2014-10-15 13:43:48 -0700 | [diff] [blame] | 246 | void recordClipIfNecessary(); |
| 247 | // Records any trace markers for a command after adding it to the buffer. |
| 248 | void recordTraceMarkersIfNecessary(); |
bsalomon | b3e3a95 | 2014-09-19 11:10:40 -0700 | [diff] [blame] | 249 | |
| 250 | virtual bool isIssued(uint32_t drawID) { return drawID != fDrawID; } |
bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 251 | |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 252 | // TODO: Use a single allocator for commands and records |
bsalomon@google.com | 4b90c62 | 2011-09-28 17:52:15 +0000 | [diff] [blame] | 253 | enum { |
cdalton | c4650ee | 2014-11-07 12:51:18 -0800 | [diff] [blame] | 254 | kCmdBufferInitialSizeInBytes = 8 * 1024, |
cdalton | 55b24af | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 255 | kPathIdxBufferMinReserve = 2 * 64, // 64 uint16_t's |
| 256 | kPathXformBufferMinReserve = 2 * 64, // 64 two-float transforms |
bsalomon@google.com | 4b90c62 | 2011-09-28 17:52:15 +0000 | [diff] [blame] | 257 | }; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 258 | |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 259 | CmdBuffer fCmdBuffer; |
bsalomon | 932f866 | 2014-11-24 06:47:48 -0800 | [diff] [blame] | 260 | const GrOptDrawState* fPrevState; |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 261 | SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers; |
cdalton | 55b24af | 2014-11-25 11:00:56 -0800 | [diff] [blame] | 262 | SkTDArray<char> fPathIndexBuffer; |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 263 | SkTDArray<float> fPathTransformBuffer; |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 264 | uint32_t fDrawID; |
robertphillips@google.com | c82a8b7 | 2012-06-21 20:15:48 +0000 | [diff] [blame] | 265 | |
bsalomon | 371bcbc | 2014-12-01 08:19:34 -0800 | [diff] [blame^] | 266 | typedef GrFlushToGpuDrawTarget INHERITED; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 267 | }; |
| 268 | |
| 269 | #endif |