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

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

Issue 1276913002: Add Batch logging (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 | « src/gpu/GrReorderCommandBuilder.cpp ('k') | 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 25 matching lines...) Expand all
36 kSetState_CmdType = 2, 36 kSetState_CmdType = 2,
37 kClear_CmdType = 3, 37 kClear_CmdType = 3,
38 kClearStencil_CmdType = 4, 38 kClearStencil_CmdType = 4,
39 kCopySurface_CmdType = 5, 39 kCopySurface_CmdType = 5,
40 kDrawPath_CmdType = 6, 40 kDrawPath_CmdType = 6,
41 kDrawPaths_CmdType = 7, 41 kDrawPaths_CmdType = 7,
42 kDrawBatch_CmdType = 8, 42 kDrawBatch_CmdType = 8,
43 kXferBarrier_CmdType = 9, 43 kXferBarrier_CmdType = 9,
44 }; 44 };
45 45
46 Cmd(CmdType type) : fMarkerID(-1), fType(type) {} 46 Cmd(CmdType type)
47 : fMarkerID(-1)
48 , fType(type)
49 #if GR_BATCH_SPEW
50 , fUniqueID(GenID(&gUniqueID))
51 #endif
52 {}
47 virtual ~Cmd() {} 53 virtual ~Cmd() {}
48 54
49 virtual void execute(GrGpu*) = 0; 55 virtual void execute(GrGpu*) = 0;
50 56
51 CmdType type() const { return fType; } 57 CmdType type() const { return fType; }
52 58
53 // trace markers 59 // trace markers
54 bool isTraced() const { return -1 != fMarkerID; } 60 bool isTraced() const { return -1 != fMarkerID; }
55 void setMarkerID(int markerID) { SkASSERT(-1 == fMarkerID); fMarkerID = markerID; } 61 void setMarkerID(int markerID) { SkASSERT(-1 == fMarkerID); fMarkerID = markerID; }
56 int markerID() const { return fMarkerID; } 62 int markerID() const { return fMarkerID; }
63 GrBATCH_SPEW(uint32_t uniqueID() const { return fUniqueID;} )
57 64
58 private: 65 private:
66 // TODO move this to a common header so it can be shared with GrBatch
67 static uint32_t GenID(int32_t* idCounter) {
68 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(idCounter)) + 1;
69 if (!id) {
70 SkFAIL("This should never wrap\n");
71 }
72 return id;
73 }
59 int fMarkerID; 74 int fMarkerID;
60 CmdType fType; 75 CmdType fType;
76 GrBATCH_SPEW(uint32_t fUniqueID);
77 GrBATCH_SPEW(static int32_t gUniqueID;)
61 }; 78 };
62 79
63 void reset(); 80 void reset();
64 void flush(GrBufferedDrawTarget*); 81 void flush(GrBufferedDrawTarget*);
65 82
66 private: 83 private:
67 friend class GrCommandBuilder; 84 friend class GrCommandBuilder;
68 friend class GrBufferedDrawTarget; // This goes away when State becomes just a pipeline 85 friend class GrBufferedDrawTarget; // This goes away when State becomes just a pipeline
69 friend class GrReorderCommandBuilder; 86 friend class GrReorderCommandBuilder;
70 87
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 279
263 CmdBuffer* cmdBuffer() { return &fCmdBuffer; } 280 CmdBuffer* cmdBuffer() { return &fCmdBuffer; }
264 GrBatchTarget* batchTarget() { return &fBatchTarget; } 281 GrBatchTarget* batchTarget() { return &fBatchTarget; }
265 282
266 CmdBuffer fCmdBuffer; 283 CmdBuffer fCmdBuffer;
267 GrBatchTarget fBatchTarget; 284 GrBatchTarget fBatchTarget;
268 }; 285 };
269 286
270 #endif 287 #endif
271 288
OLDNEW
« no previous file with comments | « src/gpu/GrReorderCommandBuilder.cpp ('k') | src/gpu/GrTargetCommands.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698