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 "GrBufferAllocPool.h" | 10 #include "GrBufferAllocPool.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 } | 313 } |
314 buffer->updateData(fBufferPtr, flushSize); | 314 buffer->updateData(fBufferPtr, flushSize); |
315 VALIDATE(true); | 315 VALIDATE(true); |
316 } | 316 } |
317 | 317 |
318 GrGeometryBuffer* GrBufferAllocPool::getBuffer(size_t size) { | 318 GrGeometryBuffer* GrBufferAllocPool::getBuffer(size_t size) { |
319 | 319 |
320 GrResourceProvider* rp = fGpu->getContext()->resourceProvider(); | 320 GrResourceProvider* rp = fGpu->getContext()->resourceProvider(); |
321 | 321 |
322 static const GrResourceProvider::BufferUsage kUsage = GrResourceProvider::kD
ynamic_BufferUsage; | 322 static const GrResourceProvider::BufferUsage kUsage = GrResourceProvider::kD
ynamic_BufferUsage; |
323 // Shouldn't have to use this flag (http://skbug.com/4156) | 323 // Shouldn't have to use this flag (https://bug.skia.org/4156) |
324 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag; | 324 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag; |
325 if (kIndex_BufferType == fBufferType) { | 325 if (kIndex_BufferType == fBufferType) { |
326 return rp->createIndexBuffer(size, kUsage, kFlags); | 326 return rp->createIndexBuffer(size, kUsage, kFlags); |
327 } else { | 327 } else { |
328 SkASSERT(kVertex_BufferType == fBufferType); | 328 SkASSERT(kVertex_BufferType == fBufferType); |
329 return rp->createVertexBuffer(size, kUsage, kFlags); | 329 return rp->createVertexBuffer(size, kUsage, kFlags); |
330 } | 330 } |
331 } | 331 } |
332 | 332 |
333 //////////////////////////////////////////////////////////////////////////////// | 333 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t), | 377 void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t), |
378 sizeof(uint16_t), | 378 sizeof(uint16_t), |
379 &geomBuffer, | 379 &geomBuffer, |
380 &offset); | 380 &offset); |
381 | 381 |
382 *buffer = (const GrIndexBuffer*) geomBuffer; | 382 *buffer = (const GrIndexBuffer*) geomBuffer; |
383 SkASSERT(0 == offset % sizeof(uint16_t)); | 383 SkASSERT(0 == offset % sizeof(uint16_t)); |
384 *startIndex = static_cast<int>(offset / sizeof(uint16_t)); | 384 *startIndex = static_cast<int>(offset / sizeof(uint16_t)); |
385 return ptr; | 385 return ptr; |
386 } | 386 } |
OLD | NEW |