Jim Van Verth | db9f95c | 2021-12-10 17:27:10 -0500 | [diff] [blame^] | 1 | /* |
| 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 | |
| 8 | #ifndef ShaderErrorHandler_DEFINED |
| 9 | #define ShaderErrorHandler_DEFINED |
| 10 | |
| 11 | #include "include/core/SkTypes.h" |
| 12 | |
| 13 | namespace skgpu { |
| 14 | /** |
| 15 | * Abstract class to report errors when compiling shaders. |
| 16 | */ |
| 17 | class SK_API ShaderErrorHandler { |
| 18 | public: |
| 19 | virtual ~ShaderErrorHandler() = default; |
| 20 | |
| 21 | virtual void compileError(const char* shader, const char* errors) = 0; |
| 22 | |
| 23 | protected: |
| 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 | */ |
| 32 | ShaderErrorHandler* DefaultShaderErrorHandler(); |
| 33 | |
| 34 | } // namespace skgpu |
| 35 | |
| 36 | #endif |