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

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

Issue 1292623004: Remove Cmd in GrTargetCommands that is no longer needed with GrCopySurfaceBatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | src/gpu/GrTargetCommands.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 GrTargetCommands_DEFINED 8 #ifndef GrTargetCommands_DEFINED
9 #define GrTargetCommands_DEFINED 9 #define GrTargetCommands_DEFINED
10 10
(...skipping 13 matching lines...) Expand all
24 24
25 // TODO: Convert all commands into GrBatch and remove this class. 25 // TODO: Convert all commands into GrBatch and remove this class.
26 class GrTargetCommands : ::SkNoncopyable { 26 class GrTargetCommands : ::SkNoncopyable {
27 public: 27 public:
28 GrTargetCommands() : fCmdBuffer(kCmdBufferInitialSizeInBytes), fLastFlushTok en(0) {} 28 GrTargetCommands() : fCmdBuffer(kCmdBufferInitialSizeInBytes), fLastFlushTok en(0) {}
29 29
30 class Cmd : ::SkNoncopyable { 30 class Cmd : ::SkNoncopyable {
31 public: 31 public:
32 enum CmdType { 32 enum CmdType {
33 kStencilPath_CmdType = 1, 33 kStencilPath_CmdType = 1,
34 kCopySurface_CmdType = 2, 34 kDrawPath_CmdType = 2,
35 kDrawPath_CmdType = 3, 35 kDrawPaths_CmdType = 3,
36 kDrawPaths_CmdType = 4, 36 kDrawBatch_CmdType = 4,
37 kDrawBatch_CmdType = 5,
38 }; 37 };
39 38
40 Cmd(CmdType type) 39 Cmd(CmdType type)
41 : fType(type) 40 : fType(type)
42 #if GR_BATCH_SPEW 41 #if GR_BATCH_SPEW
43 , fUniqueID(GenID(&gUniqueID)) 42 , fUniqueID(GenID(&gUniqueID))
44 #endif 43 #endif
45 {} 44 {}
46 virtual ~Cmd() {} 45 virtual ~Cmd() {}
47 46
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 GrDrawTarget::PathIndexType fIndexType; 168 GrDrawTarget::PathIndexType fIndexType;
170 float* fTransforms; 169 float* fTransforms;
171 GrDrawTarget::PathTransformType fTransformType; 170 GrDrawTarget::PathTransformType fTransformType;
172 int fCount; 171 int fCount;
173 GrStencilSettings fStencilSettings; 172 GrStencilSettings fStencilSettings;
174 173
175 private: 174 private:
176 GrPendingIOResource<const GrPathRange, kRead_GrIOType> fPathRange; 175 GrPendingIOResource<const GrPathRange, kRead_GrIOType> fPathRange;
177 }; 176 };
178 177
179 struct CopySurface : public Cmd {
180 CopySurface(GrSurface* dst, GrSurface* src)
181 : Cmd(kCopySurface_CmdType)
182 , fDst(dst)
183 , fSrc(src) {
184 }
185
186 GrSurface* dst() const { return fDst.get(); }
187 GrSurface* src() const { return fSrc.get(); }
188
189 void execute(GrBatchFlushState*) override;
190
191 SkIPoint fDstPoint;
192 SkIRect fSrcRect;
193
194 private:
195 GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst;
196 GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc;
197 };
198
199 struct DrawBatch : public Cmd { 178 struct DrawBatch : public Cmd {
200 DrawBatch(GrBatch* batch) 179 DrawBatch(GrBatch* batch)
201 : Cmd(kDrawBatch_CmdType) 180 : Cmd(kDrawBatch_CmdType)
202 , fBatch(SkRef(batch)){ 181 , fBatch(SkRef(batch)){
203 SkASSERT(!batch->isUsed()); 182 SkASSERT(!batch->isUsed());
204 } 183 }
205 184
206 GrBatch* batch() { return fBatch; } 185 GrBatch* batch() { return fBatch; }
207 void execute(GrBatchFlushState*) override; 186 void execute(GrBatchFlushState*) override;
208 187
209 private: 188 private:
210 SkAutoTUnref<GrBatch> fBatch; 189 SkAutoTUnref<GrBatch> fBatch;
211 }; 190 };
212 191
213 static const int kCmdBufferInitialSizeInBytes = 8 * 1024; 192 static const int kCmdBufferInitialSizeInBytes = 8 * 1024;
214 193
215 typedef void* TCmdAlign; // This wouldn't be enough align if a command used long double. 194 typedef void* TCmdAlign; // This wouldn't be enough align if a command used long double.
216 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; 195 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer;
217 196
218 CmdBuffer* cmdBuffer() { return &fCmdBuffer; } 197 CmdBuffer* cmdBuffer() { return &fCmdBuffer; }
219 198
220 CmdBuffer fCmdBuffer; 199 CmdBuffer fCmdBuffer;
221 GrBatchToken fLastFlushToken; 200 GrBatchToken fLastFlushToken;
222 }; 201 };
223 202
224 #endif 203 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrTargetCommands.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698