]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/program.h
Add interfaces for using specialization constants with Programs
[libs/gl.git] / source / core / program.h
index e86ee0595f0ed307047681f74be256fbf06b3d70..052236270d4b54b3d0ca2b29ebecc908f8f82ea5 100644 (file)
@@ -36,6 +36,25 @@ public:
                void vertex_shader(const std::string &);
        };
 
+private:
+       class SpecializationLoader: public DataFile::Loader
+       {
+       private:
+               std::map<std::string, int> &spec_values;
+
+               static ActionMap shared_actions;
+
+       public:
+               SpecializationLoader(std::map<std::string, int> &);
+
+       private:
+               virtual void init_actions();
+
+               void specialize_bool(const std::string &, bool);
+               void specialize_int(const std::string &, int);
+       };
+
+public:
        typedef unsigned LayoutHash;
        struct UniformBlockInfo;
 
@@ -82,21 +101,24 @@ private:
        AttributeMap attributes;
 
 public:
-       /// Constructs an empty Program with no Shaders attached.
+       /// Constructs an empty Program with no shader stages attached.
        Program();
 
        /// Constructs a Program from unified source code using ProgramCompiler.
-       Program(const std::string &);
+       DEPRECATED Program(const std::string &);
 
        /// Constructs a Program from vertex and fragment shader source code.
        DEPRECATED Program(const std::string &, const std::string &);
 
+       /// Constructs a Program from a Module, with specialization constants.
+       Program(const Module &, const std::map<std::string, int> & = std::map<std::string, int>());
+
 private:
        void init();
 public:
        virtual ~Program();
 
-       void add_stages(const Module &);
+       void add_stages(const Module &, const std::map<std::string, int> & = std::map<std::string, int>());
 
        DEPRECATED void attach_shader(Shader &shader);
        DEPRECATED void attach_shader_owned(Shader *shader);