]> git.tdb.fi Git - libs/gl.git/blob - source/glsl/compiler.h
2afc2f560bb00c17ecbdbfbc10f501ef11ad2813
[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 "resources.h"
8 #include "syntax.h"
9
10 namespace Msp {
11 namespace GL {
12 namespace SL {
13
14 class Compiler
15 {
16 private:
17         Resources *resources;
18         Module *module;
19         std::vector<std::string> imported_names;
20
21 public:
22         Compiler();
23         ~Compiler();
24
25         void compile(const std::string &, const std::string & = "<string>");
26         void compile(IO::Base &, Resources * = 0, const std::string & = "<file>");
27         void compile(IO::Base &, const std::string &);
28         void add_shaders(Program &);
29
30 private:
31         void append_module(Module &);
32         void append_stage(Stage &);
33         void process();
34         void import(const std::string &);
35         void generate(Stage &);
36         bool optimize(Stage &);
37         void finalize(Stage &);
38         static void inject_block(Block &, const Block &);
39 };
40
41 } // namespace SL
42 } // namespace GL
43 } // namespace Msp
44
45 #endif