Flutter Impeller
impeller::compiler::CompilerSkSL Class Reference

#include <spirv_sksl.h>

Inheritance diagram for impeller::compiler::CompilerSkSL:

Public Member Functions

 CompilerSkSL (std::vector< uint32_t > spirv_)
 
 CompilerSkSL (const uint32_t *ir_, size_t word_count)
 
 CompilerSkSL (const spirv_cross::ParsedIR &ir_)
 
 CompilerSkSL (spirv_cross::ParsedIR &&ir_)
 
std::string compile () override
 

Detailed Description

Definition at line 19 of file spirv_sksl.h.

Constructor & Destructor Documentation

◆ CompilerSkSL() [1/4]

impeller::compiler::CompilerSkSL::CompilerSkSL ( std::vector< uint32_t >  spirv_)
inlineexplicit

Definition at line 21 of file spirv_sksl.h.

22  : CompilerGLSL(std::move(spirv_)) {}

◆ CompilerSkSL() [2/4]

impeller::compiler::CompilerSkSL::CompilerSkSL ( const uint32_t *  ir_,
size_t  word_count 
)
inline

Definition at line 24 of file spirv_sksl.h.

25  : CompilerGLSL(ir_, word_count) {}

◆ CompilerSkSL() [3/4]

impeller::compiler::CompilerSkSL::CompilerSkSL ( const spirv_cross::ParsedIR &  ir_)
inlineexplicit

Definition at line 27 of file spirv_sksl.h.

28  : spirv_cross::CompilerGLSL(ir_) {}

◆ CompilerSkSL() [4/4]

impeller::compiler::CompilerSkSL::CompilerSkSL ( spirv_cross::ParsedIR &&  ir_)
inlineexplicit

Definition at line 30 of file spirv_sksl.h.

31  : spirv_cross::CompilerGLSL(std::move(ir_)) {}

Member Function Documentation

◆ compile()

std::string impeller::compiler::CompilerSkSL::compile ( )
override

Definition at line 24 of file spirv_sksl.cc.

24  {
25  ir.fixup_reserved_names();
26 
27  if (get_execution_model() != ExecutionModelFragment) {
28  FLUTTER_CROSS_THROW("Only fragment shaders are supported.'");
29  return "";
30  }
31 
32  options.es = false;
33  options.version = 100;
34  options.vulkan_semantics = false;
35  options.enable_420pack_extension = false;
36  options.flatten_multidimensional_arrays = true;
37 
38  backend.allow_precision_qualifiers = false;
39  backend.basic_int16_type = "short";
40  backend.basic_int_type = "int";
41  backend.basic_uint16_type = "ushort";
42  backend.basic_uint_type = "uint";
43  backend.double_literal_suffix = false;
44  backend.float_literal_suffix = false;
45  backend.long_long_literal_suffix = false;
46  backend.needs_row_major_load_workaround = true;
47  backend.nonuniform_qualifier = "";
48  backend.support_precise_qualifier = false;
49  backend.uint32_t_literal_suffix = false;
50  backend.use_array_constructor = true;
51  backend.workgroup_size_is_hidden = true;
52 
53  fixup_user_functions();
54 
55  fixup_anonymous_struct_names();
56  fixup_type_alias();
57  reorder_type_alias();
58  build_function_control_flow_graphs_and_analyze();
59  fixup_image_load_store_access();
60  update_active_builtins();
61  analyze_image_and_sampler_usage();
62  analyze_interlocked_resource_usage();
63 
64  uint32_t pass_count = 0;
65  do {
66  reset(pass_count);
67 
68  // Move constructor for this type is broken on GCC 4.9 ...
69  buffer.reset();
70 
71  emit_header();
72  emit_resources();
73 
74  emit_function(get<SPIRFunction>(ir.default_entry_point), Bitset());
75 
76  pass_count++;
77  } while (is_forcing_recompilation());
78 
79  statement("half4 main(float2 iFragCoord)");
80  begin_scope();
81  statement(" flutter_FragCoord = float4(iFragCoord, 0, 0);");
82  statement(" FLT_main();");
83  statement(" return " + output_name_ + ";");
84  end_scope();
85 
86  return buffer.str();
87 }
#define FLUTTER_CROSS_THROW(x)
Definition: spirv_sksl.cc:22

References FLUTTER_CROSS_THROW.


The documentation for this class was generated from the following files: