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

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

Issue 2248283007: Delay creation of cpu-side buffer memory until actually needed (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 VALIDATE(); 71 VALIDATE();
72 this->deleteBlocks(); 72 this->deleteBlocks();
73 sk_free(fCpuData); 73 sk_free(fCpuData);
74 fGpu->unref(); 74 fGpu->unref();
75 } 75 }
76 76
77 void GrBufferAllocPool::reset() { 77 void GrBufferAllocPool::reset() {
78 VALIDATE(); 78 VALIDATE();
79 fBytesInUse = 0; 79 fBytesInUse = 0;
80 this->deleteBlocks(); 80 this->deleteBlocks();
81 81 this->resetCpuData(0); // delete all the cpu-side memory
82 // we may have created a large cpu mirror of a large VB. Reset the size to m atch our minimum.
83 this->resetCpuData(fMinBlockSize);
84
85 VALIDATE(); 82 VALIDATE();
86 } 83 }
87 84
88 void GrBufferAllocPool::unmap() { 85 void GrBufferAllocPool::unmap() {
89 VALIDATE(); 86 VALIDATE();
90 87
91 if (fBufferPtr) { 88 if (fBufferPtr) {
92 BufferBlock& block = fBlocks.back(); 89 BufferBlock& block = fBlocks.back();
93 if (block.fBuffer->isMapped()) { 90 if (block.fBuffer->isMapped()) {
94 UNMAP_BUFFER(block); 91 UNMAP_BUFFER(block);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 size_t offset = 0; // assign to suppress warning 362 size_t offset = 0; // assign to suppress warning
366 void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t), 363 void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t),
367 sizeof(uint16_t), 364 sizeof(uint16_t),
368 buffer, 365 buffer,
369 &offset); 366 &offset);
370 367
371 SkASSERT(0 == offset % sizeof(uint16_t)); 368 SkASSERT(0 == offset % sizeof(uint16_t));
372 *startIndex = static_cast<int>(offset / sizeof(uint16_t)); 369 *startIndex = static_cast<int>(offset / sizeof(uint16_t));
373 return ptr; 370 return ptr;
374 } 371 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698