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

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

Issue 1300123002: Use calloc to allocate data that will be uploaded to vertex/index buffers in Chrome (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment 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
« no previous file with comments | « include/gpu/GrCaps.h ('k') | src/gpu/GrBufferAllocPool.cpp » ('j') | 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 #ifndef GrBufferAllocPool_DEFINED 8 #ifndef GrBufferAllocPool_DEFINED
9 #define GrBufferAllocPool_DEFINED 9 #define GrBufferAllocPool_DEFINED
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 private: 100 private:
101 struct BufferBlock { 101 struct BufferBlock {
102 size_t fBytesFree; 102 size_t fBytesFree;
103 GrGeometryBuffer* fBuffer; 103 GrGeometryBuffer* fBuffer;
104 }; 104 };
105 105
106 bool createBlock(size_t requestSize); 106 bool createBlock(size_t requestSize);
107 void destroyBlock(); 107 void destroyBlock();
108 void deleteBlocks(); 108 void deleteBlocks();
109 void flushCpuData(const BufferBlock& block, size_t flushSize); 109 void flushCpuData(const BufferBlock& block, size_t flushSize);
110 void* resetCpuData(size_t newSize);
110 #ifdef SK_DEBUG 111 #ifdef SK_DEBUG
111 void validate(bool unusedBlockAllowed = false) const; 112 void validate(bool unusedBlockAllowed = false) const;
112 #endif 113 #endif
113
114 size_t fBytesInUse; 114 size_t fBytesInUse;
115 115
116 GrGpu* fGpu; 116 GrGpu* fGpu;
117 size_t fMinBlockSize; 117 size_t fMinBlockSize;
118 BufferType fBufferType; 118 BufferType fBufferType;
119 119
120 SkTArray<BufferBlock> fBlocks; 120 SkTArray<BufferBlock> fBlocks;
121 SkAutoMalloc fCpuData; 121 void* fCpuData;
122 void* fBufferPtr; 122 void* fBufferPtr;
123 size_t fGeometryBufferMapThreshold; 123 size_t fGeometryBufferMapThreshold;
124 }; 124 };
125 125
126 class GrVertexBuffer; 126 class GrVertexBuffer;
127 127
128 /** 128 /**
129 * A GrBufferAllocPool of vertex buffers 129 * A GrBufferAllocPool of vertex buffers
130 */ 130 */
131 class GrVertexBufferAllocPool : public GrBufferAllocPool { 131 class GrVertexBufferAllocPool : public GrBufferAllocPool {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 */ 201 */
202 void* makeSpace(int indexCount, 202 void* makeSpace(int indexCount,
203 const GrIndexBuffer** buffer, 203 const GrIndexBuffer** buffer,
204 int* startIndex); 204 int* startIndex);
205 205
206 private: 206 private:
207 typedef GrBufferAllocPool INHERITED; 207 typedef GrBufferAllocPool INHERITED;
208 }; 208 };
209 209
210 #endif 210 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrCaps.h ('k') | src/gpu/GrBufferAllocPool.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698