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

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

Issue 1386463004: Incrementally flush GrDrawTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixed Created 5 years, 2 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 | src/gpu/GrDrawTarget.h » ('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 28 matching lines...) Expand all
39 39
40 private: 40 private:
41 GrGpu* fGpu; 41 GrGpu* fGpu;
42 }; 42 };
43 43
44 /** Tracks the state across all the GrBatches in a GrDrawTarget flush. */ 44 /** Tracks the state across all the GrBatches in a GrDrawTarget flush. */
45 class GrBatchFlushState { 45 class GrBatchFlushState {
46 public: 46 public:
47 GrBatchFlushState(GrGpu*, GrResourceProvider*, GrBatchToken lastFlushedToken ); 47 GrBatchFlushState(GrGpu*, GrResourceProvider*, GrBatchToken lastFlushedToken );
48 48
49 ~GrBatchFlushState() { SkASSERT(fLastFlushedToken == fCurrentToken); } 49 ~GrBatchFlushState() { this->reset(); }
50 50
51 void advanceToken() { ++fCurrentToken; } 51 void advanceToken() { ++fCurrentToken; }
52 52
53 void advanceLastFlushedToken() { ++fLastFlushedToken; } 53 void advanceLastFlushedToken() { ++fLastFlushedToken; }
54 54
55 /** Inserts an upload to be executred after all batches in the flush prepare d their draws 55 /** Inserts an upload to be executred after all batches in the flush prepare d their draws
56 but before the draws are executed to the backend 3D API. */ 56 but before the draws are executed to the backend 3D API. */
57 void addASAPUpload(GrBatchUploader* upload) { 57 void addASAPUpload(GrBatchUploader* upload) {
58 fAsapUploads.push_back().reset(SkRef(upload)); 58 fAsapUploads.push_back().reset(SkRef(upload));
59 } 59 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 void putBackIndices(size_t indices) { fIndexPool.putBack(indices * sizeof(ui nt16_t)); } 94 void putBackIndices(size_t indices) { fIndexPool.putBack(indices * sizeof(ui nt16_t)); }
95 95
96 void putBackVertexSpace(size_t sizeInBytes) { fVertexPool.putBack(sizeInByte s); } 96 void putBackVertexSpace(size_t sizeInBytes) { fVertexPool.putBack(sizeInByte s); }
97 97
98 GrBatchUploader::TextureUploader* uploader() { return &fUploader; } 98 GrBatchUploader::TextureUploader* uploader() { return &fUploader; }
99 99
100 GrGpu* gpu() { return fGpu; } 100 GrGpu* gpu() { return fGpu; }
101 101
102 void reset() {
103 fVertexPool.reset();
104 fIndexPool.reset();
105 }
106
102 private: 107 private:
103 GrGpu* fGpu; 108 GrGpu* fGpu;
104 GrBatchUploader::TextureUploader fUploader; 109 GrBatchUploader::TextureUploader fUploader;
105 110
106 GrResourceProvider* fResourceProvider; 111 GrResourceProvider* fResourceProvider;
107 112
108 GrVertexBufferAllocPool fVertexPool; 113 GrVertexBufferAllocPool fVertexPool;
109 GrIndexBufferAllocPool fIndexPool; 114 GrIndexBufferAllocPool fIndexPool;
110 115
111 SkTArray<SkAutoTUnref<GrBatchUploader>, true> fAsapUploads; 116 SkTArray<SkAutoTUnref<GrBatchUploader>, true> fAsapUploads;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 void putBackVertices(int vertices, size_t vertexStride) { 185 void putBackVertices(int vertices, size_t vertexStride) {
181 this->state()->putBackVertexSpace(vertices * vertexStride); 186 this->state()->putBackVertexSpace(vertices * vertexStride);
182 } 187 }
183 188
184 private: 189 private:
185 GrVertexBatch* vertexBatch() { return static_cast<GrVertexBatch*>(this->batc h()); } 190 GrVertexBatch* vertexBatch() { return static_cast<GrVertexBatch*>(this->batc h()); }
186 typedef GrDrawBatch::Target INHERITED; 191 typedef GrDrawBatch::Target INHERITED;
187 }; 192 };
188 193
189 #endif 194 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698