25void PaintParamsKeyBuilder::checkReset() {
31void PaintParamsKeyBuilder::pushStack(int32_t codeSnippetID) {
32 SkASSERT(fDict->isValidID(codeSnippetID));
34 if (!fStack.empty()) {
35 fStack.back().fNumActualChildren++;
36 SkASSERT(fStack.back().fNumActualChildren <= fStack.back().fNumExpectedChildren);
39 const ShaderSnippet* snippet = fDict->getEntry(codeSnippetID);
40 fStack.push_back({codeSnippetID, snippet->fNumChildren});
43void PaintParamsKeyBuilder::popStack() {
45 SkASSERT(fStack.back().fNumActualChildren == fStack.back().fNumExpectedChildren);
65 const int32_t index = (*currentIndex)++;
66 const int32_t
id = fData[index];
76 const ShaderNode* child = this->createNode(dict, currentIndex, arena);
80 childArray[i] = child;
83 return arena->
make<ShaderNode>(entry,
SkSpan(childArray, entry->fNumChildren),
id, index);
92 const int keySize = SkTo<int>(fData.
size());
97 while (currentIndex < keySize) {
98 const ShaderNode* root = this->createNode(dict, ¤tIndex, arena);
102 roots.push_back(root);
107 memcpy(rootSpan, roots.data(), roots.size_bytes());
108 return SkSpan(rootSpan, roots.size());
117 int32_t
id = keyData[currentIndex++];
120 str->
append(
"UnknownCodeSnippetID:");
128 name.remove_suffix(6);
135 currentIndex =
key_to_string(str, dict, keyData, currentIndex);
146 const int keySize = SkTo<int>(fData.
size());
147 for (
int currentIndex = 0; currentIndex < keySize; ) {
148 currentIndex =
key_to_string(&str, dict, fData, currentIndex);
163 int32_t
id = keyData[currentIndex++];
166 SkDebugf(
"[%d] unknown block!\n",
id);
172 currentIndex = dump_node(dict, keyData, currentIndex, indent + 1);
177void PaintParamsKey::dump(
const ShaderCodeDictionary* dict)
const {
178 const int keySize = SkTo<int>(fData.
size());
180 SkDebugf(
"--------------------------------------\n");
181 SkDebugf(
"PaintParamsKey (keySize: %d):\n", keySize);
183 int currentIndex = 0;
184 while (currentIndex < keySize) {
185 currentIndex = dump_node(dict, fData, currentIndex, 1);
#define SKGPU_LOG_E(fmt,...)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
T * makeArrayDefault(size_t count)
T * makeArray(size_t count)
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
constexpr T * data() const
constexpr size_t size_bytes() const
constexpr size_t size() const
void append(const char text[])
void appendS32(int32_t value)
SkString toString(const ShaderCodeDictionary *dict) const
PaintParamsKey clone(SkArenaAlloc *) const
SkSpan< const ShaderNode * > getRootNodes(const ShaderCodeDictionary *, SkArenaAlloc *) const
const ShaderSnippet * getEntry(int codeSnippetID) const SK_EXCLUDES(fSpinLock)
static int key_to_string(SkString *str, const ShaderCodeDictionary *dict, SkSpan< const int32_t > keyData, int currentIndex)
constexpr bool ends_with(std::string_view str, std::string_view suffix)
const char * fStaticFunctionName