X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fcompiler.h;h=8340aa6d817bf426caa495eb981944092b9bf256;hb=c0be4e4ae1a8b6ac31ff6b7080e2242c13d947ff;hp=8e83990613343c0fdc8510053ffaac1617d4d283;hpb=73bef37da97b6da0b99227f63235cb52c4e56c44;p=libs%2Fgl.git diff --git a/source/glsl/compiler.h b/source/glsl/compiler.h index 8e839906..8340aa6d 100644 --- a/source/glsl/compiler.h +++ b/source/glsl/compiler.h @@ -2,8 +2,9 @@ #define MSP_GL_SL_COMPILER_H_ #include +#include +#include #include "parser.h" -#include "program.h" #include "syntax.h" namespace Msp { @@ -12,12 +13,21 @@ namespace SL { class Compiler { +public: + enum Mode + { + MODULE, + PROGRAM + }; + private: + Features features; Module *module; std::vector imported_names; public: Compiler(); + Compiler(const Features &); ~Compiler(); private: @@ -26,16 +36,22 @@ public: void set_source(const std::string &, const std::string & = ""); void load_source(IO::Base &, DataFile::Collection * = 0, const std::string & = ""); void load_source(IO::Base &, const std::string &); - void compile(); - void add_shaders(Program &); - + void compile(Mode); + + std::string get_combined_glsl() const; + std::vector get_stages() const; + std::string get_stage_glsl(Stage::Type) const; + const std::map &get_vertex_attributes() const; + const std::map &get_fragment_outputs() const; + const SourceMap &get_source_map() const; private: + void append_module(Module &, DataFile::Collection *); void append_stage(Stage &); void import(DataFile::Collection *, const std::string &); - void generate(Stage &); + void generate(Stage &, Mode); bool optimize(Stage &); - void finalize(Stage &); + void finalize(Stage &, Mode); static void inject_block(Block &, const Block &); };