]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/compiler.h
Support specialization constants in the GLSL compiler
[libs/gl.git] / source / glsl / compiler.h
index 0ecec70d52e38369532be5902634c4bcf2e93463..69ac7427d80fc97188fa2bcbb0c2c600ef6cf67a 100644 (file)
@@ -2,6 +2,8 @@
 #define MSP_GL_SL_COMPILER_H_
 
 #include <vector>
+#include <msp/datafile/collection.h>
+#include <msp/io/base.h>
 #include "parser.h"
 #include "syntax.h"
 
@@ -19,11 +21,15 @@ public:
        };
 
 private:
+       Features features;
        Module *module;
        std::vector<std::string> imported_names;
+       bool specialized;
+       std::map<std::string, int> spec_values;
 
 public:
        Compiler();
+       Compiler(const Features &);
        ~Compiler();
 
 private:
@@ -32,6 +38,7 @@ 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 specialize(const std::map<std::string, int> &);
        void compile(Mode);
 
        std::string get_combined_glsl() const;
@@ -40,8 +47,10 @@ public:
        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:
 
+       std::string get_stage_debug(Stage::Type) const;
+
+private:
        void append_module(Module &, DataFile::Collection *);
        void append_stage(Stage &);
        void import(DataFile::Collection *, const std::string &);