Index: src/gpu/GrTargetCommands.h |
diff --git a/src/gpu/GrTargetCommands.h b/src/gpu/GrTargetCommands.h |
index 55c1dfc552370870fb75f4d04b0a032d49d1d146..7745018484b88ca1dc229289cd6a9e4e973d0fa6 100644 |
--- a/src/gpu/GrTargetCommands.h |
+++ b/src/gpu/GrTargetCommands.h |
@@ -43,7 +43,13 @@ public: |
kXferBarrier_CmdType = 9, |
}; |
- Cmd(CmdType type) : fMarkerID(-1), fType(type) {} |
+ Cmd(CmdType type) |
+ : fMarkerID(-1) |
+ , fType(type) |
+#if GR_BATCH_SPEW |
+ , fUniqueID(GenID(&gUniqueID)) |
+#endif |
+{} |
virtual ~Cmd() {} |
virtual void execute(GrGpu*) = 0; |
@@ -54,10 +60,21 @@ public: |
bool isTraced() const { return -1 != fMarkerID; } |
void setMarkerID(int markerID) { SkASSERT(-1 == fMarkerID); fMarkerID = markerID; } |
int markerID() const { return fMarkerID; } |
+ GrBATCH_SPEW(uint32_t uniqueID() const { return fUniqueID;} ) |
private: |
+ // TODO move this to a common header so it can be shared with GrBatch |
+ static uint32_t GenID(int32_t* idCounter) { |
+ uint32_t id = static_cast<uint32_t>(sk_atomic_inc(idCounter)) + 1; |
+ if (!id) { |
+ SkFAIL("This should never wrap\n"); |
+ } |
+ return id; |
+ } |
int fMarkerID; |
CmdType fType; |
+ GrBATCH_SPEW(uint32_t fUniqueID); |
+ GrBATCH_SPEW(static int32_t gUniqueID;) |
}; |
void reset(); |