X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fcompiler.h;h=4eaff213076ea07131528b03810b1c51b961369e;hb=b30777959d8e2ab2caf489e32f40390f60a75fcb;hp=c8cb565fa1270c12d94c290a8479b0adef6f2084;hpb=696a97bd7411d69953c1a9e4b5f3dfb4c1d848f1;p=libs%2Fgl.git diff --git a/source/glsl/compiler.h b/source/glsl/compiler.h index c8cb565f..4eaff213 100644 --- a/source/glsl/compiler.h +++ b/source/glsl/compiler.h @@ -2,9 +2,9 @@ #define MSP_GL_SL_COMPILER_H_ #include +#include +#include #include "parser.h" -#include "program.h" -#include "resources.h" #include "syntax.h" namespace Msp { @@ -13,33 +13,48 @@ namespace SL { class Compiler { +public: + enum Mode + { + MODULE, + PROGRAM + }; + private: - Resources *resources; + Features features; Module *module; std::vector imported_names; public: Compiler(); + Compiler(const Features &); ~Compiler(); - void compile(const std::string &, const std::string & = ""); - void compile(IO::Base &, Resources * = 0, const std::string & = ""); - void compile(IO::Base &, const std::string &); - void add_shaders(Program &); +private: + void clear(); +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(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; + + std::string get_stage_debug(Stage::Type) const; private: - void append_module(Module &); + void append_module(Module &, DataFile::Collection *); void append_stage(Stage &); - void process(); - void import(const std::string &); - void generate(Stage &); + void import(DataFile::Collection *, const std::string &); + void generate(Stage &, Mode); bool optimize(Stage &); - void finalize(Stage &); + void finalize(Stage &, Mode); static void inject_block(Block &, const Block &); - template - static typename T::ResultType apply(Stage &); - template - static typename T::ResultType apply(Stage &, const A &); }; } // namespace SL