Guest User

hash.patch

a guest
May 26th, 2013
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.99 KB | None | 0 0
  1. src/graphics/gl3v/renderer.cpp | 34 +++++++++++++++++-----------------
  2. src/graphics/gl3v/renderpass.cpp | 28 ++++++++++++++--------------
  3. 2 files changed, 31 insertions(+), 31 deletions(-)
  4.  
  5. diff --git a/src/graphics/gl3v/renderer.cpp b/src/graphics/gl3v/renderer.cpp
  6. index 8774b86..c165f32 100644
  7. --- a/src/graphics/gl3v/renderer.cpp
  8. +++ b/src/graphics/gl3v/renderer.cpp
  9. @@ -172,7 +172,7 @@ RenderModelHandle Renderer::addModel(const RenderModelEntry & entry)
  10. RenderModelHandle handle = models.insert(entry);
  11.  
  12. // For all passes that use this draw group, send them the model.
  13. - std::tr1::unordered_map <StringId, std::vector <unsigned int> >::iterator iter = drawGroupToPasses.find(models.get(handle).group);
  14. + std::tr1::unordered_map <StringId, std::vector <unsigned int>, StringId::hash>::iterator iter = drawGroupToPasses.find(models.get(handle).group);
  15. if (iter != drawGroupToPasses.end())
  16. {
  17. const std::vector <unsigned int> & passesWithDrawGroup = iter->second;
  18. @@ -189,7 +189,7 @@ void Renderer::removeModel(RenderModelHandle handle)
  19. models.erase(handle);
  20.  
  21. // For all passes that use this draw group, tell them to remove the model.
  22. - std::tr1::unordered_map <StringId, std::vector <unsigned int> >::iterator iter = drawGroupToPasses.find(models.get(handle).group);
  23. + std::tr1::unordered_map <StringId, std::vector <unsigned int>, StringId::hash>::iterator iter = drawGroupToPasses.find(models.get(handle).group);
  24. if (iter != drawGroupToPasses.end())
  25. {
  26. const std::vector <unsigned int> & passesWithDrawGroup = iter->second;
  27. @@ -202,7 +202,7 @@ void Renderer::removeModel(RenderModelHandle handle)
  28. void Renderer::setModelTexture(RenderModelHandle handle, const RenderTextureEntry & texture)
  29. {
  30. // For all passes that use this draw group, pass on the message.
  31. - std::tr1::unordered_map <StringId, std::vector <unsigned int> >::iterator iter = drawGroupToPasses.find(models.get(handle).group);
  32. + std::tr1::unordered_map <StringId, std::vector <unsigned int>, StringId::hash>::iterator iter = drawGroupToPasses.find(models.get(handle).group);
  33. if (iter != drawGroupToPasses.end())
  34. {
  35. const std::vector <unsigned int> & passesWithDrawGroup = iter->second;
  36. @@ -215,7 +215,7 @@ void Renderer::setModelTexture(RenderModelHandle handle, const RenderTextureEntr
  37. void Renderer::removeModelTexture(RenderModelHandle handle, StringId name)
  38. {
  39. // For all passes that use this draw group, pass on the message.
  40. - std::tr1::unordered_map <StringId, std::vector <unsigned int> >::iterator iter = drawGroupToPasses.find(models.get(handle).group);
  41. + std::tr1::unordered_map <StringId, std::vector <unsigned int>, StringId::hash>::iterator iter = drawGroupToPasses.find(models.get(handle).group);
  42. if (iter != drawGroupToPasses.end())
  43. {
  44. const std::vector <unsigned int> & passesWithDrawGroup = iter->second;
  45. @@ -228,7 +228,7 @@ void Renderer::removeModelTexture(RenderModelHandle handle, StringId name)
  46. void Renderer::setModelUniform(RenderModelHandle handle, const RenderUniformEntry & uniform)
  47. {
  48. // For all passes that use this draw group, pass on the message.
  49. - std::tr1::unordered_map <StringId, std::vector <unsigned int> >::iterator iter = drawGroupToPasses.find(models.get(handle).group);
  50. + std::tr1::unordered_map <StringId, std::vector <unsigned int>, StringId::hash>::iterator iter = drawGroupToPasses.find(models.get(handle).group);
  51. if (iter != drawGroupToPasses.end())
  52. {
  53. const std::vector <unsigned int> & passesWithDrawGroup = iter->second;
  54. @@ -241,7 +241,7 @@ void Renderer::setModelUniform(RenderModelHandle handle, const RenderUniformEntr
  55. void Renderer::removeModelUniform(RenderModelHandle handle, StringId name)
  56. {
  57. // For all passes that use this draw group, pass on the message.
  58. - std::tr1::unordered_map <StringId, std::vector <unsigned int> >::iterator iter = drawGroupToPasses.find(models.get(handle).group);
  59. + std::tr1::unordered_map <StringId, std::vector <unsigned int>, StringId::hash>::iterator iter = drawGroupToPasses.find(models.get(handle).group);
  60. if (iter != drawGroupToPasses.end())
  61. {
  62. const std::vector <unsigned int> & passesWithDrawGroup = iter->second;
  63. @@ -271,7 +271,7 @@ void Renderer::removeGlobalTexture(StringId name)
  64.  
  65. void Renderer::setPassTexture(StringId passName, StringId textureName, const RenderTextureEntry & texture)
  66. {
  67. - std::tr1::unordered_map <StringId, int>::iterator i = passIndexMap.find(passName);
  68. + std::tr1::unordered_map <StringId, int, StringId::hash>::iterator i = passIndexMap.find(passName);
  69. if (i != passIndexMap.end())
  70. {
  71. assert((unsigned int)i->second < passes.size());
  72. @@ -281,7 +281,7 @@ void Renderer::setPassTexture(StringId passName, StringId textureName, const Ren
  73.  
  74. void Renderer::removePassTexture(StringId passName, StringId textureName)
  75. {
  76. - std::tr1::unordered_map <StringId, int>::iterator i = passIndexMap.find(passName);
  77. + std::tr1::unordered_map <StringId, int, StringId::hash>::iterator i = passIndexMap.find(passName);
  78. if (i != passIndexMap.end())
  79. {
  80. assert((unsigned int)i->second < passes.size());
  81. @@ -310,7 +310,7 @@ void Renderer::removeGlobalUniform(StringId name)
  82.  
  83. void Renderer::setPassUniform(StringId passName, const RenderUniformEntry & uniform)
  84. {
  85. - std::tr1::unordered_map <StringId, int>::iterator i = passIndexMap.find(passName);
  86. + std::tr1::unordered_map <StringId, int, StringId::hash>::iterator i = passIndexMap.find(passName);
  87. if (i != passIndexMap.end())
  88. {
  89. assert((unsigned int)i->second < passes.size());
  90. @@ -320,7 +320,7 @@ void Renderer::setPassUniform(StringId passName, const RenderUniformEntry & unif
  91.  
  92. void Renderer::removePassUniform(StringId passName, StringId uniformName)
  93. {
  94. - std::tr1::unordered_map <StringId, int>::iterator i = passIndexMap.find(passName);
  95. + std::tr1::unordered_map <StringId, int, StringId::hash>::iterator i = passIndexMap.find(passName);
  96. if (i != passIndexMap.end())
  97. {
  98. assert((unsigned int)i->second < passes.size());
  99. @@ -330,7 +330,7 @@ void Renderer::removePassUniform(StringId passName, StringId uniformName)
  100.  
  101. bool Renderer::getPassUniform(StringId passName, StringId uniformName, RenderUniform & out)
  102. {
  103. - std::tr1::unordered_map <StringId, int>::iterator i = passIndexMap.find(passName);
  104. + std::tr1::unordered_map <StringId, int, StringId::hash>::iterator i = passIndexMap.find(passName);
  105. if (i != passIndexMap.end())
  106. {
  107. assert((unsigned int)i->second < passes.size());
  108. @@ -342,7 +342,7 @@ bool Renderer::getPassUniform(StringId passName, StringId uniformName, RenderUni
  109.  
  110. void Renderer::setPassEnabled(StringId passName, bool enable)
  111. {
  112. - std::tr1::unordered_map <StringId, int>::iterator i = passIndexMap.find(passName);
  113. + std::tr1::unordered_map <StringId, int, StringId::hash>::iterator i = passIndexMap.find(passName);
  114. if (i != passIndexMap.end())
  115. {
  116. assert((unsigned int)i->second < passes.size());
  117. @@ -352,7 +352,7 @@ void Renderer::setPassEnabled(StringId passName, bool enable)
  118.  
  119. bool Renderer::getPassEnabled(StringId passName) const
  120. {
  121. - std::tr1::unordered_map <StringId, int>::const_iterator i = passIndexMap.find(passName);
  122. + std::tr1::unordered_map <StringId, int, StringId::hash>::const_iterator i = passIndexMap.find(passName);
  123. if (i != passIndexMap.end())
  124. {
  125. assert((unsigned int)i->second < passes.size());
  126. @@ -364,7 +364,7 @@ bool Renderer::getPassEnabled(StringId passName) const
  127. static const std::map <std::string, std::string> emptyStringMap;
  128. const std::map <std::string, std::string> & Renderer::getUserDefinedFields(StringId passName) const
  129. {
  130. - std::tr1::unordered_map <StringId, int>::const_iterator i = passIndexMap.find(passName);
  131. + std::tr1::unordered_map <StringId, int, StringId::hash>::const_iterator i = passIndexMap.find(passName);
  132. if (i != passIndexMap.end())
  133. {
  134. assert((unsigned int)i->second < passes.size());
  135. @@ -376,7 +376,7 @@ const std::map <std::string, std::string> & Renderer::getUserDefinedFields(Strin
  136. static const std::set <StringId> emptySet;
  137. const std::set <StringId> & Renderer::getDrawGroups(StringId passName) const
  138. {
  139. - std::tr1::unordered_map <StringId, int>::const_iterator i = passIndexMap.find(passName);
  140. + std::tr1::unordered_map <StringId, int, StringId::hash>::const_iterator i = passIndexMap.find(passName);
  141. if (i != passIndexMap.end())
  142. {
  143. assert((unsigned int)i->second < passes.size());
  144. @@ -427,7 +427,7 @@ void Renderer::printRendererStatus(RendererStatusVerbosity verbosity, const Stri
  145. if (verbosity >= VERBOSITY_MODELS_TEXTURES)
  146. {
  147. out << "Global textures: " << sharedTextures.size() << std::endl;
  148. - for (std::tr1::unordered_map <StringId, RenderTextureEntry>::const_iterator i = sharedTextures.begin(); i != sharedTextures.end(); i++)
  149. + for (std::tr1::unordered_map <StringId, RenderTextureEntry, StringId::hash>::const_iterator i = sharedTextures.begin(); i != sharedTextures.end(); i++)
  150. out << passPrefix << stringMap.getString(i->first) << ", handle " << i->second.handle << std::endl;
  151. }
  152.  
  153. @@ -439,7 +439,7 @@ void Renderer::printRendererStatus(RendererStatusVerbosity verbosity, const Stri
  154.  
  155. out << passPrefix << "Draw groups: ";
  156. int dgcount = 0;
  157. - for (std::tr1::unordered_map <StringId, std::vector <unsigned int> >::const_iterator dg = drawGroupToPasses.begin(); dg != drawGroupToPasses.end(); dg++)
  158. + for (std::tr1::unordered_map <StringId, std::vector <unsigned int>, StringId::hash>::const_iterator dg = drawGroupToPasses.begin(); dg != drawGroupToPasses.end(); dg++)
  159. if (std::find(dg->second.begin(), dg->second.end(), passcount) != dg->second.end())
  160. {
  161. if (dgcount != 0)
  162. diff --git a/src/graphics/gl3v/renderpass.cpp b/src/graphics/gl3v/renderpass.cpp
  163. index df0652e..92923e2 100644
  164. --- a/src/graphics/gl3v/renderpass.cpp
  165. +++ b/src/graphics/gl3v/renderpass.cpp
  166. @@ -138,7 +138,7 @@ bool RenderPass::initialize(int passCount, const RealtimeExportPassInfo & config
  167.  
  168. // Fill default textures from passed-in shared textures.
  169. // Fexture bindings that can be overridden (or not) by specific models.
  170. - std::tr1::unordered_map <StringId, RenderTextureEntry>::const_iterator defaultTexIter = sharedTextures.find(stringMap.addStringId(textureName));
  171. + std::tr1::unordered_map <StringId, RenderTextureEntry, StringId::hash>::const_iterator defaultTexIter = sharedTextures.find(stringMap.addStringId(textureName));
  172. if (defaultTexIter != sharedTextures.end())
  173. defaultTextureBindings.push_back(RenderTexture(tu, defaultTexIter->second));
  174. }
  175. @@ -410,7 +410,7 @@ bool RenderPass::render(GLWrapper & gl, unsigned int w, unsigned int h, StringId
  176. for (std::vector <RenderTextureEntry>::const_iterator t = m->textures.begin(); t != m->textures.end(); t++)
  177. {
  178. // Get the TU associated with this texture name id.
  179. - std::tr1::unordered_map <StringId, GLuint>::iterator tui = textureNameToTextureUnit.find(t->name);
  180. + std::tr1::unordered_map <StringId, GLuint, StringId::hash>::iterator tui = textureNameToTextureUnit.find(t->name);
  181. if (tui != textureNameToTextureUnit.end()) // if the texture isn't used in this pass, it might not be in textureNameToTextureUnit.
  182. {
  183. GLuint tu = tui->second;
  184. @@ -473,7 +473,7 @@ bool RenderPass::render(GLWrapper & gl, unsigned int w, unsigned int h, StringId
  185. {
  186. for (std::vector <RenderUniformEntry>::const_iterator u = m->uniforms.begin(); u != m->uniforms.end(); u++)
  187. {
  188. - std::tr1::unordered_map <StringId, GLuint>::iterator loci = variableNameToUniformLocation.find(u->name);
  189. + std::tr1::unordered_map <StringId, GLuint, StringId::hash>::iterator loci = variableNameToUniformLocation.find(u->name);
  190. if (loci != variableNameToUniformLocation.end()) // If the texture isn't used in this pass, it might not be in variableNameToUniformLocation.
  191. {
  192. GLuint location = loci->second;
  193. @@ -551,7 +551,7 @@ void RenderPass::setModelTexture(RenderModelHandle handle, const RenderTextureEn
  194. RenderModel & model = models.get(iter->second);
  195.  
  196. // First, see if there's an existing texture override with this name.
  197. - std::tr1::unordered_map <StringId, keyed_container <RenderTexture>::handle>::iterator existing = model.textureNameToTextureOverride.find(texture.name);
  198. + std::tr1::unordered_map <StringId, keyed_container <RenderTexture>::handle, StringId::hash>::iterator existing = model.textureNameToTextureOverride.find(texture.name);
  199. if (existing != model.textureNameToTextureOverride.end())
  200. {
  201. // There is an existing override. Change it!
  202. @@ -561,7 +561,7 @@ void RenderPass::setModelTexture(RenderModelHandle handle, const RenderTextureEn
  203. else
  204. {
  205. // This is a new override.
  206. - std::tr1::unordered_map <StringId, GLuint>::iterator tui = textureNameToTextureUnit.find(texture.name);
  207. + std::tr1::unordered_map <StringId, GLuint, StringId::hash>::iterator tui = textureNameToTextureUnit.find(texture.name);
  208. assert(tui != textureNameToTextureUnit.end()); // textureNameToTextureUnit should have been populated when we loaded the sampler.
  209. GLuint tu = tui->second;
  210.  
  211. @@ -582,7 +582,7 @@ void RenderPass::removeModelTexture(RenderModelHandle handle, StringId name)
  212. RenderModel & model = models.get(iter->second);
  213.  
  214. // Find the existing texture override with this name.
  215. - std::tr1::unordered_map <StringId, keyed_container <RenderTexture>::handle>::iterator existing = model.textureNameToTextureOverride.find(name);
  216. + std::tr1::unordered_map <StringId, keyed_container <RenderTexture>::handle, StringId::hash>::iterator existing = model.textureNameToTextureOverride.find(name);
  217. if (existing != model.textureNameToTextureOverride.end())
  218. {
  219. // There is an existing override. Remove it, then remove it from the mapping.
  220. @@ -605,7 +605,7 @@ void RenderPass::setModelUniform(RenderModelHandle handle, const RenderUniformEn
  221. RenderModel & model = models.get(iter->second);
  222.  
  223. // First, see if there's an existing override with this name.
  224. - std::tr1::unordered_map <StringId, keyed_container <RenderUniform>::handle>::iterator existing = model.variableNameToUniformOverride.find(uniform.name);
  225. + std::tr1::unordered_map <StringId, keyed_container <RenderUniform>::handle, StringId::hash>::iterator existing = model.variableNameToUniformOverride.find(uniform.name);
  226. if (existing != model.variableNameToUniformOverride.end())
  227. {
  228. // There is an existing override. Change it!
  229. @@ -615,7 +615,7 @@ void RenderPass::setModelUniform(RenderModelHandle handle, const RenderUniformEn
  230. else
  231. {
  232. // This is a new override.
  233. - std::tr1::unordered_map <StringId, GLuint>::iterator loci = variableNameToUniformLocation.find(uniform.name);
  234. + std::tr1::unordered_map <StringId, GLuint, StringId::hash>::iterator loci = variableNameToUniformLocation.find(uniform.name);
  235. assert(loci != variableNameToUniformLocation.end()); // variableNameToUniformLocation should have been populated when we initialized.
  236. GLuint loc = loci->second;
  237.  
  238. @@ -636,7 +636,7 @@ void RenderPass::removeModelUniform(RenderModelHandle handle, StringId name)
  239. RenderModel & model = models.get(iter->second);
  240.  
  241. // Find the existing uniform override with this name.
  242. - std::tr1::unordered_map <StringId, keyed_container <RenderUniform>::handle>::iterator existing = model.variableNameToUniformOverride.find(name);
  243. + std::tr1::unordered_map <StringId, keyed_container <RenderUniform>::handle, StringId::hash>::iterator existing = model.variableNameToUniformOverride.find(name);
  244. if (existing != model.variableNameToUniformOverride.end())
  245. {
  246. // There is an existing override. Remove it, then remove it from the mapping.
  247. @@ -654,7 +654,7 @@ void RenderPass::setDefaultTexture(StringId name, const RenderTextureEntry & tex
  248. {
  249. // See if we have a mapping for this name id.
  250. // If we don't that's fine, just ignore the change.
  251. - std::tr1::unordered_map <StringId, GLuint>::const_iterator tuIter = textureNameToTextureUnit.find(name);
  252. + std::tr1::unordered_map <StringId, GLuint, StringId::hash>::const_iterator tuIter = textureNameToTextureUnit.find(name);
  253. if (tuIter != textureNameToTextureUnit.end())
  254. {
  255. GLuint tu = tuIter->second;
  256. @@ -677,7 +677,7 @@ void RenderPass::removeDefaultTexture(StringId name)
  257. {
  258. // See if we have a mapping for this name id.
  259. // If we don't that's fine, just ignore the change.
  260. - std::tr1::unordered_map <StringId, GLuint>::const_iterator tuIter = textureNameToTextureUnit.find(name);
  261. + std::tr1::unordered_map <StringId, GLuint, StringId::hash>::const_iterator tuIter = textureNameToTextureUnit.find(name);
  262. if (tuIter != textureNameToTextureUnit.end())
  263. {
  264. GLuint tu = tuIter->second;
  265. @@ -702,7 +702,7 @@ void RenderPass::removeDefaultTexture(StringId name)
  266.  
  267. bool RenderPass::getDefaultUniform(StringId uniformName, RenderUniform & out)
  268. {
  269. - std::tr1::unordered_map <StringId, GLuint>::const_iterator locIter = variableNameToUniformLocation.find(uniformName);
  270. + std::tr1::unordered_map <StringId, GLuint, StringId::hash>::const_iterator locIter = variableNameToUniformLocation.find(uniformName);
  271. if (locIter != variableNameToUniformLocation.end())
  272. {
  273. GLuint location = locIter->second;
  274. @@ -723,7 +723,7 @@ bool RenderPass::setDefaultUniform(const RenderUniformEntry & uniform)
  275. {
  276. // See if we have a mapping for this name id.
  277. // If we don't that's fine, just ignore the change.
  278. - std::tr1::unordered_map <StringId, GLuint>::const_iterator locIter = variableNameToUniformLocation.find(uniform.name);
  279. + std::tr1::unordered_map <StringId, GLuint, StringId::hash>::const_iterator locIter = variableNameToUniformLocation.find(uniform.name);
  280. if (locIter != variableNameToUniformLocation.end())
  281. {
  282. GLuint location = locIter->second;
  283. @@ -749,7 +749,7 @@ void RenderPass::removeDefaultUniform(StringId name)
  284. {
  285. // See if we have a mapping for this name id.
  286. // If we don't that's fine, just ignore the change.
  287. - std::tr1::unordered_map <StringId, GLuint>::const_iterator locIter = variableNameToUniformLocation.find(name);
  288. + std::tr1::unordered_map <StringId, GLuint, StringId::hash>::const_iterator locIter = variableNameToUniformLocation.find(name);
  289. if (locIter != variableNameToUniformLocation.end())
  290. {
  291. GLuint location = locIter->second;
Advertisement
Add Comment
Please, Sign In to add comment