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 SKSLDEBUGINFO 9 #define SKSLDEBUGINFO 10 11 #include "src/sksl/ir/SkSLType.h" 12 13 #include <cstdint> 14 #include <string> 15 16 namespace SkSL { 17 18 struct SlotDebugInfo { 19 /** The full name of this variable (without component), e.g. `myArray[3].myStruct.myVector` */ 20 std::string name; 21 /** The dimensions of this variable: 1x1 is a scalar, Nx1 is a vector, NxM is a matrix. */ 22 uint8_t columns = 1, rows = 1; 23 /** Which component of the variable is this slot? (e.g. `vec4.z` is component 2) */ 24 uint8_t componentIndex = 0; 25 /** Complex types (arrays/structs) can be tracked as a "group" of adjacent slots. */ 26 int groupIndex = 0; 27 /** What kind of numbers belong in this slot? */ 28 SkSL::Type::NumberKind numberKind = SkSL::Type::NumberKind::kNonnumeric; 29 /** Where is this variable located in the program? */ 30 int line = 0; 31 Position pos = {}; 32 /** If this slot holds a function's return value, contains 1; if not, -1. */ 33 int fnReturnValue = -1; 34 }; 35 36 struct FunctionDebugInfo { 37 /** Full function declaration: `float myFunction(half4 color)`) */ 38 std::string name; 39 }; 40 41 } // namespace SkSL 42 43 #endif 44