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

Unified Diff: src/gpu/GrAuditTrail.cpp

Issue 1724243004: Add batchlist managment to GrAuditTrail (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: push back initial batch before updating the bounds on combine Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/private/GrAuditTrail.h ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAuditTrail.cpp
diff --git a/src/gpu/GrAuditTrail.cpp b/src/gpu/GrAuditTrail.cpp
index aa527fb4b0a1d078b71a4caa7864ebc41632da0f..59201f4450104c240c7ddc8fc412016c14300479 100644
--- a/src/gpu/GrAuditTrail.cpp
+++ b/src/gpu/GrAuditTrail.cpp
@@ -6,8 +6,35 @@
*/
#include "GrAuditTrail.h"
+#include "batches/GrBatch.h"
-void GrAuditTrail::JsonifyTArray(SkString* json, const char* name, const FrameArray& array,
+void GrAuditTrail::batchingResultCombined(GrBatch* combiner) {
+ int* indexPtr = fIDLookup.find(combiner);
+ SkASSERT(indexPtr);
+ int index = *indexPtr;
+ SkASSERT(index < fBatches.count());
+ Batch& batch = *fBatches[index];
+
+ // if this is our first child, we also push back a copy of the original batch and its
+ // bounds
+ if (batch.fChildren.empty()) {
+ Batch* firstBatch = new Batch;
+ firstBatch->fName = batch.fName;
+ firstBatch->fBounds = batch.fBounds;
+ fEvents.emplace_back(firstBatch);
+ batch.fChildren.push_back(firstBatch);
+ }
+ batch.fChildren.push_back(fCurrentBatch);
+ batch.fBounds = combiner->bounds();
+}
+
+void GrAuditTrail::batchingResultNew(GrBatch* batch) {
+ fIDLookup.set(batch, fBatches.count());
+ fBatches.push_back(fCurrentBatch);
+}
+
+template <typename T>
+void GrAuditTrail::JsonifyTArray(SkString* json, const char* name, const T& array,
bool addComma) {
if (array.count()) {
if (addComma) {
@@ -91,10 +118,14 @@ static SkString pretty_print_json(SkString json) {
return prettyPrintJson.prettify(json);
}
-SkString GrAuditTrail::toJson(bool prettyPrint) const {
+SkString GrAuditTrail::toJson(bool batchList, bool prettyPrint) const {
SkString json;
json.append("{");
- JsonifyTArray(&json, "Stacks", fFrames, false);
+ if (!batchList) {
+ JsonifyTArray(&json, "Stacks", fFrames, false);
+ } else {
+ JsonifyTArray(&json, "Batches", fBatches, false);
+ }
json.append("}");
if (prettyPrint) {
@@ -122,6 +153,7 @@ SkString GrAuditTrail::Batch::toJson() const {
json.appendf("\"Right\": %f,", fBounds.fRight);
json.appendf("\"Top\": %f,", fBounds.fTop);
json.appendf("\"Bottom\": %f", fBounds.fBottom);
+ JsonifyTArray(&json, "Children", fChildren, true);
json.append("}");
json.append("}");
return json;
« no previous file with comments | « include/private/GrAuditTrail.h ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698