X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fglsl%2Fcompiler.h;h=0ecec70d52e38369532be5902634c4bcf2e93463;hb=ad21753804fd949a6c80e44c6f3de8ea8988af0f;hp=2afc2f560bb00c17ecbdbfbc10f501ef11ad2813;hpb=1fa69bb8eec3070f5da296d6dd0bd67aea62d3bf;p=libs%2Fgl.git diff --git a/source/glsl/compiler.h b/source/glsl/compiler.h index 2afc2f56..0ecec70d 100644 --- a/source/glsl/compiler.h +++ b/source/glsl/compiler.h @@ -3,8 +3,6 @@ #include #include "parser.h" -#include "program.h" -#include "resources.h" #include "syntax.h" namespace Msp { @@ -13,8 +11,14 @@ namespace SL { class Compiler { +public: + enum Mode + { + MODULE, + PROGRAM + }; + private: - Resources *resources; Module *module; std::vector imported_names; @@ -22,19 +26,28 @@ public: Compiler(); ~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 append_module(Module &); + 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; +private: + + 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 &); };