Add batch names and bounds to json debug information
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1577093003
Review URL: https://codereview.chromium.org/1577093003
diff --git a/include/private/GrAuditTrail.h b/include/private/GrAuditTrail.h
index bcd85e2..53f44f2 100644
--- a/include/private/GrAuditTrail.h
+++ b/include/private/GrAuditTrail.h
@@ -9,6 +9,7 @@
#define GrAuditTrail_DEFINED
#include "GrConfig.h"
+#include "SkRect.h"
#include "SkString.h"
#include "SkTArray.h"
@@ -18,11 +19,18 @@
*/
class GrAuditTrail {
public:
- void addOp(SkString name) {
+ void addOp(const SkString& name) {
SkASSERT(GR_BATCH_DEBUGGING_OUTPUT);
fOps.push_back().fName = name;
}
+ void addBatch(const SkString& name, const SkRect& bounds) {
+ SkASSERT(GR_BATCH_DEBUGGING_OUTPUT);
+ Op::Batch& batch = fOps.back().fBatches.push_back();
+ batch.fName = name;
+ batch.fBounds = bounds;
+ }
+
SkString toJson() const;
void reset() { SkASSERT(GR_BATCH_DEBUGGING_OUTPUT); fOps.reset(); }
@@ -30,7 +38,14 @@
private:
struct Op {
SkString toJson() const;
+ struct Batch {
+ SkString toJson() const;
+ SkString fName;
+ SkRect fBounds;
+ };
+
SkString fName;
+ SkTArray<Batch> fBatches;
};
SkTArray<Op> fOps;
@@ -41,11 +56,13 @@
invoke(__VA_ARGS__); \
}
-
#define GR_AUDIT_TRAIL_ADDOP(audit_trail, opname) \
GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail->addOp, opname);
#define GR_AUDIT_TRAIL_RESET(audit_trail) \
GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail->reset);
+#define GR_AUDIT_TRAIL_ADDBATCH(audit_trail, batchname, bounds) \
+ GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail->addBatch, SkString(batchname), bounds);
+
#endif