#include <SkSLDebugTracePriv.h>
Definition at line 62 of file SkSLDebugTracePriv.h.
◆ dump()
void SkSL::DebugTracePriv::dump |
( |
SkWStream * |
o | ) |
const |
|
overridevirtual |
Generates a human-readable dump of the debug trace.
Implements SkSL::DebugTrace.
Definition at line 103 of file SkSLDebugTracePriv.cpp.
103 {
104 for (
size_t index = 0; index <
fSlotInfo.size(); ++index) {
106
112 switch (
info.numberKind) {
118 }
121 if (
info.rows != 1) {
124 }
130 }
135 }
136
137 for (
size_t index = 0; index <
fFuncInfo.size(); ++index) {
139
145 }
146
148
150 std::string indent = "";
152 int data0 = traceInfo.data[0];
153 int data1 = traceInfo.data[1];
154 switch (traceInfo.op) {
159 break;
160
162 const SlotDebugInfo& slot =
fSlotInfo[data0];
168 break;
169 }
174 indent += " ";
175 break;
176
178 indent.resize(indent.size() - 2);
182 break;
183
186 indent.pop_back();
187 }
193 indent.push_back(' ');
194 }
195 break;
196 }
198 }
199 }
200}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
std::string getSlotValue(int slotIndex, int32_t value) const
std::vector< FunctionDebugInfo > fFuncInfo
std::vector< TraceInfo > fTraceInfo
std::vector< SlotDebugInfo > fSlotInfo
std::string getSlotComponentSuffix(int slotIndex) const
bool writeDecAsText(int32_t)
bool writeText(const char text[])
DEF_SWITCHES_START aot vmservice shared library name
◆ getSlotComponentSuffix()
std::string SkSL::DebugTracePriv::getSlotComponentSuffix |
( |
int |
slotIndex | ) |
const |
Returns a slot's component as a variable-name suffix, e.g. ".x" or "[2][2]".
Definition at line 29 of file SkSLDebugTracePriv.cpp.
29 {
31
35 "]";
36 }
39 case 0: return ".x";
40 case 1: return ".y";
41 case 2: return ".z";
42 case 3: return ".w";
43 default: return "[???]";
44 }
45 }
46 return {};
47}
static SkString to_string(int n)
◆ getSlotValue()
std::string SkSL::DebugTracePriv::getSlotValue |
( |
int |
slotIndex, |
|
|
int32_t |
value |
|
) |
| const |
Bit-casts a slot's value, then converts to text, e.g. "3.14" or "true" or "12345".
Definition at line 86 of file SkSLDebugTracePriv.cpp.
86 {
88}
double interpretValueBits(int slotIndex, int32_t valueBits) const
std::string slotValueToString(int slotIndex, double value) const
◆ interpretValueBits()
double SkSL::DebugTracePriv::interpretValueBits |
( |
int |
slotIndex, |
|
|
int32_t |
valueBits |
|
) |
| const |
Bit-casts a value for a given slot into a double, honoring the slot's NumberKind.
Definition at line 49 of file SkSLDebugTracePriv.cpp.
49 {
52 switch (
fSlotInfo[slotIndex].numberKind) {
54 uint32_t uintValue;
55 static_assert(sizeof(uintValue) == sizeof(valueBits));
56 memcpy(&uintValue, &valueBits, sizeof(uintValue));
57 return uintValue;
58 }
60 float floatValue;
61 static_assert(sizeof(floatValue) == sizeof(valueBits));
62 memcpy(&floatValue, &valueBits, sizeof(floatValue));
63 return floatValue;
64 }
65 default: {
66 return valueBits;
67 }
68 }
69}
◆ readTrace()
bool SkSL::DebugTracePriv::readTrace |
( |
SkStream * |
r | ) |
|
Serializes a debug trace to JSON which can be parsed by our debugger.
Definition at line 270 of file SkSLDebugTracePriv.cpp.
270 {
275 return false;
276 }
277
280 return false;
281 }
282
285 return false;
286 }
287
291 return false;
292 }
294 }
295
297 if (!slots) {
298 return false;
299 }
300
303 if (!element) {
304 return false;
305 }
306
307
310
311
320 if (!
name || !columns || !rows || !index || !kind || !
line) {
321 return false;
322 }
323
325 info.columns = **columns;
327 info.componentIndex = **index;
328 info.groupIndex = groupIdx ? **groupIdx :
info.componentIndex;
331 info.fnReturnValue = retval ? **retval : -1;
332 }
333
335 if (!functions) {
336 return false;
337 }
338
341 if (!element) {
342 return false;
343 }
344
345
348
349
352 return false;
353 }
354
356 }
357
359 if (!trace) {
360 return false;
361 }
362
368
369 if (!element || element->size() < 1 || element->size() > (1 +
std::size(
info.data))) {
370 return false;
371 }
373 if (!opVal) {
374 return false;
375 }
377 for (size_t elemIdx = 1; elemIdx < element->size(); ++elemIdx) {
379 if (!dataVal) {
380 return false;
381 }
382 info.data[elemIdx - 1] = **dataVal;
383 }
384 }
385
386 return true;
387}
static constexpr char kTraceVersion[]
sk_sp< SkData > SkCopyStreamToData(SkStream *stream)
std::vector< std::string > fSource
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
std::shared_ptr< const fml::Mapping > data
◆ setSource()
void SkSL::DebugTracePriv::setSource |
( |
const std::string & |
source | ) |
|
◆ setTraceCoord()
void SkSL::DebugTracePriv::setTraceCoord |
( |
const SkIPoint & |
coord | ) |
|
Sets the device-coordinate pixel to trace. If it's not set, the point at (0, 0) will be used.
Definition at line 90 of file SkSLDebugTracePriv.cpp.
◆ slotValueToString()
std::string SkSL::DebugTracePriv::slotValueToString |
( |
int |
slotIndex, |
|
|
double |
value |
|
) |
| const |
Converts a numeric value into text, based on the slot's NumberKind.
Definition at line 71 of file SkSLDebugTracePriv.cpp.
71 {
74 switch (
fSlotInfo[slotIndex].numberKind) {
76 return value ?
"true" :
"false";
77 }
78 default: {
82 }
83 }
84}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
◆ writeTrace()
void SkSL::DebugTracePriv::writeTrace |
( |
SkWStream * |
w | ) |
const |
|
overridevirtual |
Serializes a debug trace to JSON which can be parsed by our debugger.
Implements SkSL::DebugTrace.
Definition at line 202 of file SkSLDebugTracePriv.cpp.
202 {
204
205 json.beginObject();
207 json.beginArray("source");
208
210 json.appendString(
line);
211 }
212
213 json.endArray();
214 json.beginArray("slots");
215
216 for (
size_t index = 0; index <
fSlotInfo.size(); ++index) {
218
219 json.beginObject();
220 json.appendString(
"name",
info.name.data(),
info.name.size());
221 json.appendS32(
"columns",
info.columns);
222 json.appendS32(
"rows",
info.rows);
223 json.appendS32(
"index",
info.componentIndex);
224 if (
info.groupIndex !=
info.componentIndex) {
225 json.appendS32(
"groupIdx",
info.groupIndex);
226 }
227 json.appendS32(
"kind", (
int)
info.numberKind);
228 json.appendS32(
"line",
info.line);
229 if (
info.fnReturnValue >= 0) {
230 json.appendS32(
"retval",
info.fnReturnValue);
231 }
232 json.endObject();
233 }
234
235 json.endArray();
236 json.beginArray("functions");
237
238 for (
size_t index = 0; index <
fFuncInfo.size(); ++index) {
240
241 json.beginObject();
242 json.appendString(
"name",
info.name);
243 json.endObject();
244 }
245
246 json.endArray();
247 json.beginArray("trace");
248
249 for (
size_t index = 0; index <
fTraceInfo.size(); ++index) {
251 json.beginArray();
252 json.appendS32((int)trace.op);
253
254
255 int lastDataIdx =
std::size(trace.data) - 1;
256 while (lastDataIdx >= 0 && !trace.data[lastDataIdx]) {
257 --lastDataIdx;
258 }
259 for (int dataIdx = 0; dataIdx <= lastDataIdx; ++dataIdx) {
260 json.appendS32(trace.data[dataIdx]);
261 }
262 json.endArray();
263 }
264
265 json.endArray();
266 json.endObject();
267 json.flush();
268}
◆ fFuncInfo
◆ fSlotInfo
◆ fSource
std::vector<std::string> SkSL::DebugTracePriv::fSource |
◆ fTraceCoord
SkIPoint SkSL::DebugTracePriv::fTraceCoord = {} |
The device-coordinate pixel to trace (controlled by setTraceCoord)
Definition at line 92 of file SkSLDebugTracePriv.h.
◆ fTraceHook
A trace hook which populates fTraceInfo during shader evaluation. This will be created automatically during code generation.
Definition at line 111 of file SkSLDebugTracePriv.h.
◆ fTraceInfo
std::vector<TraceInfo> SkSL::DebugTracePriv::fTraceInfo |
◆ fUniformInfo
SkRP stores uniform slot info in fUniformInfo. (In SkVM, they were mixed into fSlotInfo.)
Definition at line 95 of file SkSLDebugTracePriv.h.
The documentation for this class was generated from the following files: