From: Mikko Rasa Date: Sun, 28 Sep 2014 15:29:30 +0000 (+0300) Subject: Introduce a typedef for uniform layout hashes in Program X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=259254bc46e3aec6f719e1aea5e4936569c15b6e;p=libs%2Fgl.git Introduce a typedef for uniform layout hashes in Program --- diff --git a/source/program.cpp b/source/program.cpp index 3562507e..a81d80ae 100644 --- a/source/program.cpp +++ b/source/program.cpp @@ -237,7 +237,7 @@ void Program::link() uniform_layout_hash = compute_layout_hash(blockless_uniforms); } -unsigned Program::compute_layout_hash(const vector &uniforms) +Program::LayoutHash Program::compute_layout_hash(const vector &uniforms) { string layout_descriptor; for(vector::const_iterator i = uniforms.begin(); i!=uniforms.end(); ++i) diff --git a/source/program.h b/source/program.h index e78c8ccd..36f380a2 100644 --- a/source/program.h +++ b/source/program.h @@ -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 uniforms; - unsigned layout_hash; + LayoutHash layout_hash; }; typedef std::list 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 &); + static LayoutHash compute_layout_hash(const std::vector &); 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; } diff --git a/source/programdata.cpp b/source/programdata.cpp index bdbe4c1d..0beb9e7f 100644 --- a/source/programdata.cpp +++ b/source/programdata.cpp @@ -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::iterator i = blocks.find(layout_hash); + map::iterator i = blocks.find(layout_hash); if(i==blocks.end()) { i = blocks.insert(BlockMap::value_type(layout_hash, Block())).first; diff --git a/source/programdata.h b/source/programdata.h index f51ad788..6f9242e6 100644 --- a/source/programdata.h +++ b/source/programdata.h @@ -57,7 +57,7 @@ private: }; typedef std::map UniformMap; - typedef std::map BlockMap; + typedef std::map BlockMap; // XXX All these mutables are a bit silly, but I'm out of better ideas UniformMap uniforms;