19 auditOp->fName = op->
name();
20 auditOp->fBounds = op->
bounds();
26 auditOp->fStackTrace = fCurrentStackTrace;
27 fCurrentStackTrace.
clear();
30 auditOp->fClientID = fClientID;
31 Ops** opsLookup = fClientIDLookup.find(fClientID);
35 fClientIDLookup.set(fClientID,
ops);
40 ops->push_back(auditOp);
44 auditOp->fOpsTaskID = fOpsTask.
size();
45 auditOp->fChildID = 0;
49 OpNode* opNode =
new OpNode(proxyID);
50 opNode->fBounds = op->
bounds();
51 opNode->fChildren.push_back(auditOp);
59 int index = *indexPtr;
61 OpNode& consumerOp = *fOpsTask[index];
66 int consumedIndex = *consumedPtr;
67 SkASSERT(consumedIndex < fOpsTask.
size() && fOpsTask[consumedIndex]);
68 OpNode& consumedOp = *fOpsTask[consumedIndex];
71 for (
int i = 0;
i < consumedOp.fChildren.size();
i++) {
72 Op* childOp = consumedOp.fChildren[
i];
75 childOp->fOpsTaskID = index;
76 childOp->fChildID = consumerOp.fChildren.size();
77 consumerOp.fChildren.push_back(childOp);
81 consumerOp.fBounds = consumer->
bounds();
85 fOpsTask[consumedIndex].
reset(
nullptr);
89void GrAuditTrail::copyOutFromOpsTask(OpInfo* outOpInfo,
int opsTaskID) {
91 const OpNode* bn = fOpsTask[opsTaskID].get();
93 outOpInfo->fBounds = bn->fBounds;
94 outOpInfo->fProxyUniqueID = bn->fProxyUniqueID;
95 for (
int j = 0; j < bn->fChildren.size(); j++) {
96 OpInfo::Op& outOp = outOpInfo->fOps.push_back();
97 const Op* currentOp = bn->fChildren[j];
98 outOp.fBounds = currentOp->fBounds;
99 outOp.fClientID = currentOp->fClientID;
104 Ops** opsLookup = fClientIDLookup.find(clientID);
110 for (
int i = 0;
i < (*opsLookup)->size();
i++) {
111 const Op* op = (**opsLookup)[
i];
120 this->copyOutFromOpsTask(&outOpInfo, op->fOpsTaskID);
127 this->copyOutFromOpsTask(outInfo, opsTaskID);
135 fClientIDLookup.foreach ([](
const int&,
Ops**
ops) {
delete *
ops; });
136 fClientIDLookup.reset();
140#ifdef SK_ENABLE_DUMP_GPU
144void GrAuditTrail::JsonifyTArray(
SkJSONWriter& writer,
const char*
name,
const T& array) {
147 for (
int i = 0;
i < array.size();
i++) {
150 array[
i]->toJson(writer);
159 JsonifyTArray(writer,
"Ops", fOpsTask);
165 Ops**
ops = fClientIDLookup.find(clientID);
167 JsonifyTArray(writer,
"Ops", **
ops);
181void GrAuditTrail::Op::toJson(
SkJSONWriter& writer)
const {
185 writer.
appendS32(
"OpsTaskID", fOpsTaskID);
187 skrect_to_json(writer,
"Bounds",
fBounds);
188 if (fStackTrace.size()) {
190 for (
int i = 0;
i < fStackTrace.size();
i++) {
198void GrAuditTrail::OpNode::toJson(
SkJSONWriter& writer)
const {
200 writer.
appendU32(
"ProxyID", fProxyUniqueID.asUInt());
201 skrect_to_json(writer,
"Bounds",
fBounds);
202 JsonifyTArray(writer,
"Ops", fChildren);
207void GrAuditTrail::JsonifyTArray(
SkJSONWriter& writer,
const char*
name,
const T& array) {}
210void GrAuditTrail::Op::toJson(
SkJSONWriter& writer)
const {}
211void GrAuditTrail::OpNode::toJson(
SkJSONWriter& writer)
const {}
void getBoundsByOpsTaskID(OpInfo *outInfo, int opsTaskID)
void getBoundsByClientID(skia_private::TArray< OpInfo > *outInfo, int clientID)
void opsCombined(const GrOp *consumer, const GrOp *consumed)
void toJson(SkJSONWriter &writer) const
static const int kGrAuditTrailInvalidID
void addOp(const GrOp *, GrRenderTargetProxy::UniqueID proxyID)
uint32_t uniqueID() const
virtual const char * name() const =0
const SkRect & bounds() const
void appendS32(int32_t value)
void beginArray(const char *name=nullptr, bool multiline=true)
void appendU32(uint32_t value)
void beginObject(const char *name=nullptr, bool multiline=true)
void appendFloat(float value)
void appendString(const char *value, size_t size)
T & emplace_back(Args &&... args)
V * find(const K &key) const
void remove(const K &key)
sk_sp< SkBlender > blender SkRect rect
DEF_SWITCHES_START aot vmservice shared library name