+ class Loader: public DataFile::ObjectLoader<Program>
+ {
+ public:
+ Loader(Program &);
+
+ private:
+ virtual void finish();
+
+ 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 &);
+ };
+
+ typedef unsigned LayoutHash;
+ struct UniformBlockInfo;
+
+ struct UniformInfo
+ {
+ std::string name;
+ const UniformBlockInfo *block;
+ unsigned location;
+ unsigned size;
+ unsigned array_stride;
+ unsigned matrix_stride;
+ GLenum type;
+ };
+
+ struct UniformBlockInfo
+ {
+ std::string name;
+ unsigned data_size;
+ int bind_point;
+ std::vector<const UniformInfo *> uniforms;
+ LayoutHash layout_hash;
+ };
+
+ 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;
+ ShaderList shaders;
+ ShaderList owned_data;
+ bool linked;
+ UniformBlockMap uniform_blocks;
+ UniformMap uniforms;
+ LayoutHash uniform_layout_hash;
+ AttributeMap attributes;
+
+public:
+ /// Constructs an empty Program with no Shaders attached.