| OLD | NEW |
| 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 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 private: | 77 private: |
| 78 AutoEnable fAutoEnable; | 78 AutoEnable fAutoEnable; |
| 79 GrAuditTrail* fAuditTrail; | 79 GrAuditTrail* fAuditTrail; |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 void pushFrame(const char* framename) { | 82 void pushFrame(const char* framename) { |
| 83 SkASSERT(fEnabled); | 83 SkASSERT(fEnabled); |
| 84 fCurrentStackTrace.push_back(SkString(framename)); | 84 fCurrentStackTrace.push_back(SkString(framename)); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void addBatch(const char* name, const SkRect& bounds); | 87 void addBatch(const GrBatch* batch); |
| 88 | 88 |
| 89 void batchingResultCombined(GrBatch* combiner); | 89 void batchingResultCombined(const GrBatch* consumer, const GrBatch* consumed
); |
| 90 | |
| 91 void batchingResultNew(GrBatch* batch); | |
| 92 | 90 |
| 93 // Because batching is heavily dependent on sequence of draw calls, these ca
lls will only | 91 // Because batching is heavily dependent on sequence of draw calls, these ca
lls will only |
| 94 // produce valid information for the given draw sequence which preceeded the
m. | 92 // produce valid information for the given draw sequence which preceeded the
m. |
| 95 // Specifically, future draw calls may change the batching and thus would in
validate | 93 // Specifically, future draw calls may change the batching and thus would in
validate |
| 96 // the json. What this means is that for some sequence of draw calls N, the
below toJson | 94 // the json. What this means is that for some sequence of draw calls N, the
below toJson |
| 97 // calls will only produce JSON which reflects N draw calls. This JSON may
or may not be | 95 // calls will only produce JSON which reflects N draw calls. This JSON may
or may not be |
| 98 // accurate for N + 1 or N - 1 draws depending on the actual batching algori
thm used. | 96 // accurate for N + 1 or N - 1 draws depending on the actual batching algori
thm used. |
| 99 SkString toJson(bool prettyPrint = false) const; | 97 SkString toJson(bool prettyPrint = false) const; |
| 100 | 98 |
| 101 // returns a json string of all of the batches associated with a given clien
t id | 99 // returns a json string of all of the batches associated with a given clien
t id |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 Batches fChildren; | 144 Batches fChildren; |
| 147 uint32_t fRenderTargetUniqueID; | 145 uint32_t fRenderTargetUniqueID; |
| 148 }; | 146 }; |
| 149 typedef SkTArray<SkAutoTDelete<BatchNode>, true> BatchList; | 147 typedef SkTArray<SkAutoTDelete<BatchNode>, true> BatchList; |
| 150 | 148 |
| 151 void copyOutFromBatchList(BatchInfo* outBatchInfo, int batchListID); | 149 void copyOutFromBatchList(BatchInfo* outBatchInfo, int batchListID); |
| 152 | 150 |
| 153 template <typename T> | 151 template <typename T> |
| 154 static void JsonifyTArray(SkString* json, const char* name, const T& array, | 152 static void JsonifyTArray(SkString* json, const char* name, const T& array, |
| 155 bool addComma); | 153 bool addComma); |
| 156 | 154 |
| 157 Batch* fCurrentBatch; | |
| 158 BatchPool fBatchPool; | 155 BatchPool fBatchPool; |
| 159 SkTHashMap<GrBatch*, int> fIDLookup; | 156 SkTHashMap<uint32_t, int> fIDLookup; |
| 160 SkTHashMap<int, Batches*> fClientIDLookup; | 157 SkTHashMap<int, Batches*> fClientIDLookup; |
| 161 BatchList fBatchList; | 158 BatchList fBatchList; |
| 162 SkTArray<SkString> fCurrentStackTrace; | 159 SkTArray<SkString> fCurrentStackTrace; |
| 163 | 160 |
| 164 // The client cas pass in an optional client ID which we will use to mark th
e batches | 161 // The client cas pass in an optional client ID which we will use to mark th
e batches |
| 165 int fClientID; | 162 int fClientID; |
| 166 bool fEnabled; | 163 bool fEnabled; |
| 167 }; | 164 }; |
| 168 | 165 |
| 169 #define GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, invoke, ...) \ | 166 #define GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, invoke, ...) \ |
| 170 if (audit_trail->isEnabled()) { \ | 167 if (audit_trail->isEnabled()) { \ |
| 171 audit_trail->invoke(__VA_ARGS__); \ | 168 audit_trail->invoke(__VA_ARGS__); \ |
| 172 } | 169 } |
| 173 | 170 |
| 174 #define GR_AUDIT_TRAIL_AUTO_FRAME(audit_trail, framename) \ | 171 #define GR_AUDIT_TRAIL_AUTO_FRAME(audit_trail, framename) \ |
| 175 GR_AUDIT_TRAIL_INVOKE_GUARD((audit_trail), pushFrame, framename); | 172 GR_AUDIT_TRAIL_INVOKE_GUARD((audit_trail), pushFrame, framename); |
| 176 | 173 |
| 177 #define GR_AUDIT_TRAIL_RESET(audit_trail) \ | 174 #define GR_AUDIT_TRAIL_RESET(audit_trail) \ |
| 178 //GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, fullReset); | 175 //GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, fullReset); |
| 179 | 176 |
| 180 #define GR_AUDIT_TRAIL_ADDBATCH(audit_trail, batchname, bounds) \ | 177 #define GR_AUDIT_TRAIL_ADDBATCH(audit_trail, batch) \ |
| 181 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, addBatch, batchname, bounds); | 178 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, addBatch, batch); |
| 182 | 179 |
| 183 #define GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(audit_trail, combiner) \ | 180 #define GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(audit_trail, combineWith, batch)
\ |
| 184 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultCombined, combiner); | 181 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultCombined, combineWith
, batch); |
| 185 | 182 |
| 186 #define GR_AUDIT_TRAIL_BATCHING_RESULT_NEW(audit_trail, batch) \ | 183 #define GR_AUDIT_TRAIL_BATCHING_RESULT_NEW(audit_trail, batch) \ |
| 187 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultNew, batch); | 184 // Doesn't do anything now, one day... |
| 188 | 185 |
| 189 #endif | 186 #endif |
| OLD | NEW |