]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/compiler.h
Redesign the way shader programs are loaded
[libs/gl.git] / source / glsl / compiler.h
index 8e83990613343c0fdc8510053ffaac1617d4d283..0ecec70d52e38369532be5902634c4bcf2e93463 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <vector>
 #include "parser.h"
-#include "program.h"
 #include "syntax.h"
 
 namespace Msp {
@@ -12,6 +11,13 @@ namespace SL {
 
 class Compiler
 {
+public:
+       enum Mode
+       {
+               MODULE,
+               PROGRAM
+       };
+
 private:
        Module *module;
        std::vector<std::string> imported_names;
@@ -26,16 +32,22 @@ public:
        void set_source(const std::string &, const std::string & = "<string>");
        void load_source(IO::Base &, DataFile::Collection * = 0, const std::string & = "<file>");
        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<Stage::Type> get_stages() const;
+       std::string get_stage_glsl(Stage::Type) const;
+       const std::map<std::string, unsigned> &get_vertex_attributes() const;
+       const std::map<std::string, unsigned> &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 &);
 };