1 /* 2 * Copyright 2022 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SKRPDEBUGTRACE 9 #define SKRPDEBUGTRACE 10 11 #include "include/sksl/SkSLDebugTrace.h" 12 #include "src/sksl/tracing/SkSLDebugInfo.h" 13 14 #include <string> 15 #include <vector> 16 17 class SkWStream; 18 19 namespace SkSL { 20 21 class SkRPDebugTrace : public DebugTrace { 22 public: 23 /** Serializes a debug trace to JSON which can be parsed by our debugger. */ 24 void writeTrace(SkWStream* o) const override; 25 26 /** Generates a human-readable dump of the debug trace. */ 27 void dump(SkWStream* o) const override; 28 29 /** Attaches the SkSL source to be debugged. */ 30 void setSource(std::string source); 31 32 /** A 1:1 mapping of slot numbers to debug information. */ 33 std::vector<SlotDebugInfo> fSlotInfo; 34 std::vector<FunctionDebugInfo> fFuncInfo; 35 36 /** SkVM uniforms live in fSlotInfo; SkRP has dedicated a uniform slot map in fUniformInfo. */ 37 std::vector<SlotDebugInfo> fUniformInfo; 38 39 /** The SkSL code, split line-by-line. */ 40 std::vector<std::string> fSource; 41 }; 42 43 } // namespace SkSL 44 45 #endif 46