| 1 |
/* |
| 2 |
* Copyright 2022 Google Inc. |
| 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 SKSL_WGSLCODEGENERATOR |
| 9 |
#define SKSL_WGSLCODEGENERATOR |
| 10 |
|
| 11 |
#include <string> |
| 12 |
|
| 13 |
namespace SkSL { |
| 14 |
|
| 15 |
class ErrorReporter; |
| 16 |
struct NativeShader; |
| 17 |
class OutputStream; |
| 18 |
enum class PrettyPrint : bool; |
| 19 |
struct Program; |
| 20 |
struct ShaderCaps; |
| 21 |
|
| 22 |
enum class IncludeSyntheticCode : bool { |
| 23 |
kNo = false, |
| 24 |
kYes = true, |
| 25 |
}; |
| 26 |
|
| 27 |
using ValidateWGSLProc = bool (*)(ErrorReporter&, std::string_view wgsl, std::string* warnings); |
| 28 |
|
| 29 |
/** |
| 30 |
* Convert a Program into WGSL code. |
| 31 |
*/ |
| 32 |
bool ToWGSL(Program& program, |
| 33 |
const ShaderCaps* caps, |
| 34 |
OutputStream& out, |
| 35 |
PrettyPrint, |
| 36 |
IncludeSyntheticCode, |
| 37 |
ValidateWGSLProc); |
| 38 |
bool ToWGSL(Program& program, const ShaderCaps* caps, OutputStream& out); |
| 39 |
bool ToWGSL(Program& program, const ShaderCaps* caps, NativeShader* out); |
| 40 |
|
| 41 |
} // namespace SkSL |
| 42 |
|
| 43 |
#endif // SKSL_WGSLCODEGENERATOR |