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