]> git.tdb.fi Git - libs/gl.git/commitdiff
Introduce a typedef for uniform layout hashes in Program
authorMikko Rasa <tdb@tdb.fi>
Sun, 28 Sep 2014 15:29:30 +0000 (18:29 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 28 Sep 2014 15:29:30 +0000 (18:29 +0300)
source/program.cpp
source/program.h
source/programdata.cpp
source/programdata.h

index 3562507ecc2f8c021a92d9f822f28bbd040480a9..a81d80ae378ca457adb70817474109b3d3fc10c3 100644 (file)
@@ -237,7 +237,7 @@ void Program::link()
        uniform_layout_hash = compute_layout_hash(blockless_uniforms);
 }
 
-unsigned Program::compute_layout_hash(const vector<const UniformInfo *> &uniforms)
+Program::LayoutHash Program::compute_layout_hash(const vector<const UniformInfo *> &uniforms)
 {
        string layout_descriptor;
        for(vector<const UniformInfo *>::const_iterator i = uniforms.begin(); i!=uniforms.end(); ++i)
index e78c8ccd0bfef96d0da006827bd6e22dee527973..36f380a2a9821835d930e0e29736ef2e706778d2 100644 (file)
@@ -35,6 +35,7 @@ public:
                void vertex_shader(const std::string &);
        };
 
+       typedef unsigned LayoutHash;
        struct UniformBlockInfo;
 
        struct UniformInfo
@@ -54,7 +55,7 @@ public:
                unsigned data_size;
                unsigned bind_point;
                std::vector<const UniformInfo *> uniforms;
-               unsigned layout_hash;
+               LayoutHash layout_hash;
        };
 
        typedef std::list<Shader *> ShaderList;
@@ -68,7 +69,7 @@ private:
        bool linked;
        UniformBlockMap uniform_blocks;
        UniformMap uniforms;
-       unsigned uniform_layout_hash;
+       LayoutHash uniform_layout_hash;
        bool legacy_vars;
 
 public:
@@ -97,13 +98,13 @@ public:
 
        void link();
 private:
-       static unsigned compute_layout_hash(const std::vector<const UniformInfo *> &);
+       static LayoutHash compute_layout_hash(const std::vector<const UniformInfo *> &);
        static bool uniform_location_compare(const UniformInfo *, const UniformInfo *);
 public:
        bool is_linked() const { return linked; }
        std::string get_info_log() const;
 
-       unsigned get_uniform_layout_hash() const { return uniform_layout_hash; }
+       LayoutHash get_uniform_layout_hash() const { return uniform_layout_hash; }
        const UniformBlockMap &get_uniform_blocks() const { return uniform_blocks; }
        const UniformBlockInfo &get_uniform_block_info(const std::string &) const;
        const UniformMap &get_uniforms() const { return uniforms; }
index bdbe4c1d9e4427721e73096a7b74570e73d26786..0beb9e7f6cb85d1f095def0cbe93063c64dd0a62 100644 (file)
@@ -214,9 +214,9 @@ const UniformBlock *ProgramData::get_block(const Program &prog, const Program::U
                changes = NO_CHANGES;
        }
 
-       unsigned layout_hash = (info ? info->layout_hash : prog.get_uniform_layout_hash());
+       Program::LayoutHash layout_hash = (info ? info->layout_hash : prog.get_uniform_layout_hash());
 
-       map<unsigned, Block>::iterator i = blocks.find(layout_hash);
+       map<Program::LayoutHash, Block>::iterator i = blocks.find(layout_hash);
        if(i==blocks.end())
        {
                i = blocks.insert(BlockMap::value_type(layout_hash, Block())).first;
index f51ad788884aa0ebbbbf545d4a7d8c8cda2da350..6f9242e688928bd9e001f46419a1d04562845471 100644 (file)
@@ -57,7 +57,7 @@ private:
        };
 
        typedef std::map<std::string, Uniform *> UniformMap;
-       typedef std::map<unsigned, Block> BlockMap;
+       typedef std::map<Program::LayoutHash, Block> BlockMap;
 
        // XXX All these mutables are a bit silly, but I'm out of better ideas
        UniformMap uniforms;