aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrAuditTrail.cpp
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@google.com>2016-02-29 06:32:24 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-29 06:32:24 -0800
commit08fc80704d369508276c0bd9d34eb4f8cb2c2f54 (patch)
treeff618bd7ee9dfb0eaf6df5a675f65a38c7e48274 /src/gpu/GrAuditTrail.cpp
parenta7a6f2e01d07a0e01fca948dfca5c5f4df24b5f9 (diff)
Revert of Add abilitly to query audit trail for batches by draw op (patchset #4 id:60001 of https://codereview.chromium.org/1745513002/ )
Reason for revert: kInvalidID conflicts with an older xCode #define Original issue's description: > Add abilitly to query audit trail for batches by draw op > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1745513002 > > Committed: https://skia.googlesource.com/skia/+/9b48a6e3f862076018cc7d63b180b6340f4873cd TBR=ethannicholas@google.com,jcgregorio@google.com,joshualitt@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1747893002
Diffstat (limited to 'src/gpu/GrAuditTrail.cpp')
-rw-r--r--src/gpu/GrAuditTrail.cpp87
1 files changed, 31 insertions, 56 deletions
diff --git a/src/gpu/GrAuditTrail.cpp b/src/gpu/GrAuditTrail.cpp
index dae50221a2..59201f4450 100644
--- a/src/gpu/GrAuditTrail.cpp
+++ b/src/gpu/GrAuditTrail.cpp
@@ -8,36 +8,29 @@
#include "GrAuditTrail.h"
#include "batches/GrBatch.h"
-const int GrAuditTrail::kInvalidID = -1;
-
void GrAuditTrail::batchingResultCombined(GrBatch* combiner) {
int* indexPtr = fIDLookup.find(combiner);
SkASSERT(indexPtr);
int index = *indexPtr;
- SkASSERT(index < fBatchList.count());
- BatchNode& batch = *fBatchList[index];
-
- // set the ids for the child batch
- fCurrentBatch->fBatchListID = index;
- fCurrentBatch->fChildID = batch.fChildren.count();
-
- // Update the bounds and store a pointer to the new batch
+ 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) {
- // Our algorithm doesn't bother to reorder inside of a BatchNode
- // so the ChildID will start at 0
- fCurrentBatch->fBatchListID = fBatchList.count();
- fCurrentBatch->fChildID = 0;
-
- // We use the batch pointer as a key to find the batchnode we are 'glomming' batches onto
- fIDLookup.set(batch, fCurrentBatch->fBatchListID);
- BatchNode* batchNode = new BatchNode;
- batchNode->fBounds = fCurrentBatch->fBounds;
- batchNode->fChildren.push_back(fCurrentBatch);
- fBatchList.emplace_back(batchNode);
+ fIDLookup.set(batch, fBatches.count());
+ fBatches.push_back(fCurrentBatch);
}
template <typename T>
@@ -125,27 +118,15 @@ 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, "Batches", fBatchList, false);
- json.append("}");
-
- if (prettyPrint) {
- return pretty_print_json(json);
+ if (!batchList) {
+ JsonifyTArray(&json, "Stacks", fFrames, false);
} else {
- return json;
- }
-}
-
-SkString GrAuditTrail::toJson(int clientID, bool prettyPrint) const {
- SkString json;
- json.append("{");
- Batches** batches = fClientIDLookup.find(clientID);
- if (batches) {
- JsonifyTArray(&json, "Batches", **batches, false);
+ JsonifyTArray(&json, "Batches", fBatches, false);
}
- json.appendf("}");
+ json.append("}");
if (prettyPrint) {
return pretty_print_json(json);
@@ -154,32 +135,26 @@ SkString GrAuditTrail::toJson(int clientID, bool prettyPrint) const {
}
}
-static void skrect_to_json(SkString* json, const char* name, const SkRect& rect) {
- json->appendf("\"%s\": {", name);
- json->appendf("\"Left\": %f,", rect.fLeft);
- json->appendf("\"Right\": %f,", rect.fRight);
- json->appendf("\"Top\": %f,", rect.fTop);
- json->appendf("\"Bottom\": %f", rect.fBottom);
- json->append("}");
-}
-
-SkString GrAuditTrail::Batch::toJson() const {
+SkString GrAuditTrail::Frame::toJson() const {
SkString json;
json.append("{");
- json.appendf("\"Name\": \"%s\",", fName.c_str());
- json.appendf("\"ClientID\": \"%d\",", fClientID);
- json.appendf("\"BatchListID\": \"%d\",", fBatchListID);
- json.appendf("\"ChildID\": \"%d\",", fChildID);
- skrect_to_json(&json, "Bounds", fBounds);
+ json.appendf("\"Name\": \"%s\"", fName);
+ JsonifyTArray(&json, "Frames", fChildren, true);
json.append("}");
return json;
}
-SkString GrAuditTrail::BatchNode::toJson() const {
+SkString GrAuditTrail::Batch::toJson() const {
SkString json;
json.append("{");
- skrect_to_json(&json, "Bounds", fBounds);
- JsonifyTArray(&json, "Batches", fChildren, true);
+ json.appendf("\"Name\": \"%s\",", fName);
+ json.append("\"Bounds\": {");
+ json.appendf("\"Left\": %f,", fBounds.fLeft);
+ 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;
}