OLD | NEW |
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 const GrCaps& caps() const { return *fGpu->caps(); } | 108 const GrCaps& caps() const { return *fGpu->caps(); } |
109 | 109 |
110 GrResourceProvider* resourceProvider() const { return fGpu->getContext()->re
sourceProvider(); } | 110 GrResourceProvider* resourceProvider() const { return fGpu->getContext()->re
sourceProvider(); } |
111 | 111 |
112 void* makeVertSpace(size_t vertexSize, int vertexCount, | 112 void* makeVertSpace(size_t vertexSize, int vertexCount, |
113 const GrVertexBuffer** buffer, int* startVertex); | 113 const GrVertexBuffer** buffer, int* startVertex); |
114 uint16_t* makeIndexSpace(int indexCount, | 114 uint16_t* makeIndexSpace(int indexCount, |
115 const GrIndexBuffer** buffer, int* startIndex); | 115 const GrIndexBuffer** buffer, int* startIndex); |
116 | 116 |
117 // A helper for draws which overallocate and then return data to the pool | 117 // A helper for draws which overallocate and then return data to the pool |
118 void putBackIndices(size_t indices) { fIndexPool.putBack(indices * sizeof(ui
nt16_t)); } | 118 void putBackIndices(size_t indices) { fIndexPool->putBack(indices * sizeof(u
int16_t)); } |
119 | 119 |
120 void putBackVertices(size_t vertices, size_t vertexStride) { | 120 void putBackVertices(size_t vertices, size_t vertexStride) { |
121 fVertexPool.putBack(vertices * vertexStride); | 121 fVertexPool->putBack(vertices * vertexStride); |
122 } | 122 } |
123 | 123 |
124 void reset() { | 124 void reset() { |
125 fVertexPool.reset(); | 125 fVertexPool->reset(); |
126 fIndexPool.reset(); | 126 fIndexPool->reset(); |
127 } | 127 } |
128 | 128 |
129 private: | 129 private: |
130 void unmapVertexAndIndexBuffers() { | 130 void unmapVertexAndIndexBuffers() { |
131 fVertexPool.unmap(); | 131 fVertexPool->unmap(); |
132 fIndexPool.unmap(); | 132 fIndexPool->unmap(); |
133 } | 133 } |
134 | 134 |
135 GrGpu* fGpu; | 135 GrGpu* fGpu; |
136 GrVertexBufferAllocPool fVertexPool; | 136 SkAutoTDelete<GrVertexBufferAllocPool> fVertexPool; |
137 GrIndexBufferAllocPool fIndexPool; | 137 SkAutoTDelete<GrIndexBufferAllocPool> fIndexPool; |
138 | 138 |
139 typedef void* TBufferAlign; // This wouldn't be enough align if a command us
ed long double. | 139 typedef void* TBufferAlign; // This wouldn't be enough align if a command us
ed long double. |
140 | 140 |
141 struct BufferedFlush { | 141 struct BufferedFlush { |
142 BufferedFlush(const GrPrimitiveProcessor* primProc, const GrPipeline* pi
peline) | 142 BufferedFlush(const GrPrimitiveProcessor* primProc, const GrPipeline* pi
peline) |
143 : fPrimitiveProcessor(primProc) | 143 : fPrimitiveProcessor(primProc) |
144 , fPipeline(pipeline) {} | 144 , fPipeline(pipeline) {} |
145 typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimi
tiveProcessor; | 145 typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimi
tiveProcessor; |
146 ProgramPrimitiveProcessor fPrimitiveProcessor; | 146 ProgramPrimitiveProcessor fPrimitiveProcessor; |
147 const GrPipeline* fPipeline; | 147 const GrPipeline* fPipeline; |
(...skipping 12 matching lines...) Expand all Loading... |
160 FlushBuffer::Iter fIter; | 160 FlushBuffer::Iter fIter; |
161 int fNumberOfDraws; | 161 int fNumberOfDraws; |
162 BatchToken fCurrentToken; | 162 BatchToken fCurrentToken; |
163 BatchToken fLastFlushedToken; // The next token to be flushed | 163 BatchToken fLastFlushedToken; // The next token to be flushed |
164 SkTArray<SkAutoTUnref<Uploader>, true> fAsapUploads; | 164 SkTArray<SkAutoTUnref<Uploader>, true> fAsapUploads; |
165 SkTArray<SkAutoTUnref<Uploader>, true> fInlineUploads; | 165 SkTArray<SkAutoTUnref<Uploader>, true> fInlineUploads; |
166 int fInlineUpdatesIndex; | 166 int fInlineUpdatesIndex; |
167 }; | 167 }; |
168 | 168 |
169 #endif | 169 #endif |
OLD | NEW |