2 * Copyright 2019 Google LLC
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkShaderUtils_DEFINED
9 #define SkShaderUtils_DEFINED
11 #include "include/core/SkTypes.h"
12 #include "include/private/SkSLProgramKind.h"
17 namespace SkShaderUtils {
19 std::string PrettyPrint(const std::string& string);
21 void VisitLineByLine(const std::string& text,
22 const std::function<void(int lineNumber, const char* lineText)>&);
24 // Prints shaders one line at the time. This ensures they don't get truncated by the adb log.
25 inline void PrintLineByLine(const std::string& text) {
26 VisitLineByLine(text, [](int lineNumber, const char* lineText) {
27 SkDebugf("%4i\t%s\n", lineNumber, lineText);
31 // Combines raw shader and error text into an easier-to-read error message with line numbers.
32 std::string BuildShaderErrorMessage(const char* shader, const char* errors);
34 void PrintShaderBanner(SkSL::ProgramKind programKind);
36 } // namespace SkShaderUtils