]> git.tdb.fi Git - libs/gl.git/blob - source/glsl/compiler.h
Refactor the interface of SL::Compiler
[libs/gl.git] / source / glsl / compiler.h
1 #ifndef MSP_GL_SL_COMPILER_H_
2 #define MSP_GL_SL_COMPILER_H_
3
4 #include <vector>
5 #include "parser.h"
6 #include "program.h"
7 #include "syntax.h"
8
9 namespace Msp {
10 namespace GL {
11 namespace SL {
12
13 class Compiler
14 {
15 private:
16         Module *module;
17         std::vector<std::string> imported_names;
18
19 public:
20         Compiler();
21         ~Compiler();
22
23 private:
24         void clear();
25 public:
26         void set_source(const std::string &, const std::string & = "<string>");
27         void load_source(IO::Base &, DataFile::Collection * = 0, const std::string & = "<file>");
28         void load_source(IO::Base &, const std::string &);
29         void compile();
30         void add_shaders(Program &);
31
32 private:
33         void append_module(Module &, DataFile::Collection *);
34         void append_stage(Stage &);
35         void import(DataFile::Collection *, const std::string &);
36         void generate(Stage &);
37         bool optimize(Stage &);
38         void finalize(Stage &);
39         static void inject_block(Block &, const Block &);
40 };
41
42 } // namespace SL
43 } // namespace GL
44 } // namespace Msp
45
46 #endif