| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 void GrGpu::abandonResources() { | 60 void GrGpu::abandonResources() { |
| 61 | 61 |
| 62 fClipMaskManager.releaseResources(); | 62 fClipMaskManager.releaseResources(); |
| 63 | 63 |
| 64 while (NULL != fResourceList.head()) { | 64 while (NULL != fResourceList.head()) { |
| 65 fResourceList.head()->abandon(); | 65 fResourceList.head()->abandon(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 GrAssert(NULL == fQuadIndexBuffer || !fQuadIndexBuffer->isValid()); | 68 SkASSERT(NULL == fQuadIndexBuffer || !fQuadIndexBuffer->isValid()); |
| 69 GrSafeSetNull(fQuadIndexBuffer); | 69 GrSafeSetNull(fQuadIndexBuffer); |
| 70 delete fVertexPool; | 70 delete fVertexPool; |
| 71 fVertexPool = NULL; | 71 fVertexPool = NULL; |
| 72 delete fIndexPool; | 72 delete fIndexPool; |
| 73 fIndexPool = NULL; | 73 fIndexPool = NULL; |
| 74 } | 74 } |
| 75 | 75 |
| 76 void GrGpu::releaseResources() { | 76 void GrGpu::releaseResources() { |
| 77 | 77 |
| 78 fClipMaskManager.releaseResources(); | 78 fClipMaskManager.releaseResources(); |
| 79 | 79 |
| 80 while (NULL != fResourceList.head()) { | 80 while (NULL != fResourceList.head()) { |
| 81 fResourceList.head()->release(); | 81 fResourceList.head()->release(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 GrAssert(NULL == fQuadIndexBuffer || !fQuadIndexBuffer->isValid()); | 84 SkASSERT(NULL == fQuadIndexBuffer || !fQuadIndexBuffer->isValid()); |
| 85 GrSafeSetNull(fQuadIndexBuffer); | 85 GrSafeSetNull(fQuadIndexBuffer); |
| 86 delete fVertexPool; | 86 delete fVertexPool; |
| 87 fVertexPool = NULL; | 87 fVertexPool = NULL; |
| 88 delete fIndexPool; | 88 delete fIndexPool; |
| 89 fIndexPool = NULL; | 89 fIndexPool = NULL; |
| 90 } | 90 } |
| 91 | 91 |
| 92 void GrGpu::insertResource(GrResource* resource) { | 92 void GrGpu::insertResource(GrResource* resource) { |
| 93 GrAssert(NULL != resource); | 93 SkASSERT(NULL != resource); |
| 94 GrAssert(this == resource->getGpu()); | 94 SkASSERT(this == resource->getGpu()); |
| 95 | 95 |
| 96 fResourceList.addToHead(resource); | 96 fResourceList.addToHead(resource); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void GrGpu::removeResource(GrResource* resource) { | 99 void GrGpu::removeResource(GrResource* resource) { |
| 100 GrAssert(NULL != resource); | 100 SkASSERT(NULL != resource); |
| 101 GrAssert(this == resource->getGpu()); | 101 SkASSERT(this == resource->getGpu()); |
| 102 | 102 |
| 103 fResourceList.remove(resource); | 103 fResourceList.remove(resource); |
| 104 } | 104 } |
| 105 | 105 |
| 106 | 106 |
| 107 void GrGpu::unimpl(const char msg[]) { | 107 void GrGpu::unimpl(const char msg[]) { |
| 108 #if GR_DEBUG | 108 #if GR_DEBUG |
| 109 GrPrintf("--- GrGpu unimplemented(\"%s\")\n", msg); | 109 GrPrintf("--- GrGpu unimplemented(\"%s\")\n", msg); |
| 110 #endif | 110 #endif |
| 111 } | 111 } |
| 112 | 112 |
| 113 //////////////////////////////////////////////////////////////////////////////// | 113 //////////////////////////////////////////////////////////////////////////////// |
| 114 | 114 |
| 115 GrTexture* GrGpu::createTexture(const GrTextureDesc& desc, | 115 GrTexture* GrGpu::createTexture(const GrTextureDesc& desc, |
| 116 const void* srcData, size_t rowBytes) { | 116 const void* srcData, size_t rowBytes) { |
| 117 if (kUnknown_GrPixelConfig == desc.fConfig) { | 117 if (kUnknown_GrPixelConfig == desc.fConfig) { |
| 118 return NULL; | 118 return NULL; |
| 119 } | 119 } |
| 120 | 120 |
| 121 this->handleDirtyContext(); | 121 this->handleDirtyContext(); |
| 122 GrTexture* tex = this->onCreateTexture(desc, srcData, rowBytes); | 122 GrTexture* tex = this->onCreateTexture(desc, srcData, rowBytes); |
| 123 if (NULL != tex && | 123 if (NULL != tex && |
| 124 (kRenderTarget_GrTextureFlagBit & desc.fFlags) && | 124 (kRenderTarget_GrTextureFlagBit & desc.fFlags) && |
| 125 !(kNoStencil_GrTextureFlagBit & desc.fFlags)) { | 125 !(kNoStencil_GrTextureFlagBit & desc.fFlags)) { |
| 126 GrAssert(NULL != tex->asRenderTarget()); | 126 SkASSERT(NULL != tex->asRenderTarget()); |
| 127 // TODO: defer this and attach dynamically | 127 // TODO: defer this and attach dynamically |
| 128 if (!this->attachStencilBufferToRenderTarget(tex->asRenderTarget())) { | 128 if (!this->attachStencilBufferToRenderTarget(tex->asRenderTarget())) { |
| 129 tex->unref(); | 129 tex->unref(); |
| 130 return NULL; | 130 return NULL; |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 return tex; | 133 return tex; |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { | 136 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { |
| 137 GrAssert(NULL == rt->getStencilBuffer()); | 137 SkASSERT(NULL == rt->getStencilBuffer()); |
| 138 GrStencilBuffer* sb = | 138 GrStencilBuffer* sb = |
| 139 this->getContext()->findStencilBuffer(rt->width(), | 139 this->getContext()->findStencilBuffer(rt->width(), |
| 140 rt->height(), | 140 rt->height(), |
| 141 rt->numSamples()); | 141 rt->numSamples()); |
| 142 if (NULL != sb) { | 142 if (NULL != sb) { |
| 143 rt->setStencilBuffer(sb); | 143 rt->setStencilBuffer(sb); |
| 144 bool attached = this->attachStencilBufferToRenderTarget(sb, rt); | 144 bool attached = this->attachStencilBufferToRenderTarget(sb, rt); |
| 145 if (!attached) { | 145 if (!attached) { |
| 146 rt->setStencilBuffer(NULL); | 146 rt->setStencilBuffer(NULL); |
| 147 } | 147 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 this->handleDirtyContext(); | 191 this->handleDirtyContext(); |
| 192 return this->onCreateVertexBuffer(size, dynamic); | 192 return this->onCreateVertexBuffer(size, dynamic); |
| 193 } | 193 } |
| 194 | 194 |
| 195 GrIndexBuffer* GrGpu::createIndexBuffer(uint32_t size, bool dynamic) { | 195 GrIndexBuffer* GrGpu::createIndexBuffer(uint32_t size, bool dynamic) { |
| 196 this->handleDirtyContext(); | 196 this->handleDirtyContext(); |
| 197 return this->onCreateIndexBuffer(size, dynamic); | 197 return this->onCreateIndexBuffer(size, dynamic); |
| 198 } | 198 } |
| 199 | 199 |
| 200 GrPath* GrGpu::createPath(const SkPath& path) { | 200 GrPath* GrGpu::createPath(const SkPath& path) { |
| 201 GrAssert(this->caps()->pathStencilingSupport()); | 201 SkASSERT(this->caps()->pathStencilingSupport()); |
| 202 this->handleDirtyContext(); | 202 this->handleDirtyContext(); |
| 203 return this->onCreatePath(path); | 203 return this->onCreatePath(path); |
| 204 } | 204 } |
| 205 | 205 |
| 206 void GrGpu::clear(const SkIRect* rect, | 206 void GrGpu::clear(const SkIRect* rect, |
| 207 GrColor color, | 207 GrColor color, |
| 208 GrRenderTarget* renderTarget) { | 208 GrRenderTarget* renderTarget) { |
| 209 GrDrawState::AutoRenderTargetRestore art; | 209 GrDrawState::AutoRenderTargetRestore art; |
| 210 if (NULL != renderTarget) { | 210 if (NULL != renderTarget) { |
| 211 art.set(this->drawState(), renderTarget); | 211 art.set(this->drawState(), renderTarget); |
| 212 } | 212 } |
| 213 if (NULL == this->getDrawState().getRenderTarget()) { | 213 if (NULL == this->getDrawState().getRenderTarget()) { |
| 214 GrAssert(0); | 214 SkASSERT(0); |
| 215 return; | 215 return; |
| 216 } | 216 } |
| 217 this->handleDirtyContext(); | 217 this->handleDirtyContext(); |
| 218 this->onClear(rect, color); | 218 this->onClear(rect, color); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void GrGpu::forceRenderTargetFlush() { | 221 void GrGpu::forceRenderTargetFlush() { |
| 222 this->handleDirtyContext(); | 222 this->handleDirtyContext(); |
| 223 this->onForceRenderTargetFlush(); | 223 this->onForceRenderTargetFlush(); |
| 224 } | 224 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 235 bool GrGpu::writeTexturePixels(GrTexture* texture, | 235 bool GrGpu::writeTexturePixels(GrTexture* texture, |
| 236 int left, int top, int width, int height, | 236 int left, int top, int width, int height, |
| 237 GrPixelConfig config, const void* buffer, | 237 GrPixelConfig config, const void* buffer, |
| 238 size_t rowBytes) { | 238 size_t rowBytes) { |
| 239 this->handleDirtyContext(); | 239 this->handleDirtyContext(); |
| 240 return this->onWriteTexturePixels(texture, left, top, width, height, | 240 return this->onWriteTexturePixels(texture, left, top, width, height, |
| 241 config, buffer, rowBytes); | 241 config, buffer, rowBytes); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void GrGpu::resolveRenderTarget(GrRenderTarget* target) { | 244 void GrGpu::resolveRenderTarget(GrRenderTarget* target) { |
| 245 GrAssert(target); | 245 SkASSERT(target); |
| 246 this->handleDirtyContext(); | 246 this->handleDirtyContext(); |
| 247 this->onResolveRenderTarget(target); | 247 this->onResolveRenderTarget(target); |
| 248 } | 248 } |
| 249 | 249 |
| 250 | 250 |
| 251 //////////////////////////////////////////////////////////////////////////////// | 251 //////////////////////////////////////////////////////////////////////////////// |
| 252 | 252 |
| 253 static const int MAX_QUADS = 1 << 12; // max possible: (1 << 14) - 1; | 253 static const int MAX_QUADS = 1 << 12; // max possible: (1 << 14) - 1; |
| 254 | 254 |
| 255 GR_STATIC_ASSERT(4 * MAX_QUADS <= 65535); | 255 GR_STATIC_ASSERT(4 * MAX_QUADS <= 65535); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 newState.fPoolStartVertex = DEBUG_INVAL_START_IDX; | 324 newState.fPoolStartVertex = DEBUG_INVAL_START_IDX; |
| 325 newState.fPoolIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER; | 325 newState.fPoolIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER; |
| 326 newState.fPoolStartIndex = DEBUG_INVAL_START_IDX; | 326 newState.fPoolStartIndex = DEBUG_INVAL_START_IDX; |
| 327 #else | 327 #else |
| 328 (void) newState; // silence compiler warning | 328 (void) newState; // silence compiler warning |
| 329 #endif | 329 #endif |
| 330 } | 330 } |
| 331 | 331 |
| 332 void GrGpu::geometrySourceWillPop(const GeometrySrcState& restoredState) { | 332 void GrGpu::geometrySourceWillPop(const GeometrySrcState& restoredState) { |
| 333 // if popping last entry then pops are unbalanced with pushes | 333 // if popping last entry then pops are unbalanced with pushes |
| 334 GrAssert(fGeomPoolStateStack.count() > 1); | 334 SkASSERT(fGeomPoolStateStack.count() > 1); |
| 335 fGeomPoolStateStack.pop_back(); | 335 fGeomPoolStateStack.pop_back(); |
| 336 } | 336 } |
| 337 | 337 |
| 338 void GrGpu::onDraw(const DrawInfo& info) { | 338 void GrGpu::onDraw(const DrawInfo& info) { |
| 339 this->handleDirtyContext(); | 339 this->handleDirtyContext(); |
| 340 GrDrawState::AutoRestoreEffects are; | 340 GrDrawState::AutoRestoreEffects are; |
| 341 if (!this->setupClipAndFlushState(PrimTypeToDrawType(info.primitiveType()), | 341 if (!this->setupClipAndFlushState(PrimTypeToDrawType(info.primitiveType()), |
| 342 info.getDstCopy(), | 342 info.getDstCopy(), |
| 343 &are)) { | 343 &are)) { |
| 344 return; | 344 return; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 355 this->setStencilPathSettings(*path, fill, this->drawState()->stencil()); | 355 this->setStencilPathSettings(*path, fill, this->drawState()->stencil()); |
| 356 GrDrawState::AutoRestoreEffects are; | 356 GrDrawState::AutoRestoreEffects are; |
| 357 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, &are)) { | 357 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, &are)) { |
| 358 return; | 358 return; |
| 359 } | 359 } |
| 360 | 360 |
| 361 this->onGpuStencilPath(path, fill); | 361 this->onGpuStencilPath(path, fill); |
| 362 } | 362 } |
| 363 | 363 |
| 364 void GrGpu::finalizeReservedVertices() { | 364 void GrGpu::finalizeReservedVertices() { |
| 365 GrAssert(NULL != fVertexPool); | 365 SkASSERT(NULL != fVertexPool); |
| 366 fVertexPool->unlock(); | 366 fVertexPool->unlock(); |
| 367 } | 367 } |
| 368 | 368 |
| 369 void GrGpu::finalizeReservedIndices() { | 369 void GrGpu::finalizeReservedIndices() { |
| 370 GrAssert(NULL != fIndexPool); | 370 SkASSERT(NULL != fIndexPool); |
| 371 fIndexPool->unlock(); | 371 fIndexPool->unlock(); |
| 372 } | 372 } |
| 373 | 373 |
| 374 void GrGpu::prepareVertexPool() { | 374 void GrGpu::prepareVertexPool() { |
| 375 if (NULL == fVertexPool) { | 375 if (NULL == fVertexPool) { |
| 376 GrAssert(0 == fVertexPoolUseCnt); | 376 SkASSERT(0 == fVertexPoolUseCnt); |
| 377 fVertexPool = SkNEW_ARGS(GrVertexBufferAllocPool, (this, true, | 377 fVertexPool = SkNEW_ARGS(GrVertexBufferAllocPool, (this, true, |
| 378 VERTEX_POOL_VB_SIZE, | 378 VERTEX_POOL_VB_SIZE, |
| 379 VERTEX_POOL_VB_COUNT)); | 379 VERTEX_POOL_VB_COUNT)); |
| 380 fVertexPool->releaseGpuRef(); | 380 fVertexPool->releaseGpuRef(); |
| 381 } else if (!fVertexPoolUseCnt) { | 381 } else if (!fVertexPoolUseCnt) { |
| 382 // the client doesn't have valid data in the pool | 382 // the client doesn't have valid data in the pool |
| 383 fVertexPool->reset(); | 383 fVertexPool->reset(); |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 | 386 |
| 387 void GrGpu::prepareIndexPool() { | 387 void GrGpu::prepareIndexPool() { |
| 388 if (NULL == fIndexPool) { | 388 if (NULL == fIndexPool) { |
| 389 GrAssert(0 == fIndexPoolUseCnt); | 389 SkASSERT(0 == fIndexPoolUseCnt); |
| 390 fIndexPool = SkNEW_ARGS(GrIndexBufferAllocPool, (this, true, | 390 fIndexPool = SkNEW_ARGS(GrIndexBufferAllocPool, (this, true, |
| 391 INDEX_POOL_IB_SIZE, | 391 INDEX_POOL_IB_SIZE, |
| 392 INDEX_POOL_IB_COUNT)); | 392 INDEX_POOL_IB_COUNT)); |
| 393 fIndexPool->releaseGpuRef(); | 393 fIndexPool->releaseGpuRef(); |
| 394 } else if (!fIndexPoolUseCnt) { | 394 } else if (!fIndexPoolUseCnt) { |
| 395 // the client doesn't have valid data in the pool | 395 // the client doesn't have valid data in the pool |
| 396 fIndexPool->reset(); | 396 fIndexPool->reset(); |
| 397 } | 397 } |
| 398 } | 398 } |
| 399 | 399 |
| 400 bool GrGpu::onReserveVertexSpace(size_t vertexSize, | 400 bool GrGpu::onReserveVertexSpace(size_t vertexSize, |
| 401 int vertexCount, | 401 int vertexCount, |
| 402 void** vertices) { | 402 void** vertices) { |
| 403 GeometryPoolState& geomPoolState = fGeomPoolStateStack.back(); | 403 GeometryPoolState& geomPoolState = fGeomPoolStateStack.back(); |
| 404 | 404 |
| 405 GrAssert(vertexCount > 0); | 405 SkASSERT(vertexCount > 0); |
| 406 GrAssert(NULL != vertices); | 406 SkASSERT(NULL != vertices); |
| 407 | 407 |
| 408 this->prepareVertexPool(); | 408 this->prepareVertexPool(); |
| 409 | 409 |
| 410 *vertices = fVertexPool->makeSpace(vertexSize, | 410 *vertices = fVertexPool->makeSpace(vertexSize, |
| 411 vertexCount, | 411 vertexCount, |
| 412 &geomPoolState.fPoolVertexBuffer, | 412 &geomPoolState.fPoolVertexBuffer, |
| 413 &geomPoolState.fPoolStartVertex); | 413 &geomPoolState.fPoolStartVertex); |
| 414 if (NULL == *vertices) { | 414 if (NULL == *vertices) { |
| 415 return false; | 415 return false; |
| 416 } | 416 } |
| 417 ++fVertexPoolUseCnt; | 417 ++fVertexPoolUseCnt; |
| 418 return true; | 418 return true; |
| 419 } | 419 } |
| 420 | 420 |
| 421 bool GrGpu::onReserveIndexSpace(int indexCount, void** indices) { | 421 bool GrGpu::onReserveIndexSpace(int indexCount, void** indices) { |
| 422 GeometryPoolState& geomPoolState = fGeomPoolStateStack.back(); | 422 GeometryPoolState& geomPoolState = fGeomPoolStateStack.back(); |
| 423 | 423 |
| 424 GrAssert(indexCount > 0); | 424 SkASSERT(indexCount > 0); |
| 425 GrAssert(NULL != indices); | 425 SkASSERT(NULL != indices); |
| 426 | 426 |
| 427 this->prepareIndexPool(); | 427 this->prepareIndexPool(); |
| 428 | 428 |
| 429 *indices = fIndexPool->makeSpace(indexCount, | 429 *indices = fIndexPool->makeSpace(indexCount, |
| 430 &geomPoolState.fPoolIndexBuffer, | 430 &geomPoolState.fPoolIndexBuffer, |
| 431 &geomPoolState.fPoolStartIndex); | 431 &geomPoolState.fPoolStartIndex); |
| 432 if (NULL == *indices) { | 432 if (NULL == *indices) { |
| 433 return false; | 433 return false; |
| 434 } | 434 } |
| 435 ++fIndexPoolUseCnt; | 435 ++fIndexPoolUseCnt; |
| 436 return true; | 436 return true; |
| 437 } | 437 } |
| 438 | 438 |
| 439 void GrGpu::releaseReservedVertexSpace() { | 439 void GrGpu::releaseReservedVertexSpace() { |
| 440 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 440 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
| 441 GrAssert(kReserved_GeometrySrcType == geoSrc.fVertexSrc); | 441 SkASSERT(kReserved_GeometrySrcType == geoSrc.fVertexSrc); |
| 442 size_t bytes = geoSrc.fVertexCount * geoSrc.fVertexSize; | 442 size_t bytes = geoSrc.fVertexCount * geoSrc.fVertexSize; |
| 443 fVertexPool->putBack(bytes); | 443 fVertexPool->putBack(bytes); |
| 444 --fVertexPoolUseCnt; | 444 --fVertexPoolUseCnt; |
| 445 } | 445 } |
| 446 | 446 |
| 447 void GrGpu::releaseReservedIndexSpace() { | 447 void GrGpu::releaseReservedIndexSpace() { |
| 448 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 448 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
| 449 GrAssert(kReserved_GeometrySrcType == geoSrc.fIndexSrc); | 449 SkASSERT(kReserved_GeometrySrcType == geoSrc.fIndexSrc); |
| 450 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 450 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
| 451 fIndexPool->putBack(bytes); | 451 fIndexPool->putBack(bytes); |
| 452 --fIndexPoolUseCnt; | 452 --fIndexPoolUseCnt; |
| 453 } | 453 } |
| 454 | 454 |
| 455 void GrGpu::onSetVertexSourceToArray(const void* vertexArray, int vertexCount) { | 455 void GrGpu::onSetVertexSourceToArray(const void* vertexArray, int vertexCount) { |
| 456 this->prepareVertexPool(); | 456 this->prepareVertexPool(); |
| 457 GeometryPoolState& geomPoolState = fGeomPoolStateStack.back(); | 457 GeometryPoolState& geomPoolState = fGeomPoolStateStack.back(); |
| 458 #if GR_DEBUG | 458 #if GR_DEBUG |
| 459 bool success = | 459 bool success = |
| (...skipping 17 matching lines...) Expand all Loading... |
| 477 indexArray, | 477 indexArray, |
| 478 &geomPoolState.fPoolIndexBuffer, | 478 &geomPoolState.fPoolIndexBuffer, |
| 479 &geomPoolState.fPoolStartIndex); | 479 &geomPoolState.fPoolStartIndex); |
| 480 ++fIndexPoolUseCnt; | 480 ++fIndexPoolUseCnt; |
| 481 GR_DEBUGASSERT(success); | 481 GR_DEBUGASSERT(success); |
| 482 } | 482 } |
| 483 | 483 |
| 484 void GrGpu::releaseVertexArray() { | 484 void GrGpu::releaseVertexArray() { |
| 485 // if vertex source was array, we stowed data in the pool | 485 // if vertex source was array, we stowed data in the pool |
| 486 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 486 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
| 487 GrAssert(kArray_GeometrySrcType == geoSrc.fVertexSrc); | 487 SkASSERT(kArray_GeometrySrcType == geoSrc.fVertexSrc); |
| 488 size_t bytes = geoSrc.fVertexCount * geoSrc.fVertexSize; | 488 size_t bytes = geoSrc.fVertexCount * geoSrc.fVertexSize; |
| 489 fVertexPool->putBack(bytes); | 489 fVertexPool->putBack(bytes); |
| 490 --fVertexPoolUseCnt; | 490 --fVertexPoolUseCnt; |
| 491 } | 491 } |
| 492 | 492 |
| 493 void GrGpu::releaseIndexArray() { | 493 void GrGpu::releaseIndexArray() { |
| 494 // if index source was array, we stowed data in the pool | 494 // if index source was array, we stowed data in the pool |
| 495 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 495 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
| 496 GrAssert(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 496 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
| 497 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 497 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
| 498 fIndexPool->putBack(bytes); | 498 fIndexPool->putBack(bytes); |
| 499 --fIndexPoolUseCnt; | 499 --fIndexPoolUseCnt; |
| 500 } | 500 } |
| OLD | NEW |