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

Side by Side Diff: include/private/GrAuditTrail.h

Issue 1577093003: Add batch names and bounds to json debug information (Closed) Base URL: https://skia.googlesource.com/skia.git@audittrail-wireupcontext
Patch Set: rebase Created 4 years, 11 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/GrAuditTrail.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 2016 Google Inc. 2 * Copyright 2016 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 GrAuditTrail_DEFINED 8 #ifndef GrAuditTrail_DEFINED
9 #define GrAuditTrail_DEFINED 9 #define GrAuditTrail_DEFINED
10 10
11 #include "GrConfig.h" 11 #include "GrConfig.h"
12 #include "SkRect.h"
12 #include "SkString.h" 13 #include "SkString.h"
13 #include "SkTArray.h" 14 #include "SkTArray.h"
14 15
15 /* 16 /*
16 * GrAuditTrail collects a list of draw ops, detailed information about those op s, and can dump them 17 * GrAuditTrail collects a list of draw ops, detailed information about those op s, and can dump them
17 * to json. 18 * to json.
18 */ 19 */
19 class GrAuditTrail { 20 class GrAuditTrail {
20 public: 21 public:
21 void addOp(SkString name) { 22 void addOp(const SkString& name) {
22 SkASSERT(GR_BATCH_DEBUGGING_OUTPUT); 23 SkASSERT(GR_BATCH_DEBUGGING_OUTPUT);
23 fOps.push_back().fName = name; 24 fOps.push_back().fName = name;
24 } 25 }
25 26
27 void addBatch(const SkString& name, const SkRect& bounds) {
28 SkASSERT(GR_BATCH_DEBUGGING_OUTPUT);
29 Op::Batch& batch = fOps.back().fBatches.push_back();
30 batch.fName = name;
31 batch.fBounds = bounds;
32 }
33
26 SkString toJson() const; 34 SkString toJson() const;
27 35
28 void reset() { SkASSERT(GR_BATCH_DEBUGGING_OUTPUT); fOps.reset(); } 36 void reset() { SkASSERT(GR_BATCH_DEBUGGING_OUTPUT); fOps.reset(); }
29 37
30 private: 38 private:
31 struct Op { 39 struct Op {
32 SkString toJson() const; 40 SkString toJson() const;
41 struct Batch {
42 SkString toJson() const;
43 SkString fName;
44 SkRect fBounds;
45 };
46
33 SkString fName; 47 SkString fName;
48 SkTArray<Batch> fBatches;
34 }; 49 };
35 50
36 SkTArray<Op> fOps; 51 SkTArray<Op> fOps;
37 }; 52 };
38 53
39 #define GR_AUDIT_TRAIL_INVOKE_GUARD(invoke, ...) \ 54 #define GR_AUDIT_TRAIL_INVOKE_GUARD(invoke, ...) \
40 if (GR_BATCH_DEBUGGING_OUTPUT) { \ 55 if (GR_BATCH_DEBUGGING_OUTPUT) { \
41 invoke(__VA_ARGS__); \ 56 invoke(__VA_ARGS__); \
42 } 57 }
43 58
44
45 #define GR_AUDIT_TRAIL_ADDOP(audit_trail, opname) \ 59 #define GR_AUDIT_TRAIL_ADDOP(audit_trail, opname) \
46 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail->addOp, opname); 60 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail->addOp, opname);
47 61
48 #define GR_AUDIT_TRAIL_RESET(audit_trail) \ 62 #define GR_AUDIT_TRAIL_RESET(audit_trail) \
49 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail->reset); 63 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail->reset);
50 64
65 #define GR_AUDIT_TRAIL_ADDBATCH(audit_trail, batchname, bounds) \
66 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail->addBatch, SkString(batchname), boun ds);
67
51 #endif 68 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrAuditTrail.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698