1 #ifndef MSP_GL_SL_SPIRVWRITER_H_
2 #define MSP_GL_SL_SPIRVWRITER_H_
7 #include "spirvconstants.h"
15 typedef std::uint32_t Word;
17 std::vector<Word> code;
18 std::vector<Word> capabilities;
19 std::vector<Word> extensions;
20 std::vector<Word> entry_points;
21 std::vector<Word> exec_modes;
22 std::vector<Word> names;
23 std::vector<Word> decorations;
24 std::vector<Word> globals;
25 std::vector<Word> functions;
26 std::vector<Word> locals;
27 std::vector<Word> function_body;
33 typedef SpirVOpcode Opcode;
34 typedef SpirVDecoration Decoration;
35 typedef SpirVContent::Word Word;
39 SpirVContent &content;
40 std::vector<Word> *op_target;
45 SpirVWriter(SpirVContent &);
47 void append(std::vector<Word> &, const std::vector<Word> &);
49 void write_float(float);
50 void write_string(const std::string &);
51 void begin_op(std::vector<Word> &, Opcode, unsigned = 0);
52 void end_op(SpirVOpcode);
53 void write_op(std::vector<Word> &, Opcode);
54 void write_op(std::vector<Word> &, Opcode, Word);
55 void write_op(std::vector<Word> &, Opcode, Word, Word);
56 void write_op(std::vector<Word> &, Opcode, Word, Word, Word);
57 void write_op_name(Id, const std::string &);
58 void write_op_member_name(Id, unsigned, const std::string &);
59 void write_op_decorate(Id, Decoration);
60 void write_op_decorate(Id, Decoration, Word);
61 void write_op_member_decorate(Id, unsigned, Decoration);
62 void write_op_member_decorate(Id, unsigned, Decoration, Word);
63 void write_op_label(Id);
64 Id get_current_block() const { return current_block_id; }
65 void begin_function_body(Id);
66 void end_function_body();
67 void finalize(unsigned, Id);