1 /* 2 * Copyright 2023 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_SkSLToBackend_DEFINED 9 #define skgpu_SkSLToBackend_DEFINED 10 11 #include <cstdint> 12 #include <string> 13 14 namespace SkSL { 15 16 enum class ProgramKind : int8_t; 17 struct Program; 18 struct ProgramInterface; 19 struct ProgramSettings; 20 struct ShaderCaps; 21 22 } // namespace SkSL 23 24 namespace skgpu { 25 26 class ShaderErrorHandler; 27 28 /** Wrapper for the SkSL compiler with useful logging and error handling. */ 29 bool SkSLToBackend(const SkSL::ShaderCaps* caps, 30 bool (*toBackend)(SkSL::Program&, const SkSL::ShaderCaps*, std::string*), 31 const char* backendLabel, 32 const std::string& sksl, 33 SkSL::ProgramKind programKind, 34 const SkSL::ProgramSettings& settings, 35 std::string* output, 36 SkSL::ProgramInterface* outInterface, 37 ShaderErrorHandler* errorHandler); 38 39 } // namespace skgpu 40 41 #endif // skgpu_SkSLToBackend_DEFINED 42