Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/gpu/GrBufferAllocPool.cpp

Issue 1261643004: Some cleanup in GrTextureProvider and GrResourceProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@pathargs
Patch Set: fix Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 295 }
296 } 296 }
297 buffer->updateData(fBufferPtr, flushSize); 297 buffer->updateData(fBufferPtr, flushSize);
298 VALIDATE(true); 298 VALIDATE(true);
299 } 299 }
300 300
301 GrGeometryBuffer* GrBufferAllocPool::getBuffer(size_t size) { 301 GrGeometryBuffer* GrBufferAllocPool::getBuffer(size_t size) {
302 302
303 GrResourceProvider* rp = fGpu->getContext()->resourceProvider(); 303 GrResourceProvider* rp = fGpu->getContext()->resourceProvider();
304 304
305 static const GrResourceProvider::BufferUsage kUsage = GrResourceProvider::kD ynamic_BufferUsage;
306 // Shouldn't have to use this flag (http://skbug.com/4156)
307 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag;
305 if (kIndex_BufferType == fBufferType) { 308 if (kIndex_BufferType == fBufferType) {
306 return rp->getIndexBuffer(size, /* dynamic = */ true, /* duringFlush = * / true); 309 return rp->createIndexBuffer(size, kUsage, kFlags);
307 } else { 310 } else {
308 SkASSERT(kVertex_BufferType == fBufferType); 311 SkASSERT(kVertex_BufferType == fBufferType);
309 return rp->getVertexBuffer(size, /* dynamic = */ true, /* duringFlush = */ true); 312 return rp->createVertexBuffer(size, kUsage, kFlags);
310 } 313 }
311 } 314 }
312 315
313 //////////////////////////////////////////////////////////////////////////////// 316 ////////////////////////////////////////////////////////////////////////////////
314 317
315 GrVertexBufferAllocPool::GrVertexBufferAllocPool(GrGpu* gpu) 318 GrVertexBufferAllocPool::GrVertexBufferAllocPool(GrGpu* gpu)
316 : GrBufferAllocPool(gpu, kVertex_BufferType, MIN_VERTEX_BUFFER_SIZE) { 319 : GrBufferAllocPool(gpu, kVertex_BufferType, MIN_VERTEX_BUFFER_SIZE) {
317 } 320 }
318 321
319 void* GrVertexBufferAllocPool::makeSpace(size_t vertexSize, 322 void* GrVertexBufferAllocPool::makeSpace(size_t vertexSize,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 &geomBuffer, 362 &geomBuffer,
360 &offset); 363 &offset);
361 364
362 *buffer = (const GrIndexBuffer*) geomBuffer; 365 *buffer = (const GrIndexBuffer*) geomBuffer;
363 SkASSERT(0 == offset % sizeof(uint16_t)); 366 SkASSERT(0 == offset % sizeof(uint16_t));
364 *startIndex = static_cast<int>(offset / sizeof(uint16_t)); 367 *startIndex = static_cast<int>(offset / sizeof(uint16_t));
365 return ptr; 368 return ptr;
366 } 369 }
367 370
368 371
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698