Flutter Engine
The Flutter Engine
ShaderErrorHandler.h
Go to the documentation of this file.
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 skgpu_ShaderErrorHandler_DEFINED
9#define skgpu_ShaderErrorHandler_DEFINED
10
12
13namespace skgpu {
14/**
15 * Abstract class to report errors when compiling shaders.
16 */
18public:
19 virtual ~ShaderErrorHandler() = default;
20
21 /**
22 * compileError(shader, errors) is kept for backward compatibility with older clients.
23 */
24 virtual void compileError([[maybe_unused]] const char* shader,
25 [[maybe_unused]] const char* errors) {}
26 virtual void compileError(const char* shader,
27 const char* errors,
28 [[maybe_unused]] bool shaderWasCached) {
29 // Default implementation. Ignore shaderWasCached.
30 this->compileError(shader, errors);
31 }
32
33protected:
34 ShaderErrorHandler() = default;
37};
38
39/**
40 * Used when no error handler is set. Will report failures via SkDebugf and asserts.
41 */
43
44} // namespace skgpu
45
46#endif // skgpu_ShaderErrorHandler_DEFINED
#define SK_API
Definition: SkAPI.h:35
ShaderErrorHandler(const ShaderErrorHandler &)=delete
virtual ~ShaderErrorHandler()=default
ShaderErrorHandler & operator=(const ShaderErrorHandler &)=delete
virtual void compileError(const char *shader, const char *errors, bool shaderWasCached)
virtual void compileError(const char *shader, const char *errors)
Definition: GpuTools.h:21
ShaderErrorHandler * DefaultShaderErrorHandler()