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

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

Issue 1129863008: Revert of Refactor GrBufferAllocPools to use resource cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/GrTextureProvider.h ('k') | src/gpu/GrBatchTarget.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 2015 Google Inc. 2 * Copyright 2015 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 GrBatchBuffer_DEFINED 8 #ifndef GrBatchBuffer_DEFINED
9 #define GrBatchBuffer_DEFINED 9 #define GrBatchBuffer_DEFINED
10 10
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 const GrDrawTargetCaps& caps() const { return *fGpu->caps(); } 113 const GrDrawTargetCaps& caps() const { return *fGpu->caps(); }
114 114
115 GrResourceProvider* resourceProvider() const { return fGpu->getContext()->re sourceProvider(); } 115 GrResourceProvider* resourceProvider() const { return fGpu->getContext()->re sourceProvider(); }
116 116
117 void* makeVertSpace(size_t vertexSize, int vertexCount, 117 void* makeVertSpace(size_t vertexSize, int vertexCount,
118 const GrVertexBuffer** buffer, int* startVertex); 118 const GrVertexBuffer** buffer, int* startVertex);
119 uint16_t* makeIndexSpace(int indexCount, 119 uint16_t* makeIndexSpace(int indexCount,
120 const GrIndexBuffer** buffer, int* startIndex); 120 const GrIndexBuffer** buffer, int* startIndex);
121 121
122 // A helper for draws which overallocate and then return data to the pool 122 // A helper for draws which overallocate and then return data to the pool
123 void putBackIndices(size_t indices) { fIndexPool.putBack(indices * sizeof(ui nt16_t)); } 123 void putBackIndices(size_t indices) { fIndexPool->putBack(indices * sizeof(u int16_t)); }
124 124
125 void putBackVertices(size_t vertices, size_t vertexStride) { 125 void putBackVertices(size_t vertices, size_t vertexStride) {
126 fVertexPool.putBack(vertices * vertexStride); 126 fVertexPool->putBack(vertices * vertexStride);
127 } 127 }
128 128
129 void reset() { 129 void reset() {
130 fVertexPool.reset(); 130 fVertexPool->reset();
131 fIndexPool.reset(); 131 fIndexPool->reset();
132 } 132 }
133 133
134 private: 134 private:
135 void unmapVertexAndIndexBuffers() { 135 void unmapVertexAndIndexBuffers() {
136 fVertexPool.unmap(); 136 fVertexPool->unmap();
137 fIndexPool.unmap(); 137 fIndexPool->unmap();
138 } 138 }
139 139
140 GrGpu* fGpu; 140 GrGpu* fGpu;
141 GrVertexBufferAllocPool fVertexPool; 141 SkAutoTDelete<GrVertexBufferAllocPool> fVertexPool;
142 GrIndexBufferAllocPool fIndexPool; 142 SkAutoTDelete<GrIndexBufferAllocPool> fIndexPool;
143 143
144 typedef void* TBufferAlign; // This wouldn't be enough align if a command us ed long double. 144 typedef void* TBufferAlign; // This wouldn't be enough align if a command us ed long double.
145 145
146 struct BufferedFlush { 146 struct BufferedFlush {
147 BufferedFlush(const GrPrimitiveProcessor* primProc, const GrPipeline* pi peline) 147 BufferedFlush(const GrPrimitiveProcessor* primProc, const GrPipeline* pi peline)
148 : fPrimitiveProcessor(primProc) 148 : fPrimitiveProcessor(primProc)
149 , fPipeline(pipeline) {} 149 , fPipeline(pipeline) {}
150 typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimi tiveProcessor; 150 typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimi tiveProcessor;
151 ProgramPrimitiveProcessor fPrimitiveProcessor; 151 ProgramPrimitiveProcessor fPrimitiveProcessor;
152 const GrPipeline* fPipeline; 152 const GrPipeline* fPipeline;
(...skipping 12 matching lines...) Expand all
165 FlushBuffer::Iter fIter; 165 FlushBuffer::Iter fIter;
166 int fNumberOfDraws; 166 int fNumberOfDraws;
167 BatchToken fCurrentToken; 167 BatchToken fCurrentToken;
168 BatchToken fLastFlushedToken; // The next token to be flushed 168 BatchToken fLastFlushedToken; // The next token to be flushed
169 SkTArray<SkAutoTUnref<Uploader>, true> fAsapUploads; 169 SkTArray<SkAutoTUnref<Uploader>, true> fAsapUploads;
170 SkTArray<SkAutoTUnref<Uploader>, true> fInlineUploads; 170 SkTArray<SkAutoTUnref<Uploader>, true> fInlineUploads;
171 int fInlineUpdatesIndex; 171 int fInlineUpdatesIndex;
172 }; 172 };
173 173
174 #endif 174 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrTextureProvider.h ('k') | src/gpu/GrBatchTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698