1/*
2 * Copyright 2019 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 GrShaderUtils_DEFINED
9#define GrShaderUtils_DEFINED
10
11#include "include/core/SkTypes.h"
12#include "include/gpu/GrContextOptions.h"
13#include "src/sksl/SkSLString.h"
14
15namespace GrShaderUtils {
16
17SkSL::String PrettyPrint(const SkSL::String& string);
18
19void VisitLineByLine(const SkSL::String& text,
20 const std::function<void(int lineNumber, const char* lineText)>&);
21
22// Prints shaders one line at the time. This ensures they don't get truncated by the adb log.
23inline void PrintLineByLine(const SkSL::String& text) {
24 VisitLineByLine(text, [](int lineNumber, const char* lineText) {
25 SkDebugf("%4i\t%s\n", lineNumber, lineText);
26 });
27}
28
29GrContextOptions::ShaderErrorHandler* DefaultShaderErrorHandler();
30
31}
32
33#endif
34