Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkSLHLSLCodeGenerator.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2020 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
9
12#include "src/sksl/SkSLContext.h" // IWYU pragma: keep
19
20#include <cstdint>
21#include <memory>
22#include <type_traits>
23
24namespace SkSL {
25
26bool ToHLSL(Program& program, const ShaderCaps* caps, OutputStream& out) {
27 TRACE_EVENT0("skia.shaders", "SkSL::ToHLSL");
28 std::string hlsl;
29 if (!ToHLSL(program, caps, &hlsl)) {
30 return false;
31 }
32 out.writeString(hlsl);
33 return true;
34}
35
36bool ToHLSL(Program& program, const ShaderCaps* caps, std::string* out) {
37 std::string spirv;
38 if (!ToSPIRV(program, caps, &spirv)) {
39 return false;
40 }
41 if (!SPIRVtoHLSL(spirv, out)) {
42 program.fContext->fErrors->error(Position(), "HLSL cross-compilation not enabled");
43 return false;
44 }
45 return true;
46}
47
48} // namespace SkSL
bool ToSPIRV(Program &program, const ShaderCaps *caps, OutputStream &out)
bool SPIRVtoHLSL(const std::string &, std::string *)
bool ToHLSL(Program &program, const ShaderCaps *caps, OutputStream &out)
std::shared_ptr< Context > fContext
#define TRACE_EVENT0(category_group, name)