blob: 8960da5c5a212b817f9e782ba04cfb5ed345ab8c [file] [log] [blame]
Jim Van Verthdb9f95c2021-12-10 17:27:10 -05001/*
2 * Copyright 2021 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
Greg Danielcdeb0922021-12-20 12:37:56 -05008#ifndef skgpu_ShaderErrorHandler_DEFINED
9#define skgpu_ShaderErrorHandler_DEFINED
Jim Van Verthdb9f95c2021-12-10 17:27:10 -050010
11#include "include/core/SkTypes.h"
12
13namespace skgpu {
14/**
15 * Abstract class to report errors when compiling shaders.
16 */
17class SK_API ShaderErrorHandler {
18public:
19 virtual ~ShaderErrorHandler() = default;
20
21 virtual void compileError(const char* shader, const char* errors) = 0;
22
23protected:
24 ShaderErrorHandler() = default;
25 ShaderErrorHandler(const ShaderErrorHandler&) = delete;
26 ShaderErrorHandler& operator=(const ShaderErrorHandler&) = delete;
27};
28
29/**
30 * Used when no error handler is set. Will report failures via SkDebugf and asserts.
31 */
32ShaderErrorHandler* DefaultShaderErrorHandler();
33
34} // namespace skgpu
35
Greg Danielcdeb0922021-12-20 12:37:56 -050036#endif // skgpu_ShaderErrorHandler_DEFINED