2 * Copyright 2021 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 #include "include/gpu/ShaderErrorHandler.h"
10 #include "src/utils/SkShaderUtils.h"
14 ShaderErrorHandler* DefaultShaderErrorHandler() {
15 class DefaultShaderErrorHandler : public ShaderErrorHandler {
17 void compileError(const char* shader, const char* errors) override {
18 std::string message = SkShaderUtils::BuildShaderErrorMessage(shader, errors);
19 SkShaderUtils::VisitLineByLine(message, [](int, const char* lineText) {
20 SkDebugf("%s\n", lineText);
22 SkDEBUGFAIL("Shader compilation failed!");
26 static DefaultShaderErrorHandler gHandler;
30 } // namespace SkShaderUtils