| Flutter Impeller |

spirv_sksl.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_COMPILER_SPIRV_SKSL_H_
6 #define FLUTTER_IMPELLER_COMPILER_SPIRV_SKSL_H_
7
8 #include <cstdint>
9 #include <memory>
10 #include <utility>
11 #include <variant>
12
13 #include "flutter/fml/logging.h"
14 #include "spirv_glsl.hpp"
15
16 namespace impeller {
17 namespace compiler {
18
19 class CompilerSkSL : public spirv_cross::CompilerGLSL {
20 public:
21 explicit CompilerSkSL(std::vector<uint32_t> spirv_)
22 : CompilerGLSL(std::move(spirv_)) {}
23
24 CompilerSkSL(const uint32_t* ir_, size_t word_count)
25 : CompilerGLSL(ir_, word_count) {}
26
27 explicit CompilerSkSL(const spirv_cross::ParsedIR& ir_)
28 : spirv_cross::CompilerGLSL(ir_) {}
29
30 explicit CompilerSkSL(spirv_cross::ParsedIR&& ir_)
31 : spirv_cross::CompilerGLSL(std::move(ir_)) {}
32
33 std::string compile() override;
34
35 private:
36 std::string output_name_;
37
38 void emit_header() override;
39
40 void emit_uniform(const spirv_cross::SPIRVariable& var) override;
41
42 void fixup_user_functions();
43
44 void detect_unsupported_resources();
45 bool emit_constant_resources();
46 bool emit_struct_resources();
47 bool emit_uniform_resources();
48 bool emit_output_resources();
49 bool emit_global_variable_resources();
50 bool emit_undefined_values();
51 void emit_resources();
52
53 void emit_interface_block(const spirv_cross::SPIRVariable& var);
54
55 void emit_function_prototype(
56 spirv_cross::SPIRFunction& func,
57 const spirv_cross::Bitset& return_flags) override;
58
59 std::string image_type_glsl(const spirv_cross::SPIRType& type,
60 uint32_t id = 0) override;
61
62 std::string builtin_to_glsl(spv::BuiltIn builtin,
63 spv::StorageClass storage) override;
64
65 std::string to_texture_op(
66 const spirv_cross::Instruction& i,
67 bool sparse,
68 bool* forward,
69 spirv_cross::SmallVector<uint32_t>& inherited_expressions) override;
70
71 std::string to_function_name(
72 const spirv_cross::CompilerGLSL::TextureFunctionNameArguments& args)
73 override;
74
75 std::string to_function_args(
76 const spirv_cross::CompilerGLSL::TextureFunctionArguments& args,
77 bool* p_forward) override;
78 };
79
80 } // namespace compiler
81 } // namespace impeller
82
83 #endif // FLUTTER_IMPELLER_COMPILER_SPIRV_SKSL_H_
impeller::compiler::CompilerSkSL::CompilerSkSL
CompilerSkSL(const uint32_t *ir_, size_t word_count)
Definition: spirv_sksl.h:24
impeller::compiler::CompilerSkSL::compile
std::string compile() override
Definition: spirv_sksl.cc:24
impeller::compiler::CompilerSkSL::CompilerSkSL
CompilerSkSL(std::vector< uint32_t > spirv_)
Definition: spirv_sksl.h:21
impeller::compiler::CompilerSkSL::CompilerSkSL
CompilerSkSL(spirv_cross::ParsedIR &&ir_)
Definition: spirv_sksl.h:30
std
Definition: comparable.h:95
impeller::compiler::CompilerSkSL
Definition: spirv_sksl.h:19
impeller
Definition: aiks_context.cc:10
impeller::compiler::CompilerSkSL::CompilerSkSL
CompilerSkSL(const spirv_cross::ParsedIR &ir_)
Definition: spirv_sksl.h:27