]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programdata.h
Lots of comment updates
[libs/gl.git] / source / programdata.h
index cf642e6141222d3033d80bc6d92e50ff6c99e863..38803c571ee2e210451ccc6abb3abd41ab005b23 100644 (file)
@@ -17,7 +17,13 @@ class Vector3;
 class Vector4;
 
 /**
-Stores uniform variables for a shader program.
+Stores uniform variables for shader programs.  The uniforms are stored in a
+program-independent way, and UniformBlocks are created to match the uniform
+layouts of different programs.  If multiple programs have the same layout, the
+same block is used for them.
+
+The class is optimized for an access pattern where the set of uniforms and
+programs stays constants, with only the values changing.
 */
 class ProgramData
 {
@@ -93,9 +99,14 @@ private:
        void find_uniforms_for_block(Block &, const Program::UniformBlockInfo &) const;
        UniformBlock *create_block(const Program::UniformBlockInfo &) const;
        const UniformBlock *get_block(const Program &, const Program::UniformBlockInfo *) const;
+
 public:
-       const UniformBlock *get_block(const Program &, const std::string &) const;
+       /** Returns a UniformBlock matching the program's layout.  If name is empty,
+       uniforms for the default uniform block (outside any uniform block
+       declarations) are returned. */
+       const UniformBlock *get_block(const Program &prog, const std::string &name) const;
 
+       /// Creates blocks for the currently bound program and applies them.
        void apply() const;
 };