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 | #include "GrInOrderDrawBuffer.h" |
commit-bot@chromium.org | fd03d4a | 2013-07-17 21:39:42 +0000 | [diff] [blame] | 9 | |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 10 | #include "GrBufferAllocPool.h" |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 11 | #include "GrDrawTargetCaps.h" |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 12 | #include "GrGpu.h" |
| 13 | #include "GrIndexBuffer.h" |
| 14 | #include "GrPath.h" |
commit-bot@chromium.org | fd03d4a | 2013-07-17 21:39:42 +0000 | [diff] [blame] | 15 | #include "GrPoint.h" |
bsalomon@google.com | 8f9cbd6 | 2011-12-09 15:55:34 +0000 | [diff] [blame] | 16 | #include "GrRenderTarget.h" |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 17 | #include "GrTemplates.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 18 | #include "GrTexture.h" |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 19 | #include "GrVertexBuffer.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 20 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 21 | GrInOrderDrawBuffer::GrInOrderDrawBuffer(GrGpu* gpu, |
bsalomon@google.com | 471d471 | 2011-08-23 15:45:25 +0000 | [diff] [blame] | 22 | GrVertexBufferAllocPool* vertexPool, |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 23 | GrIndexBufferAllocPool* indexPool) |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 24 | : GrDrawTarget(gpu->getContext()) |
| 25 | , fDstGpu(gpu) |
bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 26 | , fClipSet(true) |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 27 | , fClipProxyState(kUnknown_ClipProxyState) |
robertphillips@google.com | 6970557 | 2012-03-21 19:46:50 +0000 | [diff] [blame] | 28 | , fVertexPool(*vertexPool) |
| 29 | , fIndexPool(*indexPool) |
commit-bot@chromium.org | a8916ff | 2013-08-16 15:53:46 +0000 | [diff] [blame^] | 30 | , fFlushing(false) |
| 31 | , fDrawID(0) { |
bsalomon@google.com | 18c9c19 | 2011-09-22 21:01:31 +0000 | [diff] [blame] | 32 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 33 | fDstGpu->ref(); |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 34 | fCaps.reset(SkRef(fDstGpu->caps())); |
bsalomon@google.com | 18c9c19 | 2011-09-22 21:01:31 +0000 | [diff] [blame] | 35 | |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 36 | GrAssert(NULL != vertexPool); |
| 37 | GrAssert(NULL != indexPool); |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 38 | |
| 39 | GeometryPoolState& poolState = fGeoPoolStateStack.push_back(); |
| 40 | poolState.fUsedPoolVertexBytes = 0; |
| 41 | poolState.fUsedPoolIndexBytes = 0; |
| 42 | #if GR_DEBUG |
| 43 | poolState.fPoolVertexBuffer = (GrVertexBuffer*)~0; |
| 44 | poolState.fPoolStartVertex = ~0; |
| 45 | poolState.fPoolIndexBuffer = (GrIndexBuffer*)~0; |
| 46 | poolState.fPoolStartIndex = ~0; |
| 47 | #endif |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 48 | this->reset(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | GrInOrderDrawBuffer::~GrInOrderDrawBuffer() { |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 52 | this->reset(); |
bsalomon@google.com | 4a018bb | 2011-10-28 19:50:21 +0000 | [diff] [blame] | 53 | // This must be called by before the GrDrawTarget destructor |
| 54 | this->releaseGeometry(); |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 55 | fDstGpu->unref(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 56 | } |
| 57 | |
bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 58 | //////////////////////////////////////////////////////////////////////////////// |
| 59 | |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 60 | namespace { |
| 61 | void get_vertex_bounds(const void* vertices, |
| 62 | size_t vertexSize, |
| 63 | int vertexCount, |
| 64 | SkRect* bounds) { |
| 65 | GrAssert(vertexSize >= sizeof(GrPoint)); |
| 66 | GrAssert(vertexCount > 0); |
| 67 | const GrPoint* point = static_cast<const GrPoint*>(vertices); |
| 68 | bounds->fLeft = bounds->fRight = point->fX; |
| 69 | bounds->fTop = bounds->fBottom = point->fY; |
| 70 | for (int i = 1; i < vertexCount; ++i) { |
| 71 | point = reinterpret_cast<GrPoint*>(reinterpret_cast<intptr_t>(point) + vertexSize); |
| 72 | bounds->growToInclude(point->fX, point->fY); |
| 73 | } |
| 74 | } |
bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 75 | } |
| 76 | |
robertphillips@google.com | 4290330 | 2013-04-20 12:26:07 +0000 | [diff] [blame] | 77 | |
| 78 | namespace { |
| 79 | |
| 80 | extern const GrVertexAttrib kRectPosColorUVAttribs[] = { |
| 81 | {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding}, |
| 82 | {kVec4ub_GrVertexAttribType, sizeof(GrPoint), kColor_GrVertexAttribBinding}, |
rmistry@google.com | c9f3b38 | 2013-04-22 12:45:30 +0000 | [diff] [blame] | 83 | {kVec2f_GrVertexAttribType, sizeof(GrPoint)+sizeof(GrColor), |
robertphillips@google.com | 4290330 | 2013-04-20 12:26:07 +0000 | [diff] [blame] | 84 | kLocalCoord_GrVertexAttribBinding}, |
| 85 | }; |
| 86 | |
| 87 | extern const GrVertexAttrib kRectPosUVAttribs[] = { |
| 88 | {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding}, |
| 89 | {kVec2f_GrVertexAttribType, sizeof(GrPoint), kLocalCoord_GrVertexAttribBinding}, |
| 90 | }; |
| 91 | |
| 92 | static void set_vertex_attributes(GrDrawState* drawState, |
| 93 | bool hasColor, bool hasUVs, |
| 94 | int* colorOffset, int* localOffset) { |
| 95 | *colorOffset = -1; |
| 96 | *localOffset = -1; |
| 97 | |
| 98 | // Using per-vertex colors allows batching across colors. (A lot of rects in a row differing |
| 99 | // only in color is a common occurrence in tables). However, having per-vertex colors disables |
| 100 | // blending optimizations because we don't know if the color will be solid or not. These |
| 101 | // optimizations help determine whether coverage and color can be blended correctly when |
| 102 | // dual-source blending isn't available. This comes into play when there is coverage. If colors |
| 103 | // were a stage it could take a hint that every vertex's color will be opaque. |
| 104 | if (hasColor && hasUVs) { |
| 105 | *colorOffset = sizeof(GrPoint); |
| 106 | *localOffset = sizeof(GrPoint) + sizeof(GrColor); |
| 107 | drawState->setVertexAttribs<kRectPosColorUVAttribs>(3); |
| 108 | } else if (hasColor) { |
| 109 | *colorOffset = sizeof(GrPoint); |
| 110 | drawState->setVertexAttribs<kRectPosColorUVAttribs>(2); |
| 111 | } else if (hasUVs) { |
| 112 | *localOffset = sizeof(GrPoint); |
| 113 | drawState->setVertexAttribs<kRectPosUVAttribs>(2); |
| 114 | } else { |
| 115 | drawState->setVertexAttribs<kRectPosUVAttribs>(1); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | }; |
| 120 | |
commit-bot@chromium.org | fd03d4a | 2013-07-17 21:39:42 +0000 | [diff] [blame] | 121 | void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect, |
bsalomon@google.com | 0406b9e | 2013-04-02 21:00:15 +0000 | [diff] [blame] | 122 | const SkMatrix* matrix, |
commit-bot@chromium.org | fd03d4a | 2013-07-17 21:39:42 +0000 | [diff] [blame] | 123 | const SkRect* localRect, |
bsalomon@google.com | 0406b9e | 2013-04-02 21:00:15 +0000 | [diff] [blame] | 124 | const SkMatrix* localMatrix) { |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 125 | GrDrawState::AutoColorRestore acr; |
jvanverth@google.com | 9b855c7 | 2013-03-01 18:21:22 +0000 | [diff] [blame] | 126 | |
| 127 | GrDrawState* drawState = this->drawState(); |
| 128 | |
| 129 | GrColor color = drawState->getColor(); |
jvanverth@google.com | 9b855c7 | 2013-03-01 18:21:22 +0000 | [diff] [blame] | 130 | |
robertphillips@google.com | 4290330 | 2013-04-20 12:26:07 +0000 | [diff] [blame] | 131 | int colorOffset, localOffset; |
| 132 | set_vertex_attributes(drawState, |
| 133 | this->caps()->dualSourceBlendingSupport() || drawState->hasSolidCoverage(), |
| 134 | NULL != localRect, |
| 135 | &colorOffset, &localOffset); |
| 136 | if (colorOffset >= 0) { |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 137 | // We set the draw state's color to white here. This is done so that any batching performed |
| 138 | // in our subclass's onDraw() won't get a false from GrDrawState::op== due to a color |
| 139 | // mismatch. TODO: Once vertex layout is owned by GrDrawState it should skip comparing the |
rmistry@google.com | c9f3b38 | 2013-04-22 12:45:30 +0000 | [diff] [blame] | 140 | // constant color in its op== when the kColor layout bit is set and then we can remove |
robertphillips@google.com | 4290330 | 2013-04-20 12:26:07 +0000 | [diff] [blame] | 141 | // this. |
jvanverth@google.com | 9b855c7 | 2013-03-01 18:21:22 +0000 | [diff] [blame] | 142 | acr.set(drawState, 0xFFFFFFFF); |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 143 | } |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 144 | |
jvanverth@google.com | b75b0a0 | 2013-02-05 20:33:30 +0000 | [diff] [blame] | 145 | AutoReleaseGeometry geo(this, 4, 0); |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 146 | if (!geo.succeeded()) { |
| 147 | GrPrintf("Failed to get space for vertices!\n"); |
bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 148 | return; |
| 149 | } |
| 150 | |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 151 | // Go to device coords to allow batching across matrix changes |
| 152 | SkMatrix combinedMatrix; |
| 153 | if (NULL != matrix) { |
| 154 | combinedMatrix = *matrix; |
| 155 | } else { |
| 156 | combinedMatrix.reset(); |
| 157 | } |
jvanverth@google.com | 9b855c7 | 2013-03-01 18:21:22 +0000 | [diff] [blame] | 158 | combinedMatrix.postConcat(drawState->getViewMatrix()); |
jvanverth@google.com | 3976825 | 2013-02-14 15:25:44 +0000 | [diff] [blame] | 159 | // When the caller has provided an explicit source rect for a stage then we don't want to |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 160 | // modify that stage's matrix. Otherwise if the effect is generating its source rect from |
| 161 | // the vertex positions then we have to account for the view matrix change. |
bsalomon@google.com | 137f134 | 2013-05-29 21:27:53 +0000 | [diff] [blame] | 162 | GrDrawState::AutoViewMatrixRestore avmr; |
| 163 | if (!avmr.setIdentity(drawState)) { |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 164 | return; |
| 165 | } |
| 166 | |
jvanverth@google.com | 9b855c7 | 2013-03-01 18:21:22 +0000 | [diff] [blame] | 167 | size_t vsize = drawState->getVertexSize(); |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 168 | |
| 169 | geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vsize); |
| 170 | combinedMatrix.mapPointsWithStride(geo.positions(), vsize, 4); |
| 171 | |
| 172 | SkRect devBounds; |
| 173 | // since we already computed the dev verts, set the bounds hint. This will help us avoid |
| 174 | // unnecessary clipping in our onDraw(). |
| 175 | get_vertex_bounds(geo.vertices(), vsize, 4, &devBounds); |
| 176 | |
bsalomon@google.com | c781888 | 2013-03-20 19:19:53 +0000 | [diff] [blame] | 177 | if (localOffset >= 0) { |
| 178 | GrPoint* coords = GrTCast<GrPoint*>(GrTCast<intptr_t>(geo.vertices()) + localOffset); |
| 179 | coords->setRectFan(localRect->fLeft, localRect->fTop, |
| 180 | localRect->fRight, localRect->fBottom, |
jvanverth@google.com | 9b855c7 | 2013-03-01 18:21:22 +0000 | [diff] [blame] | 181 | vsize); |
bsalomon@google.com | c781888 | 2013-03-20 19:19:53 +0000 | [diff] [blame] | 182 | if (NULL != localMatrix) { |
| 183 | localMatrix->mapPointsWithStride(coords, vsize, 4); |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 184 | } |
| 185 | } |
| 186 | |
| 187 | if (colorOffset >= 0) { |
| 188 | GrColor* vertColor = GrTCast<GrColor*>(GrTCast<intptr_t>(geo.vertices()) + colorOffset); |
| 189 | for (int i = 0; i < 4; ++i) { |
| 190 | *vertColor = color; |
| 191 | vertColor = (GrColor*) ((intptr_t) vertColor + vsize); |
| 192 | } |
| 193 | } |
| 194 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 195 | this->setIndexSourceToBuffer(this->getContext()->getQuadIndexBuffer()); |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 196 | this->drawIndexedInstances(kTriangles_GrPrimitiveType, 1, 4, 6, &devBounds); |
jvanverth@google.com | 9b855c7 | 2013-03-01 18:21:22 +0000 | [diff] [blame] | 197 | |
| 198 | // to ensure that stashing the drawState ptr is valid |
| 199 | GrAssert(this->drawState() == drawState); |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | bool GrInOrderDrawBuffer::quickInsideClip(const SkRect& devBounds) { |
| 203 | if (!this->getDrawState().isClipState()) { |
| 204 | return true; |
| 205 | } |
| 206 | if (kUnknown_ClipProxyState == fClipProxyState) { |
| 207 | SkIRect rect; |
| 208 | bool iior; |
| 209 | this->getClip()->getConservativeBounds(this->getDrawState().getRenderTarget(), &rect, &iior); |
| 210 | if (iior) { |
| 211 | // The clip is a rect. We will remember that in fProxyClip. It is common for an edge (or |
| 212 | // all edges) of the clip to be at the edge of the RT. However, we get that clipping for |
| 213 | // free via the viewport. We don't want to think that clipping must be enabled in this |
| 214 | // case. So we extend the clip outward from the edge to avoid these false negatives. |
| 215 | fClipProxyState = kValid_ClipProxyState; |
| 216 | fClipProxy = SkRect::MakeFromIRect(rect); |
| 217 | |
| 218 | if (fClipProxy.fLeft <= 0) { |
| 219 | fClipProxy.fLeft = SK_ScalarMin; |
| 220 | } |
| 221 | if (fClipProxy.fTop <= 0) { |
| 222 | fClipProxy.fTop = SK_ScalarMin; |
| 223 | } |
| 224 | if (fClipProxy.fRight >= this->getDrawState().getRenderTarget()->width()) { |
| 225 | fClipProxy.fRight = SK_ScalarMax; |
| 226 | } |
| 227 | if (fClipProxy.fBottom >= this->getDrawState().getRenderTarget()->height()) { |
| 228 | fClipProxy.fBottom = SK_ScalarMax; |
| 229 | } |
| 230 | } else { |
| 231 | fClipProxyState = kInvalid_ClipProxyState; |
| 232 | } |
| 233 | } |
| 234 | if (kValid_ClipProxyState == fClipProxyState) { |
| 235 | return fClipProxy.contains(devBounds); |
| 236 | } |
| 237 | SkPoint originOffset = {SkIntToScalar(this->getClip()->fOrigin.fX), |
| 238 | SkIntToScalar(this->getClip()->fOrigin.fY)}; |
| 239 | SkRect clipSpaceBounds = devBounds; |
| 240 | clipSpaceBounds.offset(originOffset); |
| 241 | return this->getClip()->fClipStack->quickContains(clipSpaceBounds); |
| 242 | } |
| 243 | |
| 244 | int GrInOrderDrawBuffer::concatInstancedDraw(const DrawInfo& info) { |
| 245 | GrAssert(info.isInstanced()); |
| 246 | |
bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 247 | const GeometrySrcState& geomSrc = this->getGeomSrc(); |
jvanverth@google.com | b75b0a0 | 2013-02-05 20:33:30 +0000 | [diff] [blame] | 248 | const GrDrawState& drawState = this->getDrawState(); |
bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 249 | |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 250 | // we only attempt to concat the case when reserved verts are used with a client-specified index |
| 251 | // buffer. To make this work with client-specified VBs we'd need to know if the VB was updated |
| 252 | // between draws. |
| 253 | if (kReserved_GeometrySrcType != geomSrc.fVertexSrc || |
| 254 | kBuffer_GeometrySrcType != geomSrc.fIndexSrc) { |
| 255 | return 0; |
bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 256 | } |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 257 | // Check if there is a draw info that is compatible that uses the same VB from the pool and |
| 258 | // the same IB |
| 259 | if (kDraw_Cmd != fCmds.back()) { |
| 260 | return 0; |
| 261 | } |
| 262 | |
| 263 | DrawRecord* draw = &fDraws.back(); |
| 264 | GeometryPoolState& poolState = fGeoPoolStateStack.back(); |
| 265 | const GrVertexBuffer* vertexBuffer = poolState.fPoolVertexBuffer; |
| 266 | |
| 267 | if (!draw->isInstanced() || |
| 268 | draw->verticesPerInstance() != info.verticesPerInstance() || |
| 269 | draw->indicesPerInstance() != info.indicesPerInstance() || |
| 270 | draw->fVertexBuffer != vertexBuffer || |
jvanverth@google.com | b75b0a0 | 2013-02-05 20:33:30 +0000 | [diff] [blame] | 271 | draw->fIndexBuffer != geomSrc.fIndexBuffer) { |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 272 | return 0; |
| 273 | } |
| 274 | // info does not yet account for the offset from the start of the pool's VB while the previous |
| 275 | // draw record does. |
| 276 | int adjustedStartVertex = poolState.fPoolStartVertex + info.startVertex(); |
| 277 | if (draw->startVertex() + draw->vertexCount() != adjustedStartVertex) { |
| 278 | return 0; |
| 279 | } |
| 280 | |
| 281 | GrAssert(poolState.fPoolStartVertex == draw->startVertex() + draw->vertexCount()); |
| 282 | |
| 283 | // how many instances can be concat'ed onto draw given the size of the index buffer |
| 284 | int instancesToConcat = this->indexCountInCurrentSource() / info.indicesPerInstance(); |
| 285 | instancesToConcat -= draw->instanceCount(); |
| 286 | instancesToConcat = GrMin(instancesToConcat, info.instanceCount()); |
| 287 | |
| 288 | // update the amount of reserved vertex data actually referenced in draws |
skia.committer@gmail.com | ae68392 | 2013-02-06 07:01:54 +0000 | [diff] [blame] | 289 | size_t vertexBytes = instancesToConcat * info.verticesPerInstance() * |
jvanverth@google.com | b75b0a0 | 2013-02-05 20:33:30 +0000 | [diff] [blame] | 290 | drawState.getVertexSize(); |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 291 | poolState.fUsedPoolVertexBytes = GrMax(poolState.fUsedPoolVertexBytes, vertexBytes); |
| 292 | |
| 293 | draw->adjustInstanceCount(instancesToConcat); |
| 294 | return instancesToConcat; |
bsalomon@google.com | 934c570 | 2012-03-20 21:17:58 +0000 | [diff] [blame] | 295 | } |
| 296 | |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 297 | class AutoClipReenable { |
| 298 | public: |
| 299 | AutoClipReenable() : fDrawState(NULL) {} |
| 300 | ~AutoClipReenable() { |
| 301 | if (NULL != fDrawState) { |
| 302 | fDrawState->enableState(GrDrawState::kClip_StateBit); |
| 303 | } |
| 304 | } |
| 305 | void set(GrDrawState* drawState) { |
| 306 | if (drawState->isClipState()) { |
| 307 | fDrawState = drawState; |
| 308 | drawState->disableState(GrDrawState::kClip_StateBit); |
| 309 | } |
| 310 | } |
| 311 | private: |
| 312 | GrDrawState* fDrawState; |
| 313 | }; |
| 314 | |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 315 | void GrInOrderDrawBuffer::onDraw(const DrawInfo& info) { |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 316 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 317 | GeometryPoolState& poolState = fGeoPoolStateStack.back(); |
jvanverth@google.com | b75b0a0 | 2013-02-05 20:33:30 +0000 | [diff] [blame] | 318 | const GrDrawState& drawState = this->getDrawState(); |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 319 | AutoClipReenable acr; |
| 320 | |
jvanverth@google.com | b75b0a0 | 2013-02-05 20:33:30 +0000 | [diff] [blame] | 321 | if (drawState.isClipState() && |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 322 | NULL != info.getDevBounds() && |
| 323 | this->quickInsideClip(*info.getDevBounds())) { |
| 324 | acr.set(this->drawState()); |
| 325 | } |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 326 | |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 327 | if (this->needsNewClip()) { |
| 328 | this->recordClip(); |
| 329 | } |
| 330 | if (this->needsNewState()) { |
| 331 | this->recordState(); |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 332 | } |
| 333 | |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 334 | DrawRecord* draw; |
| 335 | if (info.isInstanced()) { |
| 336 | int instancesConcated = this->concatInstancedDraw(info); |
| 337 | if (info.instanceCount() > instancesConcated) { |
| 338 | draw = this->recordDraw(info); |
| 339 | draw->adjustInstanceCount(-instancesConcated); |
| 340 | } else { |
| 341 | return; |
| 342 | } |
| 343 | } else { |
| 344 | draw = this->recordDraw(info); |
| 345 | } |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 346 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 347 | switch (this->getGeomSrc().fVertexSrc) { |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 348 | case kBuffer_GeometrySrcType: |
| 349 | draw->fVertexBuffer = this->getGeomSrc().fVertexBuffer; |
| 350 | break; |
| 351 | case kReserved_GeometrySrcType: // fallthrough |
| 352 | case kArray_GeometrySrcType: { |
skia.committer@gmail.com | ae68392 | 2013-02-06 07:01:54 +0000 | [diff] [blame] | 353 | size_t vertexBytes = (info.vertexCount() + info.startVertex()) * |
jvanverth@google.com | b75b0a0 | 2013-02-05 20:33:30 +0000 | [diff] [blame] | 354 | drawState.getVertexSize(); |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 355 | poolState.fUsedPoolVertexBytes = GrMax(poolState.fUsedPoolVertexBytes, vertexBytes); |
| 356 | draw->fVertexBuffer = poolState.fPoolVertexBuffer; |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 357 | draw->adjustStartVertex(poolState.fPoolStartVertex); |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 358 | break; |
| 359 | } |
| 360 | default: |
| 361 | GrCrash("unknown geom src type"); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 362 | } |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 363 | draw->fVertexBuffer->ref(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 364 | |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 365 | if (info.isIndexed()) { |
| 366 | switch (this->getGeomSrc().fIndexSrc) { |
| 367 | case kBuffer_GeometrySrcType: |
| 368 | draw->fIndexBuffer = this->getGeomSrc().fIndexBuffer; |
| 369 | break; |
| 370 | case kReserved_GeometrySrcType: // fallthrough |
| 371 | case kArray_GeometrySrcType: { |
| 372 | size_t indexBytes = (info.indexCount() + info.startIndex()) * sizeof(uint16_t); |
| 373 | poolState.fUsedPoolIndexBytes = GrMax(poolState.fUsedPoolIndexBytes, indexBytes); |
| 374 | draw->fIndexBuffer = poolState.fPoolIndexBuffer; |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 375 | draw->adjustStartIndex(poolState.fPoolStartIndex); |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 376 | break; |
| 377 | } |
| 378 | default: |
| 379 | GrCrash("unknown geom src type"); |
| 380 | } |
| 381 | draw->fIndexBuffer->ref(); |
| 382 | } else { |
| 383 | draw->fIndexBuffer = NULL; |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 384 | } |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 385 | } |
| 386 | |
sugoi@google.com | 5f74cf8 | 2012-12-17 21:16:45 +0000 | [diff] [blame] | 387 | GrInOrderDrawBuffer::StencilPath::StencilPath() : fStroke(SkStrokeRec::kFill_InitStyle) {} |
| 388 | |
| 389 | void GrInOrderDrawBuffer::onStencilPath(const GrPath* path, const SkStrokeRec& stroke, |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 390 | SkPath::FillType fill) { |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 391 | if (this->needsNewClip()) { |
| 392 | this->recordClip(); |
| 393 | } |
| 394 | // Only compare the subset of GrDrawState relevant to path stenciling? |
| 395 | if (this->needsNewState()) { |
| 396 | this->recordState(); |
| 397 | } |
| 398 | StencilPath* sp = this->recordStencilPath(); |
| 399 | sp->fPath.reset(path); |
| 400 | path->ref(); |
| 401 | sp->fFill = fill; |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 402 | sp->fStroke = stroke; |
bsalomon@google.com | 64aef2b | 2012-06-11 15:36:13 +0000 | [diff] [blame] | 403 | } |
| 404 | |
commit-bot@chromium.org | fd03d4a | 2013-07-17 21:39:42 +0000 | [diff] [blame] | 405 | void GrInOrderDrawBuffer::clear(const SkIRect* rect, GrColor color, GrRenderTarget* renderTarget) { |
| 406 | SkIRect r; |
bsalomon@google.com | 1b3ce47 | 2012-08-17 13:43:08 +0000 | [diff] [blame] | 407 | if (NULL == renderTarget) { |
| 408 | renderTarget = this->drawState()->getRenderTarget(); |
| 409 | GrAssert(NULL != renderTarget); |
| 410 | } |
bsalomon@google.com | 6aa25c3 | 2011-04-27 19:55:29 +0000 | [diff] [blame] | 411 | if (NULL == rect) { |
| 412 | // We could do something smart and remove previous draws and clears to |
| 413 | // the current render target. If we get that smart we have to make sure |
| 414 | // those draws aren't read before this clear (render-to-texture). |
bsalomon@google.com | 1b3ce47 | 2012-08-17 13:43:08 +0000 | [diff] [blame] | 415 | r.setLTRB(0, 0, renderTarget->width(), renderTarget->height()); |
bsalomon@google.com | 6aa25c3 | 2011-04-27 19:55:29 +0000 | [diff] [blame] | 416 | rect = &r; |
| 417 | } |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 418 | Clear* clr = this->recordClear(); |
| 419 | clr->fColor = color; |
| 420 | clr->fRect = *rect; |
| 421 | clr->fRenderTarget = renderTarget; |
bsalomon@google.com | 1b3ce47 | 2012-08-17 13:43:08 +0000 | [diff] [blame] | 422 | renderTarget->ref(); |
bsalomon@google.com | 0b335c1 | 2011-04-25 19:17:44 +0000 | [diff] [blame] | 423 | } |
| 424 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 425 | void GrInOrderDrawBuffer::reset() { |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 426 | GrAssert(1 == fGeoPoolStateStack.count()); |
| 427 | this->resetVertexSource(); |
| 428 | this->resetIndexSource(); |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 429 | int numDraws = fDraws.count(); |
| 430 | for (int d = 0; d < numDraws; ++d) { |
| 431 | // we always have a VB, but not always an IB |
| 432 | GrAssert(NULL != fDraws[d].fVertexBuffer); |
| 433 | fDraws[d].fVertexBuffer->unref(); |
| 434 | GrSafeUnref(fDraws[d].fIndexBuffer); |
| 435 | } |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 436 | fCmds.reset(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 437 | fDraws.reset(); |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 438 | fStencilPaths.reset(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 439 | fStates.reset(); |
bsalomon@google.com | 0b335c1 | 2011-04-25 19:17:44 +0000 | [diff] [blame] | 440 | fClears.reset(); |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 441 | fVertexPool.reset(); |
| 442 | fIndexPool.reset(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 443 | fClips.reset(); |
robertphillips@google.com | beb1af7 | 2012-07-26 18:52:16 +0000 | [diff] [blame] | 444 | fClipOrigins.reset(); |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 445 | fCopySurfaces.reset(); |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 446 | fClipSet = true; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 447 | } |
| 448 | |
robertphillips@google.com | 1267fbd | 2013-07-03 18:37:27 +0000 | [diff] [blame] | 449 | void GrInOrderDrawBuffer::flush() { |
| 450 | if (fFlushing) { |
| 451 | return; |
| 452 | } |
| 453 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 454 | GrAssert(kReserved_GeometrySrcType != this->getGeomSrc().fVertexSrc); |
| 455 | GrAssert(kReserved_GeometrySrcType != this->getGeomSrc().fIndexSrc); |
bsalomon@google.com | 3f5a95e | 2012-03-08 16:41:42 +0000 | [diff] [blame] | 456 | |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 457 | int numCmds = fCmds.count(); |
bsalomon@google.com | 358e427 | 2013-01-10 14:40:28 +0000 | [diff] [blame] | 458 | if (0 == numCmds) { |
robertphillips@google.com | 1267fbd | 2013-07-03 18:37:27 +0000 | [diff] [blame] | 459 | return; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 460 | } |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 461 | |
| 462 | GrAutoTRestore<bool> flushRestore(&fFlushing); |
| 463 | fFlushing = true; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 464 | |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 465 | fVertexPool.unlock(); |
| 466 | fIndexPool.unlock(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 467 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 468 | GrDrawTarget::AutoClipRestore acr(fDstGpu); |
| 469 | AutoGeometryAndStatePush agasp(fDstGpu, kPreserve_ASRInit); |
bsalomon@google.com | ca43208 | 2013-01-23 19:53:46 +0000 | [diff] [blame] | 470 | |
| 471 | GrDrawState playbackState; |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 472 | GrDrawState* prevDrawState = fDstGpu->drawState(); |
bsalomon@google.com | a5d056a | 2012-03-27 15:59:58 +0000 | [diff] [blame] | 473 | prevDrawState->ref(); |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 474 | fDstGpu->setDrawState(&playbackState); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 475 | |
robertphillips@google.com | beb1af7 | 2012-07-26 18:52:16 +0000 | [diff] [blame] | 476 | GrClipData clipData; |
| 477 | |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 478 | int currState = 0; |
| 479 | int currClip = 0; |
| 480 | int currClear = 0; |
| 481 | int currDraw = 0; |
| 482 | int currStencilPath = 0; |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 483 | int currCopySurface = 0; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 484 | |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 485 | for (int c = 0; c < numCmds; ++c) { |
| 486 | switch (fCmds[c]) { |
| 487 | case kDraw_Cmd: { |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 488 | const DrawRecord& draw = fDraws[currDraw]; |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 489 | fDstGpu->setVertexSourceToBuffer(draw.fVertexBuffer); |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 490 | if (draw.isIndexed()) { |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 491 | fDstGpu->setIndexSourceToBuffer(draw.fIndexBuffer); |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 492 | } |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 493 | fDstGpu->executeDraw(draw); |
bsalomon@google.com | 0b335c1 | 2011-04-25 19:17:44 +0000 | [diff] [blame] | 494 | |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 495 | ++currDraw; |
| 496 | break; |
| 497 | } |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 498 | case kStencilPath_Cmd: { |
| 499 | const StencilPath& sp = fStencilPaths[currStencilPath]; |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 500 | fDstGpu->stencilPath(sp.fPath.get(), sp.fStroke, sp.fFill); |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 501 | ++currStencilPath; |
| 502 | break; |
| 503 | } |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 504 | case kSetState_Cmd: |
bsalomon@google.com | ca43208 | 2013-01-23 19:53:46 +0000 | [diff] [blame] | 505 | fStates[currState].restoreTo(&playbackState); |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 506 | ++currState; |
| 507 | break; |
| 508 | case kSetClip_Cmd: |
robertphillips@google.com | beb1af7 | 2012-07-26 18:52:16 +0000 | [diff] [blame] | 509 | clipData.fClipStack = &fClips[currClip]; |
| 510 | clipData.fOrigin = fClipOrigins[currClip]; |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 511 | fDstGpu->setClip(&clipData); |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 512 | ++currClip; |
| 513 | break; |
| 514 | case kClear_Cmd: |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 515 | fDstGpu->clear(&fClears[currClear].fRect, |
| 516 | fClears[currClear].fColor, |
| 517 | fClears[currClear].fRenderTarget); |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 518 | ++currClear; |
| 519 | break; |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 520 | case kCopySurface_Cmd: |
| 521 | fDstGpu->copySurface(fCopySurfaces[currCopySurface].fDst.get(), |
| 522 | fCopySurfaces[currCopySurface].fSrc.get(), |
| 523 | fCopySurfaces[currCopySurface].fSrcRect, |
| 524 | fCopySurfaces[currCopySurface].fDstPoint); |
| 525 | ++currCopySurface; |
| 526 | break; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 527 | } |
| 528 | } |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 529 | // we should have consumed all the states, clips, etc. |
| 530 | GrAssert(fStates.count() == currState); |
| 531 | GrAssert(fClips.count() == currClip); |
robertphillips@google.com | beb1af7 | 2012-07-26 18:52:16 +0000 | [diff] [blame] | 532 | GrAssert(fClipOrigins.count() == currClip); |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 533 | GrAssert(fClears.count() == currClear); |
| 534 | GrAssert(fDraws.count() == currDraw); |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 535 | GrAssert(fCopySurfaces.count() == currCopySurface); |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 536 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 537 | fDstGpu->setDrawState(prevDrawState); |
bsalomon@google.com | a5d056a | 2012-03-27 15:59:58 +0000 | [diff] [blame] | 538 | prevDrawState->unref(); |
bsalomon@google.com | 55e4a20 | 2013-01-11 13:54:21 +0000 | [diff] [blame] | 539 | this->reset(); |
commit-bot@chromium.org | a8916ff | 2013-08-16 15:53:46 +0000 | [diff] [blame^] | 540 | ++fDrawID; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 541 | } |
| 542 | |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 543 | bool GrInOrderDrawBuffer::onCopySurface(GrSurface* dst, |
| 544 | GrSurface* src, |
| 545 | const SkIRect& srcRect, |
| 546 | const SkIPoint& dstPoint) { |
| 547 | if (fDstGpu->canCopySurface(dst, src, srcRect, dstPoint)) { |
| 548 | CopySurface* cs = this->recordCopySurface(); |
| 549 | cs->fDst.reset(SkRef(dst)); |
| 550 | cs->fSrc.reset(SkRef(src)); |
| 551 | cs->fSrcRect = srcRect; |
| 552 | cs->fDstPoint = dstPoint; |
| 553 | return true; |
| 554 | } else { |
| 555 | return false; |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | bool GrInOrderDrawBuffer::onCanCopySurface(GrSurface* dst, |
| 560 | GrSurface* src, |
| 561 | const SkIRect& srcRect, |
| 562 | const SkIPoint& dstPoint) { |
| 563 | return fDstGpu->canCopySurface(dst, src, srcRect, dstPoint); |
| 564 | } |
| 565 | |
bsalomon@google.com | eb85117 | 2013-04-15 13:51:00 +0000 | [diff] [blame] | 566 | void GrInOrderDrawBuffer::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* desc) { |
| 567 | fDstGpu->initCopySurfaceDstDesc(src, desc); |
| 568 | } |
| 569 | |
bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 570 | void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace( |
bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 571 | int vertexCount, |
| 572 | int indexCount) { |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 573 | // We use geometryHints() to know whether to flush the draw buffer. We |
| 574 | // can't flush if we are inside an unbalanced pushGeometrySource. |
| 575 | // Moreover, flushing blows away vertex and index data that was |
| 576 | // previously reserved. So if the vertex or index data is pulled from |
| 577 | // reserved space and won't be released by this request then we can't |
| 578 | // flush. |
| 579 | bool insideGeoPush = fGeoPoolStateStack.count() > 1; |
bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 580 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 581 | bool unreleasedVertexSpace = |
| 582 | !vertexCount && |
| 583 | kReserved_GeometrySrcType == this->getGeomSrc().fVertexSrc; |
bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 584 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 585 | bool unreleasedIndexSpace = |
| 586 | !indexCount && |
| 587 | kReserved_GeometrySrcType == this->getGeomSrc().fIndexSrc; |
bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 588 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 589 | // we don't want to finalize any reserved geom on the target since |
| 590 | // we don't know that the client has finished writing to it. |
| 591 | bool targetHasReservedGeom = fDstGpu->hasReservedVerticesOrIndices(); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 592 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 593 | int vcount = vertexCount; |
| 594 | int icount = indexCount; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 595 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 596 | if (!insideGeoPush && |
| 597 | !unreleasedVertexSpace && |
| 598 | !unreleasedIndexSpace && |
| 599 | !targetHasReservedGeom && |
| 600 | this->geometryHints(&vcount, &icount)) { |
bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 601 | |
bsalomon@google.com | 6e4e650 | 2013-02-25 20:12:45 +0000 | [diff] [blame] | 602 | this->flush(); |
bsalomon@google.com | 9780538 | 2012-03-13 14:32:07 +0000 | [diff] [blame] | 603 | } |
| 604 | } |
| 605 | |
jvanverth@google.com | b75b0a0 | 2013-02-05 20:33:30 +0000 | [diff] [blame] | 606 | bool GrInOrderDrawBuffer::geometryHints(int* vertexCount, |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 607 | int* indexCount) const { |
| 608 | // we will recommend a flush if the data could fit in a single |
| 609 | // preallocated buffer but none are left and it can't fit |
| 610 | // in the current buffer (which may not be prealloced). |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 611 | bool flush = false; |
| 612 | if (NULL != indexCount) { |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 613 | int32_t currIndices = fIndexPool.currentBufferIndices(); |
| 614 | if (*indexCount > currIndices && |
| 615 | (!fIndexPool.preallocatedBuffersRemaining() && |
| 616 | *indexCount <= fIndexPool.preallocatedBufferIndices())) { |
| 617 | |
| 618 | flush = true; |
| 619 | } |
| 620 | *indexCount = currIndices; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 621 | } |
| 622 | if (NULL != vertexCount) { |
jvanverth@google.com | b75b0a0 | 2013-02-05 20:33:30 +0000 | [diff] [blame] | 623 | size_t vertexSize = this->getDrawState().getVertexSize(); |
jvanverth@google.com | a633898 | 2013-01-31 21:34:25 +0000 | [diff] [blame] | 624 | int32_t currVertices = fVertexPool.currentBufferVertices(vertexSize); |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 625 | if (*vertexCount > currVertices && |
| 626 | (!fVertexPool.preallocatedBuffersRemaining() && |
jvanverth@google.com | a633898 | 2013-01-31 21:34:25 +0000 | [diff] [blame] | 627 | *vertexCount <= fVertexPool.preallocatedBufferVertices(vertexSize))) { |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 628 | |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 629 | flush = true; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 630 | } |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 631 | *vertexCount = currVertices; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 632 | } |
| 633 | return flush; |
| 634 | } |
| 635 | |
jvanverth@google.com | a633898 | 2013-01-31 21:34:25 +0000 | [diff] [blame] | 636 | bool GrInOrderDrawBuffer::onReserveVertexSpace(size_t vertexSize, |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 637 | int vertexCount, |
| 638 | void** vertices) { |
| 639 | GeometryPoolState& poolState = fGeoPoolStateStack.back(); |
| 640 | GrAssert(vertexCount > 0); |
| 641 | GrAssert(NULL != vertices); |
| 642 | GrAssert(0 == poolState.fUsedPoolVertexBytes); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 643 | |
jvanverth@google.com | a633898 | 2013-01-31 21:34:25 +0000 | [diff] [blame] | 644 | *vertices = fVertexPool.makeSpace(vertexSize, |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 645 | vertexCount, |
| 646 | &poolState.fPoolVertexBuffer, |
| 647 | &poolState.fPoolStartVertex); |
| 648 | return NULL != *vertices; |
| 649 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 650 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 651 | bool GrInOrderDrawBuffer::onReserveIndexSpace(int indexCount, void** indices) { |
| 652 | GeometryPoolState& poolState = fGeoPoolStateStack.back(); |
| 653 | GrAssert(indexCount > 0); |
| 654 | GrAssert(NULL != indices); |
| 655 | GrAssert(0 == poolState.fUsedPoolIndexBytes); |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 656 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 657 | *indices = fIndexPool.makeSpace(indexCount, |
| 658 | &poolState.fPoolIndexBuffer, |
| 659 | &poolState.fPoolStartIndex); |
| 660 | return NULL != *indices; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 661 | } |
| 662 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 663 | void GrInOrderDrawBuffer::releaseReservedVertexSpace() { |
| 664 | GeometryPoolState& poolState = fGeoPoolStateStack.back(); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 665 | const GeometrySrcState& geoSrc = this->getGeomSrc(); |
bsalomon@google.com | d57d71a | 2012-08-16 16:26:33 +0000 | [diff] [blame] | 666 | |
| 667 | // If we get a release vertex space call then our current source should either be reserved |
| 668 | // or array (which we copied into reserved space). |
| 669 | GrAssert(kReserved_GeometrySrcType == geoSrc.fVertexSrc || |
| 670 | kArray_GeometrySrcType == geoSrc.fVertexSrc); |
bsalomon@google.com | 3f5a95e | 2012-03-08 16:41:42 +0000 | [diff] [blame] | 671 | |
| 672 | // When the caller reserved vertex buffer space we gave it back a pointer |
| 673 | // provided by the vertex buffer pool. At each draw we tracked the largest |
| 674 | // offset into the pool's pointer that was referenced. Now we return to the |
| 675 | // pool any portion at the tail of the allocation that no draw referenced. |
jvanverth@google.com | b75b0a0 | 2013-02-05 20:33:30 +0000 | [diff] [blame] | 676 | size_t reservedVertexBytes = geoSrc.fVertexSize * geoSrc.fVertexCount; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 677 | fVertexPool.putBack(reservedVertexBytes - |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 678 | poolState.fUsedPoolVertexBytes); |
| 679 | poolState.fUsedPoolVertexBytes = 0; |
bsalomon@google.com | 3f5a95e | 2012-03-08 16:41:42 +0000 | [diff] [blame] | 680 | poolState.fPoolVertexBuffer = NULL; |
| 681 | poolState.fPoolStartVertex = 0; |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 682 | } |
| 683 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 684 | void GrInOrderDrawBuffer::releaseReservedIndexSpace() { |
| 685 | GeometryPoolState& poolState = fGeoPoolStateStack.back(); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 686 | const GeometrySrcState& geoSrc = this->getGeomSrc(); |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 687 | |
bsalomon@google.com | d57d71a | 2012-08-16 16:26:33 +0000 | [diff] [blame] | 688 | // If we get a release index space call then our current source should either be reserved |
| 689 | // or array (which we copied into reserved space). |
| 690 | GrAssert(kReserved_GeometrySrcType == geoSrc.fIndexSrc || |
| 691 | kArray_GeometrySrcType == geoSrc.fIndexSrc); |
bsalomon@google.com | 3f5a95e | 2012-03-08 16:41:42 +0000 | [diff] [blame] | 692 | |
| 693 | // Similar to releaseReservedVertexSpace we return any unused portion at |
| 694 | // the tail |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 695 | size_t reservedIndexBytes = sizeof(uint16_t) * geoSrc.fIndexCount; |
| 696 | fIndexPool.putBack(reservedIndexBytes - poolState.fUsedPoolIndexBytes); |
| 697 | poolState.fUsedPoolIndexBytes = 0; |
bsalomon@google.com | 3f5a95e | 2012-03-08 16:41:42 +0000 | [diff] [blame] | 698 | poolState.fPoolIndexBuffer = NULL; |
| 699 | poolState.fPoolStartIndex = 0; |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 700 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 701 | |
bsalomon@google.com | bcdbbe6 | 2011-04-12 15:40:00 +0000 | [diff] [blame] | 702 | void GrInOrderDrawBuffer::onSetVertexSourceToArray(const void* vertexArray, |
| 703 | int vertexCount) { |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 704 | |
| 705 | GeometryPoolState& poolState = fGeoPoolStateStack.back(); |
| 706 | GrAssert(0 == poolState.fUsedPoolVertexBytes); |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 707 | #if GR_DEBUG |
| 708 | bool success = |
| 709 | #endif |
jvanverth@google.com | b75b0a0 | 2013-02-05 20:33:30 +0000 | [diff] [blame] | 710 | fVertexPool.appendVertices(this->getVertexSize(), |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 711 | vertexCount, |
| 712 | vertexArray, |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 713 | &poolState.fPoolVertexBuffer, |
| 714 | &poolState.fPoolStartVertex); |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 715 | GR_DEBUGASSERT(success); |
| 716 | } |
| 717 | |
bsalomon@google.com | bcdbbe6 | 2011-04-12 15:40:00 +0000 | [diff] [blame] | 718 | void GrInOrderDrawBuffer::onSetIndexSourceToArray(const void* indexArray, |
| 719 | int indexCount) { |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 720 | GeometryPoolState& poolState = fGeoPoolStateStack.back(); |
| 721 | GrAssert(0 == poolState.fUsedPoolIndexBytes); |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 722 | #if GR_DEBUG |
| 723 | bool success = |
| 724 | #endif |
| 725 | fIndexPool.appendIndices(indexCount, |
| 726 | indexArray, |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 727 | &poolState.fPoolIndexBuffer, |
| 728 | &poolState.fPoolStartIndex); |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 729 | GR_DEBUGASSERT(success); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 730 | } |
| 731 | |
bsalomon@google.com | 3f5a95e | 2012-03-08 16:41:42 +0000 | [diff] [blame] | 732 | void GrInOrderDrawBuffer::releaseVertexArray() { |
| 733 | // When the client provides an array as the vertex source we handled it |
| 734 | // by copying their array into reserved space. |
| 735 | this->GrInOrderDrawBuffer::releaseReservedVertexSpace(); |
| 736 | } |
| 737 | |
| 738 | void GrInOrderDrawBuffer::releaseIndexArray() { |
| 739 | // When the client provides an array as the index source we handled it |
| 740 | // by copying their array into reserved space. |
| 741 | this->GrInOrderDrawBuffer::releaseReservedIndexSpace(); |
| 742 | } |
| 743 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 744 | void GrInOrderDrawBuffer::geometrySourceWillPush() { |
| 745 | GeometryPoolState& poolState = fGeoPoolStateStack.push_back(); |
| 746 | poolState.fUsedPoolVertexBytes = 0; |
| 747 | poolState.fUsedPoolIndexBytes = 0; |
| 748 | #if GR_DEBUG |
| 749 | poolState.fPoolVertexBuffer = (GrVertexBuffer*)~0; |
| 750 | poolState.fPoolStartVertex = ~0; |
| 751 | poolState.fPoolIndexBuffer = (GrIndexBuffer*)~0; |
| 752 | poolState.fPoolStartIndex = ~0; |
| 753 | #endif |
| 754 | } |
| 755 | |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 756 | void GrInOrderDrawBuffer::geometrySourceWillPop( |
| 757 | const GeometrySrcState& restoredState) { |
| 758 | GrAssert(fGeoPoolStateStack.count() > 1); |
| 759 | fGeoPoolStateStack.pop_back(); |
| 760 | GeometryPoolState& poolState = fGeoPoolStateStack.back(); |
| 761 | // we have to assume that any slack we had in our vertex/index data |
| 762 | // is now unreleasable because data may have been appended later in the |
| 763 | // pool. |
| 764 | if (kReserved_GeometrySrcType == restoredState.fVertexSrc || |
| 765 | kArray_GeometrySrcType == restoredState.fVertexSrc) { |
jvanverth@google.com | b75b0a0 | 2013-02-05 20:33:30 +0000 | [diff] [blame] | 766 | poolState.fUsedPoolVertexBytes = restoredState.fVertexSize * restoredState.fVertexCount; |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 767 | } |
| 768 | if (kReserved_GeometrySrcType == restoredState.fIndexSrc || |
| 769 | kArray_GeometrySrcType == restoredState.fIndexSrc) { |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 770 | poolState.fUsedPoolIndexBytes = sizeof(uint16_t) * |
bsalomon@google.com | 25fb21f | 2011-06-21 18:17:25 +0000 | [diff] [blame] | 771 | restoredState.fIndexCount; |
| 772 | } |
| 773 | } |
| 774 | |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 775 | bool GrInOrderDrawBuffer::needsNewState() const { |
bsalomon@google.com | ca43208 | 2013-01-23 19:53:46 +0000 | [diff] [blame] | 776 | return fStates.empty() || !fStates.back().isEqual(this->getDrawState()); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 777 | } |
| 778 | |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 779 | bool GrInOrderDrawBuffer::needsNewClip() const { |
bsalomon@google.com | 358e427 | 2013-01-10 14:40:28 +0000 | [diff] [blame] | 780 | GrAssert(fClips.count() == fClipOrigins.count()); |
| 781 | if (this->getDrawState().isClipState()) { |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 782 | if (fClipSet && |
bsalomon@google.com | 358e427 | 2013-01-10 14:40:28 +0000 | [diff] [blame] | 783 | (fClips.empty() || |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 784 | fClips.back() != *this->getClip()->fClipStack || |
| 785 | fClipOrigins.back() != this->getClip()->fOrigin)) { |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 786 | return true; |
| 787 | } |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 788 | } |
| 789 | return false; |
| 790 | } |
bsalomon@google.com | d302f14 | 2011-03-03 13:54:13 +0000 | [diff] [blame] | 791 | |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 792 | void GrInOrderDrawBuffer::recordClip() { |
bsalomon@google.com | 02ddc8b | 2013-01-28 15:35:28 +0000 | [diff] [blame] | 793 | fClips.push_back() = *this->getClip()->fClipStack; |
| 794 | fClipOrigins.push_back() = this->getClip()->fOrigin; |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 795 | fClipSet = false; |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 796 | fCmds.push_back(kSetClip_Cmd); |
| 797 | } |
| 798 | |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 799 | void GrInOrderDrawBuffer::recordState() { |
bsalomon@google.com | ca43208 | 2013-01-23 19:53:46 +0000 | [diff] [blame] | 800 | fStates.push_back().saveFrom(this->getDrawState()); |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 801 | fCmds.push_back(kSetState_Cmd); |
| 802 | } |
| 803 | |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 804 | GrInOrderDrawBuffer::DrawRecord* GrInOrderDrawBuffer::recordDraw(const DrawInfo& info) { |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 805 | fCmds.push_back(kDraw_Cmd); |
| 806 | return &fDraws.push_back(info); |
bsalomon@google.com | 74749cd | 2013-01-30 16:12:41 +0000 | [diff] [blame] | 807 | } |
| 808 | |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 809 | GrInOrderDrawBuffer::StencilPath* GrInOrderDrawBuffer::recordStencilPath() { |
| 810 | fCmds.push_back(kStencilPath_Cmd); |
| 811 | return &fStencilPaths.push_back(); |
| 812 | } |
| 813 | |
bsalomon@google.com | a4f6b10 | 2012-06-26 21:04:22 +0000 | [diff] [blame] | 814 | GrInOrderDrawBuffer::Clear* GrInOrderDrawBuffer::recordClear() { |
| 815 | fCmds.push_back(kClear_Cmd); |
| 816 | return &fClears.push_back(); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 817 | } |
bsalomon@google.com | d302f14 | 2011-03-03 13:54:13 +0000 | [diff] [blame] | 818 | |
bsalomon@google.com | 116ad84 | 2013-04-09 15:38:19 +0000 | [diff] [blame] | 819 | GrInOrderDrawBuffer::CopySurface* GrInOrderDrawBuffer::recordCopySurface() { |
| 820 | fCmds.push_back(kCopySurface_Cmd); |
| 821 | return &fCopySurfaces.push_back(); |
| 822 | } |
| 823 | |
| 824 | |
robertphillips@google.com | beb1af7 | 2012-07-26 18:52:16 +0000 | [diff] [blame] | 825 | void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { |
| 826 | INHERITED::clipWillBeSet(newClipData); |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 827 | fClipSet = true; |
bsalomon@google.com | d62e88e | 2013-02-01 14:19:27 +0000 | [diff] [blame] | 828 | fClipProxyState = kUnknown_ClipProxyState; |
bsalomon@google.com | 86afc2a | 2011-02-16 16:12:19 +0000 | [diff] [blame] | 829 | } |