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

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

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 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 | « src/gpu/GrBatchAtlas.cpp ('k') | src/gpu/GrBatchTarget.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
11 #include "GrBufferAllocPool.h" 11 #include "GrBufferAllocPool.h"
12 #include "batches/GrVertexBatch.h" 12 #include "batches/GrVertexBatch.h"
13 #include "GrContext.h"
13 14
14 class GrResourceProvider; 15 class GrResourceProvider;
15 16
16 /** Simple class that performs the upload on behalf of a GrBatchUploader. */ 17 /** Simple class that performs the upload on behalf of a GrBatchUploader. */
17 class GrBatchUploader::TextureUploader { 18 class GrBatchUploader::TextureUploader {
18 public: 19 public:
19 TextureUploader(GrGpu* gpu) : fGpu(gpu) { SkASSERT(gpu); } 20 TextureUploader(GrGpu* gpu) : fGpu(gpu) { SkASSERT(gpu); }
20 21
21 /** 22 /**
22 * Updates the pixels in a rectangle of a texture. 23 * Updates the pixels in a rectangle of a texture.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 60 }
60 61
61 const GrCaps& caps() const { return *fGpu->caps(); } 62 const GrCaps& caps() const { return *fGpu->caps(); }
62 GrResourceProvider* resourceProvider() const { return fResourceProvider; } 63 GrResourceProvider* resourceProvider() const { return fResourceProvider; }
63 64
64 /** Has the token been flushed to the backend 3D API. */ 65 /** Has the token been flushed to the backend 3D API. */
65 bool hasTokenBeenFlushed(GrBatchToken token) const { return fLastFlushedToke n >= token; } 66 bool hasTokenBeenFlushed(GrBatchToken token) const { return fLastFlushedToke n >= token; }
66 67
67 /** The current token advances once for every contiguous set of uninterrupte d draws prepared 68 /** The current token advances once for every contiguous set of uninterrupte d draws prepared
68 by a batch. */ 69 by a batch. */
69 GrBatchToken currentToken() const { return fCurrentToken; } 70 GrBatchToken currentToken2() const { return fCurrentToken; }
70 71
71 /** The last token flushed to all the way to the backend API. */ 72 /** The last token flushed to all the way to the backend API. */
72 GrBatchToken lastFlushedToken() const { return fLastFlushedToken; } 73 GrBatchToken lastFlushedToken() const { return fLastFlushedToken; }
73 74
74 /** This is a magic token that can be used to indicate that an upload should occur before 75 /** This is a magic token that can be used to indicate that an upload should occur before
75 any draws for any batch in the current flush execute. */ 76 any draws for any batch in the current flush execute. */
76 GrBatchToken asapToken() const { return fLastFlushedToken + 1; } 77 GrBatchToken asapToken() const { return fLastFlushedToken + 1; }
77 78
78 void* makeVertexSpace(size_t vertexSize, int vertexCount, 79 void* makeVertexSpace(size_t vertexSize, int vertexCount,
79 const GrVertexBuffer** buffer, int* startVertex); 80 const GrVertexBuffer** buffer, int* startVertex);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 if (this->asapToken() == upload->lastUploadToken()) { 133 if (this->asapToken() == upload->lastUploadToken()) {
133 fState->addASAPUpload(upload); 134 fState->addASAPUpload(upload);
134 } else { 135 } else {
135 fBatch->fInlineUploads.push_back().reset(SkRef(upload)); 136 fBatch->fInlineUploads.push_back().reset(SkRef(upload));
136 } 137 }
137 } 138 }
138 139
139 bool hasTokenBeenFlushed(GrBatchToken token) const { 140 bool hasTokenBeenFlushed(GrBatchToken token) const {
140 return fState->hasTokenBeenFlushed(token); 141 return fState->hasTokenBeenFlushed(token);
141 } 142 }
142 GrBatchToken currentToken() const { return fState->currentToken(); } 143 GrBatchToken currentToken1() const { return fState->currentToken2(); }
143 GrBatchToken asapToken() const { return fState->asapToken(); } 144 GrBatchToken asapToken() const { return fState->asapToken(); }
144 145
145 const GrCaps& caps() const { return fState->caps(); } 146 const GrCaps& caps() const { return fState->caps(); }
146 147
147 GrResourceProvider* resourceProvider() const { return fState->resourceProvid er(); } 148 GrResourceProvider* resourceProvider() const { return fState->resourceProvid er(); }
148 149
149 protected: 150 protected:
150 GrDrawBatch* batch() { return fBatch; } 151 GrDrawBatch* batch() { return fBatch; }
151 GrBatchFlushState* state() { return fState; } 152 GrBatchFlushState* state() { return fState; }
152 153
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 void putBackVertices(int vertices, size_t vertexStride) { 186 void putBackVertices(int vertices, size_t vertexStride) {
186 this->state()->putBackVertexSpace(vertices * vertexStride); 187 this->state()->putBackVertexSpace(vertices * vertexStride);
187 } 188 }
188 189
189 private: 190 private:
190 GrVertexBatch* vertexBatch() { return static_cast<GrVertexBatch*>(this->batc h()); } 191 GrVertexBatch* vertexBatch() { return static_cast<GrVertexBatch*>(this->batc h()); }
191 typedef GrDrawBatch::Target INHERITED; 192 typedef GrDrawBatch::Target INHERITED;
192 }; 193 };
193 194
194 #endif 195 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrBatchAtlas.cpp ('k') | src/gpu/GrBatchTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698