OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "GrBufferAllocPool.h" | 9 #include "GrBufferAllocPool.h" |
10 #include "GrBuffer.h" | 10 #include "GrBuffer.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 buffer->updateData(fBufferPtr, flushSize); | 312 buffer->updateData(fBufferPtr, flushSize); |
313 VALIDATE(true); | 313 VALIDATE(true); |
314 } | 314 } |
315 | 315 |
316 GrBuffer* GrBufferAllocPool::getBuffer(size_t size) { | 316 GrBuffer* GrBufferAllocPool::getBuffer(size_t size) { |
317 | 317 |
318 GrResourceProvider* rp = fGpu->getContext()->resourceProvider(); | 318 GrResourceProvider* rp = fGpu->getContext()->resourceProvider(); |
319 | 319 |
320 // Shouldn't have to use this flag (https://bug.skia.org/4156) | 320 // Shouldn't have to use this flag (https://bug.skia.org/4156) |
321 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag; | 321 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag; |
322 return rp->createBuffer(fBufferType, size, kDynamic_GrAccessPattern, kFlags)
; | 322 return rp->createBuffer(size, fBufferType, kDynamic_GrAccessPattern, kFlags)
; |
323 } | 323 } |
324 | 324 |
325 //////////////////////////////////////////////////////////////////////////////// | 325 //////////////////////////////////////////////////////////////////////////////// |
326 | 326 |
327 GrVertexBufferAllocPool::GrVertexBufferAllocPool(GrGpu* gpu) | 327 GrVertexBufferAllocPool::GrVertexBufferAllocPool(GrGpu* gpu) |
328 : GrBufferAllocPool(gpu, kVertex_GrBufferType, MIN_VERTEX_BUFFER_SIZE) { | 328 : GrBufferAllocPool(gpu, kVertex_GrBufferType, MIN_VERTEX_BUFFER_SIZE) { |
329 } | 329 } |
330 | 330 |
331 void* GrVertexBufferAllocPool::makeSpace(size_t vertexSize, | 331 void* GrVertexBufferAllocPool::makeSpace(size_t vertexSize, |
332 int vertexCount, | 332 int vertexCount, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 size_t offset = 0; // assign to suppress warning | 365 size_t offset = 0; // assign to suppress warning |
366 void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t), | 366 void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t), |
367 sizeof(uint16_t), | 367 sizeof(uint16_t), |
368 buffer, | 368 buffer, |
369 &offset); | 369 &offset); |
370 | 370 |
371 SkASSERT(0 == offset % sizeof(uint16_t)); | 371 SkASSERT(0 == offset % sizeof(uint16_t)); |
372 *startIndex = static_cast<int>(offset / sizeof(uint16_t)); | 372 *startIndex = static_cast<int>(offset / sizeof(uint16_t)); |
373 return ptr; | 373 return ptr; |
374 } | 374 } |
OLD | NEW |