]> git.tdb.fi Git - libs/gl.git/blobdiff - source/program.h
Remove the deprecated ProgramBuilder class
[libs/gl.git] / source / program.h
index a3fe57bfbece6c409cf7e967191e580a5fd5c5ac..fc60db46fcc2265af0b1ad9282eec1b5b19f6dcb 100644 (file)
@@ -1,12 +1,11 @@
 #ifndef MSP_GL_PROGRAM_H_
 #define MSP_GL_PROGRAM_H_
 
-#include <list>
 #include <string>
+#include <vector>
 #include <msp/datafile/objectloader.h>
 #include "bindable.h"
 #include "gl.h"
-#include "programbuilder.h"
 #include "vertexformat.h"
 
 namespace Msp {
@@ -32,7 +31,6 @@ public:
                void attribute(unsigned, const std::string &);
                void fragment_shader(const std::string &);
                void geometry_shader(const std::string &);
-               void standard();
                void vertex_shader(const std::string &);
        };
 
@@ -59,9 +57,18 @@ public:
                LayoutHash layout_hash;
        };
 
-       typedef std::list<Shader *> ShaderList;
+       struct AttributeInfo
+       {
+               std::string name;
+               unsigned location;
+               unsigned size;
+               GLenum type;
+       };
+
+       typedef std::vector<Shader *> ShaderList;
        typedef std::map<std::string, UniformInfo> UniformMap;
        typedef std::map<std::string, UniformBlockInfo> UniformBlockMap;
+       typedef std::map<std::string, AttributeInfo> AttributeMap;
 
 private:
        unsigned id;
@@ -71,15 +78,12 @@ private:
        UniformBlockMap uniform_blocks;
        UniformMap uniforms;
        LayoutHash uniform_layout_hash;
-       bool legacy_vars;
+       AttributeMap attributes;
 
 public:
        /// Constructs an empty Program with no Shaders attached.
        Program();
 
-       /// Constructs a Program with standard features.
-       Program(const ProgramBuilder::StandardFeatures &);
-
        /// Constructs a Program from unified source code using ProgramCompiler.
        Program(const std::string &);
 
@@ -102,6 +106,10 @@ public:
 
        void link();
 private:
+       static void require_type(GLenum);
+       void query_uniforms();
+       void query_uniform_blocks(const std::vector<UniformInfo *> &);
+       void query_attributes();
        static LayoutHash compute_layout_hash(const std::vector<const UniformInfo *> &);
        static bool uniform_location_compare(const UniformInfo *, const UniformInfo *);
 public:
@@ -114,8 +122,9 @@ public:
        const UniformMap &get_uniforms() const { return uniforms; }
        const UniformInfo &get_uniform_info(const std::string &) const;
        int get_uniform_location(const std::string &) const;
-
-       bool uses_legacy_variables() const { return legacy_vars; }
+       const AttributeMap &get_attributes() const { return attributes; }
+       const AttributeInfo &get_attribute_info(const std::string &) const;
+       int get_attribute_location(const std::string &) const;
 
        void bind() const;
        static void unbind();