Browse Source

Aliases hash32 and hash64

1vanK 3 years ago
parent
commit
5875a912db
39 changed files with 178 additions and 162 deletions
  1. 6 0
      Source/Tools/BindingGenerator/ASUtils.cpp
  2. 1 1
      Source/Tools/BindingGenerator/XmlAnalyzer.cpp
  3. 2 2
      Source/Tools/PackageTool/PackageTool.cpp
  4. 4 4
      Source/Urho3D/AngelScript/Generated_Classes.cpp
  5. 4 4
      Source/Urho3D/AngelScript/Generated_GlobalFunctions.cpp
  6. 34 34
      Source/Urho3D/AngelScript/Generated_Members.h
  7. 2 0
      Source/Urho3D/AngelScript/Manual.cpp
  8. 13 9
      Source/Urho3D/Base/PrimitiveTypes.h
  9. 2 2
      Source/Urho3D/Container/ArrayPtr.h
  10. 3 1
      Source/Urho3D/Container/FlagSet.h
  11. 28 26
      Source/Urho3D/Container/Hash.h
  12. 19 19
      Source/Urho3D/Container/HashMap.h
  13. 1 1
      Source/Urho3D/Container/Pair.h
  14. 2 2
      Source/Urho3D/Container/Ptr.h
  15. 2 2
      Source/Urho3D/Container/Str.h
  16. 2 2
      Source/Urho3D/Graphics/Batch.cpp
  17. 1 1
      Source/Urho3D/Graphics/Batch.h
  18. 1 1
      Source/Urho3D/Graphics/Graphics.h
  19. 2 2
      Source/Urho3D/Graphics/Material.h
  20. 5 5
      Source/Urho3D/Graphics/Renderer.cpp
  21. 2 2
      Source/Urho3D/Graphics/Renderer.h
  22. 2 2
      Source/Urho3D/Graphics/View.cpp
  23. 4 4
      Source/Urho3D/Graphics/View.h
  24. 2 2
      Source/Urho3D/GraphicsAPI/Direct3D11/D3D11Graphics.cpp
  25. 2 2
      Source/Urho3D/GraphicsAPI/Direct3D11/D3D11GraphicsImpl.h
  26. 4 4
      Source/Urho3D/GraphicsAPI/OpenGL/OGLGraphics.cpp
  27. 1 1
      Source/Urho3D/GraphicsAPI/OpenGL/OGLGraphicsImpl.h
  28. 2 2
      Source/Urho3D/GraphicsAPI/ShaderVariation.h
  29. 2 2
      Source/Urho3D/GraphicsAPI/VertexBuffer.h
  30. 1 1
      Source/Urho3D/IO/Deserializer.cpp
  31. 1 1
      Source/Urho3D/IO/Deserializer.h
  32. 2 2
      Source/Urho3D/IO/File.h
  33. 5 3
      Source/Urho3D/IO/PackageFile.h
  34. 1 1
      Source/Urho3D/Math/Color.h
  35. 1 1
      Source/Urho3D/Math/MathDefs.h
  36. 6 8
      Source/Urho3D/Math/StringHash.h
  37. 1 1
      Source/Urho3D/Math/Vector2.h
  38. 3 3
      Source/Urho3D/Math/Vector3.h
  39. 2 2
      Source/Urho3D/Math/Vector4.h

+ 6 - 0
Source/Tools/BindingGenerator/ASUtils.cpp

@@ -70,6 +70,12 @@ string CppPrimitiveTypeToAS(const string& cppType)
     if (cppType == "c32")
         return "c32";
 
+    if (cppType == "hash32")
+        return "hash32";
+
+    if (cppType == "hash64")
+        return "hash64";
+
     throw Exception(cppType + " not a primitive type");
 }
 

+ 1 - 1
Source/Tools/BindingGenerator/XmlAnalyzer.cpp

@@ -947,7 +947,7 @@ bool ClassAnalyzer::AllInts() const
             continue;
 
         string type = field.GetType().ToString();
-        if (type != "int" && type != "unsigned")
+        if (type != "int" && type != "unsigned" && type != "hash32")
             return false;
     }
 

+ 2 - 2
Source/Tools/PackageTool/PackageTool.cpp

@@ -26,14 +26,14 @@ struct FileEntry
     String name_;
     unsigned offset_{};
     unsigned size_{};
-    unsigned checksum_{};
+    hash32 checksum_{};
 };
 
 SharedPtr<Context> context_(new Context());
 SharedPtr<FileSystem> fileSystem_(new FileSystem(context_));
 String basePath_;
 Vector<FileEntry> entries_;
-unsigned checksum_ = 0;
+hash32 checksum_ = 0;
 bool compress_ = false;
 bool quiet_ = false;
 unsigned blockSize_ = COMPRESSED_BLOCK_SIZE;

+ 4 - 4
Source/Urho3D/AngelScript/Generated_Classes.cpp

@@ -2529,8 +2529,8 @@ static void StringHash__StringHash_constspStringHashamp(StringHash* _ptr, const
     new(_ptr) StringHash(rhs);
 }
 
-// explicit constexpr StringHash::StringHash(unsigned value) noexcept
-static void StringHash_constexpr_StringHash_unsigned(StringHash* _ptr, unsigned value)
+// explicit constexpr StringHash::StringHash(hash32 value) noexcept
+static void StringHash_constexpr_StringHash_hash32(StringHash* _ptr, hash32 value)
 {
     new(_ptr) StringHash(value);
 }
@@ -2549,8 +2549,8 @@ static void Register_StringHash(asIScriptEngine* engine)
 
     // StringHash::StringHash(const StringHash& rhs) noexcept = default
     engine->RegisterObjectBehaviour("StringHash", asBEHAVE_CONSTRUCT, "void f(const StringHash&in)", AS_FUNCTION_OBJFIRST(StringHash__StringHash_constspStringHashamp), AS_CALL_CDECL_OBJFIRST);
-    // explicit constexpr StringHash::StringHash(unsigned value) noexcept
-    engine->RegisterObjectBehaviour("StringHash", asBEHAVE_CONSTRUCT, "void f(uint)", AS_FUNCTION_OBJFIRST(StringHash_constexpr_StringHash_unsigned), AS_CALL_CDECL_OBJFIRST);
+    // explicit constexpr StringHash::StringHash(hash32 value) noexcept
+    engine->RegisterObjectBehaviour("StringHash", asBEHAVE_CONSTRUCT, "void f(hash32)", AS_FUNCTION_OBJFIRST(StringHash_constexpr_StringHash_hash32), AS_CALL_CDECL_OBJFIRST);
     // StringHash::StringHash(const String& str) noexcept
     engine->RegisterObjectBehaviour("StringHash", asBEHAVE_CONSTRUCT, "void f(const String&in)", AS_FUNCTION_OBJFIRST(StringHash__StringHash_constspStringamp), AS_CALL_CDECL_OBJFIRST);
 

+ 4 - 4
Source/Urho3D/AngelScript/Generated_GlobalFunctions.cpp

@@ -69,8 +69,8 @@ void ASRegisterGeneratedGlobalFunctions(asIScriptEngine* engine)
     // unsigned ClosestPowerOfTwo(unsigned value) | File: ../Math/MathDefs.h
     engine->RegisterGlobalFunction("uint ClosestPowerOfTwo(uint)", AS_FUNCTIONPR(ClosestPowerOfTwo, (unsigned), unsigned), AS_CALL_CDECL);
 
-    // void CombineHash(unsigned& result, unsigned hash) | File: ../Container/Hash.h
-    engine->RegisterGlobalFunction("void CombineHash(uint&, uint)", AS_FUNCTIONPR(CombineHash, (unsigned&, unsigned), void), AS_CALL_CDECL);
+    // void CombineHash(hash32& result, hash32 hash) | File: ../Container/Hash.h
+    engine->RegisterGlobalFunction("void CombineHash(hash32&, hash32)", AS_FUNCTIONPR(CombineHash, (hash32&, hash32), void), AS_CALL_CDECL);
 
     // bool CompareDrawables(Drawable* lhs, Drawable* rhs) | File: ../Graphics/Drawable.h
     engine->RegisterGlobalFunction("bool CompareDrawables(Drawable@+, Drawable@+)", AS_FUNCTIONPR(CompareDrawables, (Drawable*, Drawable*), bool), AS_CALL_CDECL);
@@ -369,8 +369,8 @@ void ASRegisterGeneratedGlobalFunctions(asIScriptEngine* engine)
     // template <class T> int RoundToInt(T x) | File: ../Math/MathDefs.h
     engine->RegisterGlobalFunction("int RoundToInt(float)", AS_FUNCTIONPR(RoundToInt, (float), int), AS_CALL_CDECL);
 
-    // constexpr unsigned SDBMHash(unsigned hash, unsigned char c) | File: ../Math/MathDefs.h
-    engine->RegisterGlobalFunction("uint SDBMHash(uint, uint8)", AS_FUNCTIONPR(SDBMHash, (unsigned, unsigned char), unsigned), AS_CALL_CDECL);
+    // constexpr hash32 SDBMHash(hash32 hash, u8 c) | File: ../Math/MathDefs.h
+    engine->RegisterGlobalFunction("hash32 SDBMHash(hash32, uint8)", AS_FUNCTIONPR(SDBMHash, (hash32, u8), hash32), AS_CALL_CDECL);
 
     // void SetMiniDumpDir(const String& pathName) | File: ../Core/ProcessUtils.h
     engine->RegisterGlobalFunction("void SetMiniDumpDir(const String&in)", AS_FUNCTIONPR(SetMiniDumpDir, (const String&), void), AS_CALL_CDECL);

+ 34 - 34
Source/Urho3D/AngelScript/Generated_Members.h

@@ -358,8 +358,8 @@ template <class T> void RegisterMembers_BatchGroupKey(asIScriptEngine* engine, c
     // bool BatchGroupKey::operator ==(const BatchGroupKey& rhs) const
     engine->RegisterObjectMethod(className, "bool opEquals(const BatchGroupKey&in) const", AS_METHODPR(T, operator==, (const BatchGroupKey&) const, bool), AS_CALL_THISCALL);
 
-    // unsigned BatchGroupKey::ToHash() const
-    engine->RegisterObjectMethod(className, "uint ToHash() const", AS_METHODPR(T, ToHash, () const, unsigned), AS_CALL_THISCALL);
+    // hash32 BatchGroupKey::ToHash() const
+    engine->RegisterObjectMethod(className, "hash32 ToHash() const", AS_METHODPR(T, ToHash, () const, hash32), AS_CALL_THISCALL);
 
     // Zone* BatchGroupKey::zone_
     // Not registered because pointer
@@ -920,8 +920,8 @@ template <class T> void RegisterMembers_Color(asIScriptEngine* engine, const cha
     // float Color::SumRGB() const
     engine->RegisterObjectMethod(className, "float SumRGB() const", AS_METHODPR(T, SumRGB, () const, float), AS_CALL_THISCALL);
 
-    // unsigned Color::ToHash() const
-    engine->RegisterObjectMethod(className, "uint ToHash() const", AS_METHODPR(T, ToHash, () const, unsigned), AS_CALL_THISCALL);
+    // hash32 Color::ToHash() const
+    engine->RegisterObjectMethod(className, "hash32 ToHash() const", AS_METHODPR(T, ToHash, () const, hash32), AS_CALL_THISCALL);
 
     // Vector3 Color::ToHSL() const
     engine->RegisterObjectMethod(className, "Vector3 ToHSL() const", AS_METHODPR(T, ToHSL, () const, Vector3), AS_CALL_THISCALL);
@@ -1314,9 +1314,9 @@ template <class T> void RegisterMembers_Deserializer(asIScriptEngine* engine, co
     // VariantVector Deserializer::ReadVariantVector()
     // Error: type "VariantVector" can not automatically bind
 
-    // virtual unsigned Deserializer::GetChecksum()
-    engine->RegisterObjectMethod(className, "uint GetChecksum()", AS_METHODPR(T, GetChecksum, (), unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_checksum()", AS_METHODPR(T, GetChecksum, (), unsigned), AS_CALL_THISCALL);
+    // virtual hash32 Deserializer::GetChecksum()
+    engine->RegisterObjectMethod(className, "hash32 GetChecksum()", AS_METHODPR(T, GetChecksum, (), hash32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "hash32 get_checksum()", AS_METHODPR(T, GetChecksum, (), hash32), AS_CALL_THISCALL);
 
     // virtual const String& Deserializer::GetName() const
     engine->RegisterObjectMethod(className, "const String& GetName() const", AS_METHODPR(T, GetName, () const, const String&), AS_CALL_THISCALL);
@@ -2014,8 +2014,8 @@ template <class T> void RegisterMembers_IntVector2(asIScriptEngine* engine, cons
     // bool IntVector2::operator ==(const IntVector2& rhs) const
     engine->RegisterObjectMethod(className, "bool opEquals(const IntVector2&in) const", AS_METHODPR(T, operator==, (const IntVector2&) const, bool), AS_CALL_THISCALL);
 
-    // unsigned IntVector2::ToHash() const
-    engine->RegisterObjectMethod(className, "uint ToHash() const", AS_METHODPR(T, ToHash, () const, unsigned), AS_CALL_THISCALL);
+    // hash32 IntVector2::ToHash() const
+    engine->RegisterObjectMethod(className, "hash32 ToHash() const", AS_METHODPR(T, ToHash, () const, hash32), AS_CALL_THISCALL);
 
     // String IntVector2::ToString() const
     engine->RegisterObjectMethod(className, "String ToString() const", AS_METHODPR(T, ToString, () const, String), AS_CALL_THISCALL);
@@ -2105,8 +2105,8 @@ template <class T> void RegisterMembers_IntVector3(asIScriptEngine* engine, cons
     // bool IntVector3::operator ==(const IntVector3& rhs) const
     engine->RegisterObjectMethod(className, "bool opEquals(const IntVector3&in) const", AS_METHODPR(T, operator==, (const IntVector3&) const, bool), AS_CALL_THISCALL);
 
-    // unsigned IntVector3::ToHash() const
-    engine->RegisterObjectMethod(className, "uint ToHash() const", AS_METHODPR(T, ToHash, () const, unsigned), AS_CALL_THISCALL);
+    // hash32 IntVector3::ToHash() const
+    engine->RegisterObjectMethod(className, "hash32 ToHash() const", AS_METHODPR(T, ToHash, () const, hash32), AS_CALL_THISCALL);
 
     // String IntVector3::ToString() const
     engine->RegisterObjectMethod(className, "String ToString() const", AS_METHODPR(T, ToString, () const, String), AS_CALL_THISCALL);
@@ -3327,8 +3327,8 @@ template <class T> void RegisterMembers_PackageEntry(asIScriptEngine* engine, co
     // unsigned PackageEntry::size_
     engine->RegisterObjectProperty(className, "uint size", offsetof(T, size_));
 
-    // unsigned PackageEntry::checksum_
-    engine->RegisterObjectProperty(className, "uint checksum", offsetof(T, checksum_));
+    // hash32 PackageEntry::checksum_
+    engine->RegisterObjectProperty(className, "hash32 checksum", offsetof(T, checksum_));
 
     #ifdef REGISTER_MEMBERS_MANUAL_PART_PackageEntry
         REGISTER_MEMBERS_MANUAL_PART_PackageEntry();
@@ -5127,8 +5127,8 @@ template <class T> void RegisterMembers_String(asIScriptEngine* engine, const ch
     // void String::Swap(String& str)
     engine->RegisterObjectMethod(className, "void Swap(String&)", AS_METHODPR(T, Swap, (String&), void), AS_CALL_THISCALL);
 
-    // unsigned String::ToHash() const
-    engine->RegisterObjectMethod(className, "uint ToHash() const", AS_METHODPR(T, ToHash, () const, unsigned), AS_CALL_THISCALL);
+    // hash32 String::ToHash() const
+    engine->RegisterObjectMethod(className, "hash32 ToHash() const", AS_METHODPR(T, ToHash, () const, hash32), AS_CALL_THISCALL);
 
     // String String::ToLower() const
     engine->RegisterObjectMethod(className, "String ToLower() const", AS_METHODPR(T, ToLower, () const, String), AS_CALL_THISCALL);
@@ -5213,20 +5213,20 @@ template <class T> void RegisterMembers_StringHash(asIScriptEngine* engine, cons
     // String StringHash::Reverse() const
     engine->RegisterObjectMethod(className, "String Reverse() const", AS_METHODPR(T, Reverse, () const, String), AS_CALL_THISCALL);
 
-    // unsigned StringHash::ToHash() const
-    engine->RegisterObjectMethod(className, "uint ToHash() const", AS_METHODPR(T, ToHash, () const, unsigned), AS_CALL_THISCALL);
+    // hash32 StringHash::ToHash() const
+    engine->RegisterObjectMethod(className, "hash32 ToHash() const", AS_METHODPR(T, ToHash, () const, hash32), AS_CALL_THISCALL);
 
     // String StringHash::ToString() const
     engine->RegisterObjectMethod(className, "String ToString() const", AS_METHODPR(T, ToString, () const, String), AS_CALL_THISCALL);
 
-    // unsigned StringHash::Value() const
-    engine->RegisterObjectMethod(className, "uint Value() const", AS_METHODPR(T, Value, () const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_value() const", AS_METHODPR(T, Value, () const, unsigned), AS_CALL_THISCALL);
+    // hash32 StringHash::Value() const
+    engine->RegisterObjectMethod(className, "hash32 Value() const", AS_METHODPR(T, Value, () const, hash32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "hash32 get_value() const", AS_METHODPR(T, Value, () const, hash32), AS_CALL_THISCALL);
 
     // bool StringHash::operator <(const StringHash& rhs) const
     engine->RegisterObjectMethod(className, "int opCmp(const StringHash& in) const", AS_FUNCTION_OBJFIRST(StringHash_bool_operatorles_constspStringHashamp<T>), AS_CALL_CDECL_OBJFIRST);
 
-    // static constexpr u32 StringHash::Calculate(const char* str, unsigned hash = 0)
+    // static constexpr hash32 StringHash::Calculate(const char* str, hash32 hash = 0)
     // Error: type "const char*" can not automatically bind
     // static StringHashRegister* StringHash::GetGlobalStringHashRegister()
     // Error: type "StringHashRegister*" can not automatically bind
@@ -6319,8 +6319,8 @@ template <class T> void RegisterMembers_Vector3(asIScriptEngine* engine, const c
     // Vector3 Vector3::ReNormalized(float minLength, float maxLength, const Vector3& defaultValue = Vector3::ZERO, float eps = M_LARGE_EPSILON) const
     engine->RegisterObjectMethod(className, "Vector3 ReNormalized(float, float, const Vector3&in = Vector3::ZERO, float = M_LARGE_EPSILON) const", AS_METHODPR(T, ReNormalized, (float, float, const Vector3&, float) const, Vector3), AS_CALL_THISCALL);
 
-    // unsigned Vector3::ToHash() const
-    engine->RegisterObjectMethod(className, "uint ToHash() const", AS_METHODPR(T, ToHash, () const, unsigned), AS_CALL_THISCALL);
+    // hash32 Vector3::ToHash() const
+    engine->RegisterObjectMethod(className, "hash32 ToHash() const", AS_METHODPR(T, ToHash, () const, hash32), AS_CALL_THISCALL);
 
     // String Vector3::ToString() const
     engine->RegisterObjectMethod(className, "String ToString() const", AS_METHODPR(T, ToString, () const, String), AS_CALL_THISCALL);
@@ -6452,8 +6452,8 @@ template <class T> void RegisterMembers_Vector4(asIScriptEngine* engine, const c
     // float Vector4::ProjectOntoAxis(const Vector3& axis) const
     engine->RegisterObjectMethod(className, "float ProjectOntoAxis(const Vector3&in) const", AS_METHODPR(T, ProjectOntoAxis, (const Vector3&) const, float), AS_CALL_THISCALL);
 
-    // unsigned Vector4::ToHash() const
-    engine->RegisterObjectMethod(className, "uint ToHash() const", AS_METHODPR(T, ToHash, () const, unsigned), AS_CALL_THISCALL);
+    // hash32 Vector4::ToHash() const
+    engine->RegisterObjectMethod(className, "hash32 ToHash() const", AS_METHODPR(T, ToHash, () const, hash32), AS_CALL_THISCALL);
 
     // String Vector4::ToString() const
     engine->RegisterObjectMethod(className, "String ToString() const", AS_METHODPR(T, ToString, () const, String), AS_CALL_THISCALL);
@@ -8634,8 +8634,8 @@ template <class T> void RegisterMembers_ShaderVariation(asIScriptEngine* engine,
     // const String& ShaderVariation::GetDefinesClipPlane()
     engine->RegisterObjectMethod(className, "const String& GetDefinesClipPlane()", AS_METHODPR(T, GetDefinesClipPlane, (), const String&), AS_CALL_THISCALL);
 
-    // unsigned long long ShaderVariation::GetElementHash() const
-    engine->RegisterObjectMethod(className, "uint64 GetElementHash() const", AS_METHODPR(T, GetElementHash, () const, unsigned long long), AS_CALL_THISCALL);
+    // hash64 ShaderVariation::GetElementHash() const
+    engine->RegisterObjectMethod(className, "hash64 GetElementHash() const", AS_METHODPR(T, GetElementHash, () const, hash64), AS_CALL_THISCALL);
 
     // String ShaderVariation::GetFullName() const
     engine->RegisterObjectMethod(className, "String GetFullName() const", AS_METHODPR(T, GetFullName, () const, String), AS_CALL_THISCALL);
@@ -11173,9 +11173,9 @@ template <class T> void RegisterMembers_PackageFile(asIScriptEngine* engine, con
     // bool PackageFile::Exists(const String& fileName) const
     engine->RegisterObjectMethod(className, "bool Exists(const String&in) const", AS_METHODPR(T, Exists, (const String&) const, bool), AS_CALL_THISCALL);
 
-    // unsigned PackageFile::GetChecksum() const
-    engine->RegisterObjectMethod(className, "uint GetChecksum() const", AS_METHODPR(T, GetChecksum, () const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_checksum() const", AS_METHODPR(T, GetChecksum, () const, unsigned), AS_CALL_THISCALL);
+    // hash32 PackageFile::GetChecksum() const
+    engine->RegisterObjectMethod(className, "hash32 GetChecksum() const", AS_METHODPR(T, GetChecksum, () const, hash32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "hash32 get_checksum() const", AS_METHODPR(T, GetChecksum, () const, hash32), AS_CALL_THISCALL);
 
     // const Vector<String> PackageFile::GetEntryNames() const
     engine->RegisterObjectMethod(className, "Array<String>@ GetEntryNames() const", AS_FUNCTION_OBJFIRST(PackageFile_constspVectorlesStringgre_GetEntryNames_void_template<PackageFile>), AS_CALL_CDECL_OBJFIRST);
@@ -12453,8 +12453,8 @@ template <class T> void RegisterMembers_VertexBuffer(asIScriptEngine* engine, co
     // bool VertexBuffer::SetDataRange(const void* data, i32 start, i32 count, bool discard = false)
     // Error: type "const void*" can not automatically bind
 
-    // u64 VertexBuffer::GetBufferHash(i32 streamIndex)
-    engine->RegisterObjectMethod(className, "uint64 GetBufferHash(int)", AS_METHODPR(T, GetBufferHash, (i32), u64), AS_CALL_THISCALL);
+    // hash64 VertexBuffer::GetBufferHash(i32 streamIndex)
+    engine->RegisterObjectMethod(className, "hash64 GetBufferHash(int)", AS_METHODPR(T, GetBufferHash, (i32), hash64), AS_CALL_THISCALL);
 
     // VertexMaskFlags VertexBuffer::GetElementMask() const
     engine->RegisterObjectMethod(className, "VertexMaskFlags GetElementMask() const", AS_METHODPR(T, GetElementMask, () const, VertexMaskFlags), AS_CALL_THISCALL);
@@ -13760,8 +13760,8 @@ template <class T> void RegisterMembers_Material(asIScriptEngine* engine, const
     // WrapMode Material::GetShaderParameterAnimationWrapMode(const String& name) const
     engine->RegisterObjectMethod(className, "WrapMode GetShaderParameterAnimationWrapMode(const String&in) const", AS_METHODPR(T, GetShaderParameterAnimationWrapMode, (const String&) const, WrapMode), AS_CALL_THISCALL);
 
-    // unsigned Material::GetShaderParameterHash() const
-    engine->RegisterObjectMethod(className, "uint GetShaderParameterHash() const", AS_METHODPR(T, GetShaderParameterHash, () const, unsigned), AS_CALL_THISCALL);
+    // hash32 Material::GetShaderParameterHash() const
+    engine->RegisterObjectMethod(className, "hash32 GetShaderParameterHash() const", AS_METHODPR(T, GetShaderParameterHash, () const, hash32), AS_CALL_THISCALL);
 
     // CullMode Material::GetShadowCullMode() const
     engine->RegisterObjectMethod(className, "CullMode GetShadowCullMode() const", AS_METHODPR(T, GetShadowCullMode, () const, CullMode), AS_CALL_THISCALL);

+ 2 - 0
Source/Urho3D/AngelScript/Manual.cpp

@@ -90,6 +90,8 @@ void ASRegisterManualFirst(asIScriptEngine* engine)
 
     engine->RegisterTypedef("SDL_JoystickID", "int");
     engine->RegisterTypedef("c32", "uint");
+    engine->RegisterTypedef("hash32", "uint");
+    engine->RegisterTypedef("hash64", "uint64");
 
     ASRegisterManualFirst_Addons(engine);
     ASRegisterManualFirst_Graphics(engine);

+ 13 - 9
Source/Urho3D/Base/PrimitiveTypes.h

@@ -15,19 +15,23 @@ static_assert(sizeof(long) == 4 || sizeof(long) == 8); // (Win32, Win64, Unix32)
 static_assert(sizeof(long long) == 8);
 
 // https://en.cppreference.com/w/cpp/types/integer
-typedef int8_t   i8;
-typedef uint8_t  u8;
-typedef int16_t  i16;
-typedef uint16_t u16;
-typedef int32_t  i32;
-typedef uint32_t u32;
-typedef int64_t  i64;
-typedef uint64_t u64;
+using i8 = int8_t;
+using u8 = uint8_t;
+using i16 = int16_t;
+using u16 = uint16_t;
+using i32 = int32_t;
+using u32 = uint32_t;
+using i64 = int64_t;
+using u64 = uint64_t;
 
 // Unicode code point (UTF-32 code unit)
 static_assert(sizeof(char32_t) == 4);
-typedef char32_t c32;
+using c32 = char32_t;
 
 // Pointer arithmetics
 static_assert(sizeof(void*) == sizeof(ptrdiff_t));
 static_assert(sizeof(void*) == sizeof(intptr_t));
+
+// Some hash value (checksum for example)
+using hash32 = u32;
+using hash64 = u64;

+ 2 - 2
Source/Urho3D/Container/ArrayPtr.h

@@ -149,7 +149,7 @@ public:
     RefCount* RefCountPtr() const { return refCount_; }
 
     /// Return hash value for HashSet & HashMap.
-    unsigned ToHash() const { return (unsigned)((size_t)ptr_ / sizeof(T)); }
+    hash32 ToHash() const { return (hash32)((size_t)ptr_ / sizeof(T)); }
 
 private:
     /// Prevent direct assignment from a shared array pointer of different type.
@@ -369,7 +369,7 @@ public:
     RefCount* RefCountPtr() const { return refCount_; }
 
     /// Return hash value for HashSet & HashMap.
-    unsigned ToHash() const { return (unsigned)((size_t)ptr_ / sizeof(T)); }
+    hash32 ToHash() const { return (hash32)((size_t)ptr_ / sizeof(T)); }
 
 private:
     /// Prevent direct assignment from a weak array pointer of different type.

+ 3 - 1
Source/Urho3D/Container/FlagSet.h

@@ -3,6 +3,8 @@
 
 #pragma once
 
+#include "../Base/PrimitiveTypes.h"
+
 #include <type_traits>
 
 namespace Urho3D
@@ -275,7 +277,7 @@ public:
     Integer& AsInteger() { return value_; }
 
     /// Return hash value.
-    unsigned ToHash() const { return static_cast<unsigned>(value_); }
+    hash32 ToHash() const { return static_cast<hash32>(value_); }
 
 protected:
     /// Value.

+ 28 - 26
Source/Urho3D/Container/Hash.h

@@ -3,103 +3,105 @@
 
 #pragma once
 
+#include "../Base/PrimitiveTypes.h"
+
 #include <cstddef>
 
 namespace Urho3D
 {
 
 /// Combine hash into result value.
-inline void CombineHash(unsigned& result, unsigned hash)
+inline void CombineHash(hash32& result, hash32 hash)
 {
     result ^= hash + 0x9e3779b9 + (result << 6) + (result >> 2);
 }
 
 /// Pointer hash function.
-template <class T> unsigned MakeHash(T* value)
+template <class T> hash32 MakeHash(T* value)
 {
-    return (unsigned)((size_t)value / sizeof(T));
+    return (hash32)((size_t)value / sizeof(T));
 }
 
 /// Const pointer hash function.
-template <class T> unsigned MakeHash(const T* value)
+template <class T> hash32 MakeHash(const T* value)
 {
-    return (unsigned)((size_t)value / sizeof(T));
+    return (hash32)((size_t)value / sizeof(T));
 }
 
 /// Generic hash function.
-template <class T> unsigned MakeHash(const T& value)
+template <class T> hash32 MakeHash(const T& value)
 {
     return value.ToHash();
 }
 
 /// Void pointer hash function.
-template <> inline unsigned MakeHash(void* value)
+template <> inline hash32 MakeHash(void* value)
 {
-    return (unsigned)(size_t)value;
+    return (hash32)(size_t)value;
 }
 
 /// Const void pointer hash function.
-template <> inline unsigned MakeHash(const void* value)
+template <> inline hash32 MakeHash(const void* value)
 {
-    return (unsigned)(size_t)value;
+    return (hash32)(size_t)value;
 }
 
 /// Long long hash function.
-template <> inline unsigned MakeHash(const long long& value)
+template <> inline hash32 MakeHash(const i64& value)
 {
-    return (unsigned)((value >> 32u) | (value & 0xffffffffu));
+    return (hash32)((value >> 32u) | (value & 0xffffffffu));
 }
 
 /// Unsigned long long hash function.
-template <> inline unsigned MakeHash(const unsigned long long& value)
+template <> inline hash32 MakeHash(const u64& value)
 {
-    return (unsigned)((value >> 32u) | (value & 0xffffffffu));
+    return (hash32)((value >> 32u) | (value & 0xffffffffu));
 }
 
 /// Int hash function.
-template <> inline unsigned MakeHash(const int& value)
+template <> inline hash32 MakeHash(const i32& value)
 {
-    return (unsigned)value;
+    return (hash32)value;
 }
 
 /// Unsigned hash function.
-template <> inline unsigned MakeHash(const unsigned& value)
+template <> inline hash32 MakeHash(const u32& value)
 {
     return value;
 }
 
 /// Short hash function.
-template <> inline unsigned MakeHash(const short& value)
+template <> inline hash32 MakeHash(const i16& value)
 {
-    return (unsigned)value;
+    return (hash32)value;
 }
 
 /// Unsigned short hash function.
-template <> inline unsigned MakeHash(const unsigned short& value)
+template <> inline hash32 MakeHash(const u16& value)
 {
     return value;
 }
 
 /// Char hash function.
-template <> inline unsigned MakeHash(const char& value)
+template <> inline hash32 MakeHash(const char& value)
 {
-    return (unsigned)value;
+    return (hash32)value;
 }
 
 /// Unicode code point hash function.
-template <> inline unsigned MakeHash(const c32& value)
+template <> inline hash32 MakeHash(const c32& value)
 {
-    return (unsigned)value;
+    return (hash32)value;
 }
 
 /// Unsigned char hash function.
-template <> inline unsigned MakeHash(const u8& value)
+template <> inline hash32 MakeHash(const u8& value)
 {
     return value;
 }
 
 /// Signed char hash function.
-template <> inline unsigned MakeHash(const i8& value)
+template <> inline hash32 MakeHash(const i8& value)
 {
     return value;
 }

+ 19 - 19
Source/Urho3D/Container/HashMap.h

@@ -315,7 +315,7 @@ public:
         if (!ptrs_)
             return InsertNode(key, U(), false)->pair_.second_;
 
-        unsigned hashKey = Hash(key);
+        hash32 hashKey = Hash(key);
 
         Node* node = FindNode(key, hashKey);
         return node ? node->pair_.second_ : InsertNode(key, U(), false)->pair_.second_;
@@ -327,7 +327,7 @@ public:
         if (!ptrs_)
             return 0;
 
-        unsigned hashKey = Hash(key);
+        hash32 hashKey = Hash(key);
 
         Node* node = FindNode(key, hashKey);
         return node ? &node->pair_.second_ : 0;
@@ -391,7 +391,7 @@ public:
         if (!ptrs_)
             return false;
 
-        unsigned hashKey = Hash(key);
+        hash32 hashKey = Hash(key);
 
         Node* previous;
         Node* node = FindNode(key, hashKey, previous);
@@ -413,10 +413,10 @@ public:
         if (!ptrs_ || !it.ptr_)
             return End();
 
-        auto* node = static_cast<Node*>(it.ptr_);
+        Node* node = static_cast<Node*>(it.ptr_);
         Node* next = node->Next();
 
-        unsigned hashKey = Hash(node->pair_.first_);
+        hash32 hashKey = Hash(node->pair_.first_);
 
         Node* previous = 0;
         auto* current = static_cast<Node*>(Ptrs()[hashKey]);
@@ -512,7 +512,7 @@ public:
         if (!ptrs_)
             return End();
 
-        unsigned hashKey = Hash(key);
+        hash32 hashKey = Hash(key);
         Node* node = FindNode(key, hashKey);
         if (node)
             return Iterator(node);
@@ -526,7 +526,7 @@ public:
         if (!ptrs_)
             return End();
 
-        unsigned hashKey = Hash(key);
+        hash32 hashKey = Hash(key);
         Node* node = FindNode(key, hashKey);
         if (node)
             return ConstIterator(node);
@@ -540,7 +540,7 @@ public:
         if (!ptrs_)
             return false;
 
-        unsigned hashKey = Hash(key);
+        hash32 hashKey = Hash(key);
         return FindNode(key, hashKey) != 0;
     }
 
@@ -549,7 +549,7 @@ public:
     {
         if (!ptrs_)
             return false;
-        unsigned hashKey = Hash(key);
+        hash32 hashKey = Hash(key);
         Node* node = FindNode(key, hashKey);
         if (node)
         {
@@ -606,9 +606,9 @@ private:
     Node* Tail() const { return static_cast<Node*>(tail_); }
 
     /// Find a node from the buckets. Do not call if the buckets have not been allocated.
-    Node* FindNode(const T& key, unsigned hashKey) const
+    Node* FindNode(const T& key, hash32 hashKey) const
     {
-        auto* node = static_cast<Node*>(Ptrs()[hashKey]);
+        Node* node = static_cast<Node*>(Ptrs()[hashKey]);
         while (node)
         {
             if (node->pair_.first_ == key)
@@ -620,11 +620,11 @@ private:
     }
 
     /// Find a node and the previous node from the buckets. Do not call if the buckets have not been allocated.
-    Node* FindNode(const T& key, unsigned hashKey, Node*& previous) const
+    Node* FindNode(const T& key, hash32 hashKey, Node*& previous) const
     {
         previous = 0;
 
-        auto* node = static_cast<Node*>(Ptrs()[hashKey]);
+        Node* node = static_cast<Node*>(Ptrs()[hashKey]);
         while (node)
         {
             if (node->pair_.first_ == key)
@@ -646,7 +646,7 @@ private:
             Rehash();
         }
 
-        unsigned hashKey = Hash(key);
+        hash32 hashKey = Hash(key);
 
         if (findExisting)
         {
@@ -722,7 +722,7 @@ private:
     /// Reserve a node.
     Node* ReserveNode()
     {
-        auto* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
+        Node* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
         new(newNode) Node();
         return newNode;
     }
@@ -730,7 +730,7 @@ private:
     /// Reserve a node with specified key and value.
     Node* ReserveNode(const T& key, const U& value)
     {
-        auto* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
+        Node* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
         new(newNode) Node(key, value);
         return newNode;
     }
@@ -747,8 +747,8 @@ private:
     {
         for (Iterator i = Begin(); i != End(); ++i)
         {
-            auto* node = static_cast<Node*>(i.ptr_);
-            unsigned hashKey = Hash(i->first_);
+            Node* node = static_cast<Node*>(i.ptr_);
+            hash32 hashKey = Hash(i->first_);
             node->down_ = Ptrs()[hashKey];
             Ptrs()[hashKey] = node;
         }
@@ -758,7 +758,7 @@ private:
     static bool CompareNodes(Node*& lhs, Node*& rhs) { return lhs->pair_.first_ < rhs->pair_.first_; }
 
     /// Compute a hash based on the key and the bucket size.
-    unsigned Hash(const T& key) const { return MakeHash(key) & (NumBuckets() - 1); }
+    hash32 Hash(const T& key) const { return MakeHash(key) & (NumBuckets() - 1); }
 };
 
 template <class T, class U> typename Urho3D::HashMap<T, U>::ConstIterator begin(const Urho3D::HashMap<T, U>& v) { return v.Begin(); }

+ 1 - 1
Source/Urho3D/Container/Pair.h

@@ -49,7 +49,7 @@ public:
     }
 
     /// Return hash value for HashSet & HashMap.
-    unsigned ToHash() const { return (MakeHash(first_) & 0xffff) | (MakeHash(second_) << 16); }
+    hash32 ToHash() const { return (MakeHash(first_) & 0xffff) | (MakeHash(second_) << 16); }
 
     /// First value.
     T first_;

+ 2 - 2
Source/Urho3D/Container/Ptr.h

@@ -198,7 +198,7 @@ public:
     RefCount* RefCountPtr() const { return ptr_ ? ptr_->RefCountPtr() : nullptr; }
 
     /// Return hash value for HashSet & HashMap.
-    unsigned ToHash() const { return (unsigned)((size_t)ptr_ / sizeof(T)); }
+    hash32 ToHash() const { return (hash32)((size_t)ptr_ / sizeof(T)); }
 
 private:
     template <class U> friend class SharedPtr;
@@ -482,7 +482,7 @@ public:
     RefCount* RefCountPtr() const { return refCount_; }
 
     /// Return hash value for HashSet & HashMap.
-    unsigned ToHash() const { return (unsigned)((size_t)ptr_ / sizeof(T)); }
+    hash32 ToHash() const { return (hash32)((size_t)ptr_ / sizeof(T)); }
 
 private:
     template <class U> friend class WeakPtr;

+ 2 - 2
Source/Urho3D/Container/Str.h

@@ -455,9 +455,9 @@ public:
     String SubstringUTF8(i32 pos, i32 length) const;
 
     /// Return hash value for HashSet & HashMap.
-    unsigned ToHash() const
+    hash32 ToHash() const
     {
-        unsigned hash = 0;
+        hash32 hash = 0;
         const char* ptr = GetBuffer();
         while (*ptr)
         {

+ 2 - 2
Source/Urho3D/Graphics/Batch.cpp

@@ -699,9 +699,9 @@ void BatchGroup::Draw(View* view, Camera* camera, bool allowDepthWrite) const
     }
 }
 
-unsigned BatchGroupKey::ToHash() const
+hash32 BatchGroupKey::ToHash() const
 {
-    return (unsigned)((size_t)zone_ / sizeof(Zone) + (size_t)lightQueue_ / sizeof(LightBatchQueue) + (size_t)pass_ / sizeof(Pass) +
+    return (hash32)((size_t)zone_ / sizeof(Zone) + (size_t)lightQueue_ / sizeof(LightBatchQueue) + (size_t)pass_ / sizeof(Pass) +
                       (size_t)material_ / sizeof(Material) + (size_t)geometry_ / sizeof(Geometry)) + renderOrder_;
 }
 

+ 1 - 1
Source/Urho3D/Graphics/Batch.h

@@ -200,7 +200,7 @@ struct BatchGroupKey
     }
 
     /// Return hash value.
-    unsigned ToHash() const;
+    hash32 ToHash() const;
 };
 
 /// Queue that contains both instanced and non-instanced draw calls.

+ 1 - 1
Source/Urho3D/Graphics/Graphics.h

@@ -1097,7 +1097,7 @@ private:
     /// Index buffer in use.
     IndexBuffer* indexBuffer_{};
     /// Current vertex declaration hash.
-    unsigned long long vertexDeclarationHash_{};
+    hash64 vertexDeclarationHash_{};
     /// Current primitive type.
     unsigned primitiveType_{};
     /// Vertex shader in use.

+ 2 - 2
Source/Urho3D/Graphics/Material.h

@@ -266,7 +266,7 @@ public:
     Scene* GetScene() const;
 
     /// Return shader parameter hash value. Used as an optimization to avoid setting shader parameters unnecessarily.
-    unsigned GetShaderParameterHash() const { return shaderParameterHash_; }
+    hash32 GetShaderParameterHash() const { return shaderParameterHash_; }
 
     /// Return name for texture unit.
     static String GetTextureUnitName(TextureUnit unit);
@@ -319,7 +319,7 @@ private:
     /// Last auxiliary view rendered frame number.
     i32 auxViewFrameNumber_{};
     /// Shader parameter hash value.
-    unsigned shaderParameterHash_{};
+    hash32 shaderParameterHash_{};
     /// Alpha-to-coverage flag.
     bool alphaToCoverage_{};
     /// Line antialiasing flag.

+ 5 - 5
Source/Urho3D/Graphics/Renderer.cpp

@@ -993,7 +993,7 @@ Texture* Renderer::GetScreenBuffer(int width, int height, unsigned format, int m
     if (multiSample == 1)
         autoResolve = false;
 
-    auto searchKey = (unsigned long long)format << 32u | multiSample << 24u | width << 12u | height;
+    hash64 searchKey = (hash64)format << 32u | multiSample << 24u | width << 12u | height;
     if (filtered)
         searchKey |= 0x8000000000000000ULL;
     if (srgb)
@@ -1005,7 +1005,7 @@ Texture* Renderer::GetScreenBuffer(int width, int height, unsigned format, int m
 
     // Add persistent key if defined
     if (persistentKey)
-        searchKey += (unsigned long long)persistentKey << 32u;
+        searchKey += (hash64)persistentKey << 32u;
 
     // If new size or format, initialize the allocation stats
     if (screenBuffers_.Find(searchKey) == screenBuffers_.End())
@@ -1524,9 +1524,9 @@ void Renderer::RemoveUnusedBuffers()
         }
     }
 
-    for (HashMap<unsigned long long, Vector<SharedPtr<Texture>>>::Iterator i = screenBuffers_.Begin(); i != screenBuffers_.End();)
+    for (HashMap<hash64, Vector<SharedPtr<Texture>>>::Iterator i = screenBuffers_.Begin(); i != screenBuffers_.End();)
     {
-        HashMap<unsigned long long, Vector<SharedPtr<Texture>>>::Iterator current = i++;
+        HashMap<hash64, Vector<SharedPtr<Texture>>>::Iterator current = i++;
         Vector<SharedPtr<Texture>>& buffers = current->second_;
         for (i32 j = buffers.Size() - 1; j >= 0; --j)
         {
@@ -1554,7 +1554,7 @@ void Renderer::ResetShadowMapAllocations()
 
 void Renderer::ResetScreenBufferAllocations()
 {
-    for (HashMap<unsigned long long, unsigned>::Iterator i = screenBufferAllocations_.Begin(); i != screenBufferAllocations_.End(); ++i)
+    for (HashMap<hash64, unsigned>::Iterator i = screenBufferAllocations_.Begin(); i != screenBufferAllocations_.End(); ++i)
         i->second_ = 0;
 }
 

+ 2 - 2
Source/Urho3D/Graphics/Renderer.h

@@ -561,9 +561,9 @@ private:
     /// Function pointer of shadow map filter.
     ShadowMapFilter shadowMapFilter_{};
     /// Screen buffers by resolution and format.
-    HashMap<unsigned long long, Vector<SharedPtr<Texture>>> screenBuffers_;
+    HashMap<hash64, Vector<SharedPtr<Texture>>> screenBuffers_;
     /// Current screen buffer allocations by resolution and format.
-    HashMap<unsigned long long, unsigned> screenBufferAllocations_;
+    HashMap<hash64, unsigned> screenBufferAllocations_;
     /// Cache for light scissor queries.
     HashMap<Pair<Light*, Camera*>, Rect> lightScissorCache_;
     /// Backbuffer viewports.

+ 2 - 2
Source/Urho3D/Graphics/View.cpp

@@ -1229,8 +1229,8 @@ void View::GetBaseBatches()
                     if (drawableVertexLights.Size())
                     {
                         // Find a vertex light queue. If not found, create new
-                        unsigned long long hash = GetVertexLightQueueHash(drawableVertexLights);
-                        HashMap<unsigned long long, LightBatchQueue>::Iterator i = vertexLightQueues_.Find(hash);
+                        hash64 hash = GetVertexLightQueueHash(drawableVertexLights);
+                        HashMap<hash64, LightBatchQueue>::Iterator i = vertexLightQueues_.Find(hash);
                         if (i == vertexLightQueues_.End())
                         {
                             i = vertexLightQueues_.Insert(MakePair(hash, LightBatchQueue()));

+ 4 - 4
Source/Urho3D/Graphics/View.h

@@ -280,11 +280,11 @@ private:
     }
 
     /// Return hash code for a vertex light queue.
-    unsigned long long GetVertexLightQueueHash(const Vector<Light*>& vertexLights)
+    hash64 GetVertexLightQueueHash(const Vector<Light*>& vertexLights)
     {
-        unsigned long long hash = 0;
+        hash64 hash = 0;
         for (Vector<Light*>::ConstIterator i = vertexLights.Begin(); i != vertexLights.End(); ++i)
-            hash += (unsigned long long)(*i);
+            hash += (hash64)(*i);
         return hash;
     }
 
@@ -392,7 +392,7 @@ private:
     /// Per-pixel light queues.
     Vector<LightBatchQueue> lightQueues_;
     /// Per-vertex light queues.
-    HashMap<unsigned long long, LightBatchQueue> vertexLightQueues_;
+    HashMap<hash64, LightBatchQueue> vertexLightQueues_;
     /// Batch queues by pass index.
     HashMap<unsigned, BatchQueue> batchQueues_;
     /// Index of the GBuffer pass.

+ 2 - 2
Source/Urho3D/GraphicsAPI/Direct3D11/D3D11Graphics.cpp

@@ -1824,7 +1824,7 @@ ConstantBuffer* Graphics::GetOrCreateConstantBuffer_D3D11(ShaderType type, unsig
     GraphicsImpl_D3D11* impl = GetImpl_D3D11();
 
     // Ensure that different shader types and index slots get unique buffers, even if the size is same
-    unsigned key = type | (index << 1) | (size << 4);
+    hash32 key = type | (index << 1) | (size << 4);
     ConstantBufferMap::Iterator i = impl->allConstantBuffers_.Find(key);
     if (i != impl->allConstantBuffers_.End())
         return i->second_.Get();
@@ -2429,7 +2429,7 @@ void Graphics::PrepareDraw_D3D11()
             impl->firstDirtyVB_ = impl->lastDirtyVB_ = M_MAX_UNSIGNED;
         }
 
-        u64 newVertexDeclarationHash = 0;
+        hash64 newVertexDeclarationHash = 0;
         for (i32 i = 0; i < MAX_VERTEX_STREAMS; ++i)
         {
             if (vertexBuffers_[i])

+ 2 - 2
Source/Urho3D/GraphicsAPI/Direct3D11/D3D11GraphicsImpl.h

@@ -20,8 +20,8 @@ namespace Urho3D
 #define URHO3D_LOGD3DERROR(msg, hr) URHO3D_LOGERRORF("%s (HRESULT %x)", msg, (unsigned)hr)
 
 using ShaderProgramMap_D3D11 = HashMap<Pair<ShaderVariation*, ShaderVariation*>, SharedPtr<ShaderProgram_D3D11>>;
-using VertexDeclarationMap_D3D11 = HashMap<unsigned long long, SharedPtr<VertexDeclaration_D3D11>>;
-using ConstantBufferMap = HashMap<unsigned, SharedPtr<ConstantBuffer>>;
+using VertexDeclarationMap_D3D11 = HashMap<hash64, SharedPtr<VertexDeclaration_D3D11>>;
+using ConstantBufferMap = HashMap<hash32, SharedPtr<ConstantBuffer>>;
 
 /// %Graphics implementation. Holds API-specific objects.
 class URHO3D_API GraphicsImpl_D3D11

+ 4 - 4
Source/Urho3D/GraphicsAPI/OpenGL/OGLGraphics.cpp

@@ -2304,7 +2304,7 @@ void Graphics::CleanupRenderSurface_OGL(RenderSurface* surface)
     unsigned currentFBO = impl->boundFBO_;
 
     // Go through all FBOs and clean up the surface from them
-    for (HashMap<unsigned long long, FrameBufferObject>::Iterator i = impl->frameBuffers_.Begin();
+    for (HashMap<hash64, FrameBufferObject>::Iterator i = impl->frameBuffers_.Begin();
          i != impl->frameBuffers_.End(); ++i)
     {
         for (unsigned j = 0; j < MAX_RENDERTARGETS; ++j)
@@ -2921,8 +2921,8 @@ void Graphics::PrepareDraw_OGL()
         else if (depthStencil_)
             format = depthStencil_->GetParentTexture()->GetFormat();
 
-        auto fboKey = (unsigned long long)format << 32u | rtSize.x_ << 16u | rtSize.y_;
-        HashMap<unsigned long long, FrameBufferObject>::Iterator i = impl->frameBuffers_.Find(fboKey);
+        hash64 fboKey = (hash64)format << 32u | rtSize.x_ << 16u | rtSize.y_;
+        HashMap<hash64, FrameBufferObject>::Iterator i = impl->frameBuffers_.Find(fboKey);
         if (i == impl->frameBuffers_.End())
         {
             FrameBufferObject newFbo;
@@ -3179,7 +3179,7 @@ void Graphics::CleanupFramebuffers_OGL()
         impl->boundFBO_ = impl->systemFBO_;
         impl->fboDirty_ = true;
 
-        for (HashMap<unsigned long long, FrameBufferObject>::Iterator i = impl->frameBuffers_.Begin();
+        for (HashMap<hash64, FrameBufferObject>::Iterator i = impl->frameBuffers_.Begin();
              i != impl->frameBuffers_.End(); ++i)
             DeleteFramebuffer_OGL(i->second_.fbo_);
 

+ 1 - 1
Source/Urho3D/GraphicsAPI/OpenGL/OGLGraphicsImpl.h

@@ -116,7 +116,7 @@ private:
     /// Current pixel format.
     int pixelFormat_{};
     /// Map for FBO's per resolution and format.
-    HashMap<unsigned long long, FrameBufferObject> frameBuffers_;
+    HashMap<hash64, FrameBufferObject> frameBuffers_;
     /// OpenGL texture types in use.
     unsigned textureTypes_[MAX_TEXTURE_UNITS]{};
     /// Constant buffer search map.

+ 2 - 2
Source/Urho3D/GraphicsAPI/ShaderVariation.h

@@ -101,7 +101,7 @@ public:
     const HashMap<StringHash, ShaderParameter>& GetParameters() const { return parameters_; }
 
     /// Return vertex element hash.
-    unsigned long long GetElementHash() const { return elementHash_; }
+    hash64 GetElementHash() const { return elementHash_; }
 
     /// Return shader bytecode. Stored persistently on Direct3D11 only.
     const Vector<unsigned char>& GetByteCode() const { return byteCode_; }
@@ -166,7 +166,7 @@ private:
     /// Shader type.
     ShaderType type_;
     /// Vertex element hash for vertex shaders. Zero for pixel shaders. Note that hashing is different than vertex buffers.
-    unsigned long long elementHash_{};
+    hash64 elementHash_{};
     /// Shader parameters.
     HashMap<StringHash, ShaderParameter> parameters_;
     /// Texture unit use flags.

+ 2 - 2
Source/Urho3D/GraphicsAPI/VertexBuffer.h

@@ -115,7 +115,7 @@ public:
     SharedArrayPtr<u8> GetShadowDataShared() const { return shadowData_; }
 
     /// Return buffer hash for building vertex declarations. Used internally.
-    u64 GetBufferHash(i32 streamIndex) { return elementHash_ << (streamIndex * 16); }
+    hash64 GetBufferHash(i32 streamIndex) { return elementHash_ << (streamIndex * 16); }
 
     /// Return element with specified type and semantic from a vertex element list, or null if does not exist.
     static const VertexElement* GetElement(const Vector<VertexElement>& elements, VertexElementType type, VertexElementSemantic semantic, i8 index = 0);
@@ -187,7 +187,7 @@ private:
     /// Vertex elements.
     Vector<VertexElement> elements_;
     /// Vertex element hash.
-    u64 elementHash_{};
+    hash64 elementHash_{};
     /// Vertex element legacy bitmask.
     VertexMaskFlags elementMask_{};
     /// Buffer locking state.

+ 1 - 1
Source/Urho3D/IO/Deserializer.cpp

@@ -36,7 +36,7 @@ const String& Deserializer::GetName() const
     return String::EMPTY;
 }
 
-unsigned Deserializer::GetChecksum()
+hash32 Deserializer::GetChecksum()
 {
     return 0;
 }

+ 1 - 1
Source/Urho3D/IO/Deserializer.h

@@ -31,7 +31,7 @@ public:
     virtual const String& GetName() const;
     /// Return a checksum if applicable.
     /// @property
-    virtual unsigned GetChecksum();
+    virtual hash32 GetChecksum();
     /// Return whether the end of stream has been reached.
     /// @property
     virtual bool IsEof() const { return position_ >= size_; }

+ 2 - 2
Source/Urho3D/IO/File.h

@@ -62,7 +62,7 @@ public:
     i32 Write(const void* data, i32 size) override;
 
     /// Return a checksum of the file contents using the SDBM hash algorithm.
-    unsigned GetChecksum() override;
+    hash32 GetChecksum() override;
 
     /// Open a filesystem file. Return true if successful.
     bool Open(const String& fileName, FileMode mode = FILE_READ);
@@ -115,7 +115,7 @@ private:
     /// Start position within a package file, 0 for regular files.
     unsigned offset_;
     /// Content checksum.
-    unsigned checksum_;
+    hash32 checksum_;
     /// Compression flag.
     bool compressed_;
     /// Synchronization needed before read -flag.

+ 5 - 3
Source/Urho3D/IO/PackageFile.h

@@ -13,10 +13,12 @@ struct PackageEntry
 {
     /// Offset from the beginning.
     unsigned offset_;
+
     /// File size.
     unsigned size_;
+
     /// File checksum.
-    unsigned checksum_;
+    hash32 checksum_;
 };
 
 /// Stores files of a directory tree sequentially for convenient access.
@@ -63,7 +65,7 @@ public:
 
     /// Return checksum of the package file contents.
     /// @property
-    unsigned GetChecksum() const { return checksum_; }
+    hash32 GetChecksum() const { return checksum_; }
 
     /// Return whether the files are compressed.
     /// @property
@@ -84,7 +86,7 @@ private:
     /// Total data size in the package using each entry's actual size if it is a compressed package file.
     unsigned totalDataSize_;
     /// Package file checksum.
-    unsigned checksum_;
+    hash32 checksum_;
     /// Compressed flag.
     bool compressed_;
 };

+ 1 - 1
Source/Urho3D/Math/Color.h

@@ -233,7 +233,7 @@ public:
     unsigned ToUIntArgb() const { return ToUIntMask(ARGB); }
 
     /// Return hash value for HashSet & HashMap.
-    unsigned ToHash() const { return ToUInt(); }
+    hash32 ToHash() const { return ToUInt(); }
 
     /// Red value.
     float r_;

+ 1 - 1
Source/Urho3D/Math/MathDefs.h

@@ -291,7 +291,7 @@ inline i32 CountSetBits(u32 value)
 }
 
 /// Update a hash with the given 8-bit value using the SDBM algorithm.
-inline constexpr unsigned SDBMHash(unsigned hash, unsigned char c) { return c + (hash << 6u) + (hash << 16u) - hash; }
+inline constexpr hash32 SDBMHash(hash32 hash, u8 c) { return c + (hash << 6u) + (hash << 16u) - hash; }
 
 /// Return a random float between 0.0 (inclusive) and 1.0 (exclusive).
 inline float Random() { return Rand() / 32768.0f; }

+ 6 - 8
Source/Urho3D/Math/StringHash.h

@@ -25,7 +25,7 @@ public:
     StringHash(const StringHash& rhs) noexcept = default;
 
     /// Construct with an initial value.
-    constexpr explicit StringHash(unsigned value) noexcept
+    constexpr explicit StringHash(hash32 value) noexcept
         : value_(value)
     {
     }
@@ -78,7 +78,7 @@ public:
 
     /// Return hash value.
     /// @property
-    unsigned Value() const { return value_; }
+    hash32 Value() const { return value_; }
 
     /// Return as string.
     String ToString() const;
@@ -87,18 +87,16 @@ public:
     String Reverse() const;
 
     /// Return hash value for HashSet & HashMap.
-    unsigned ToHash() const { return value_; }
+    hash32 ToHash() const { return value_; }
 
     /// Calculate hash value from a C string.
-    static constexpr u32 Calculate(const char* str, unsigned hash = 0)
+    static constexpr hash32 Calculate(const char* str, hash32 hash = 0)
     {
         if (!str)
             return hash;
 
         while (*str)
-        {
-            hash = SDBMHash(hash, (unsigned char)*str++);
-        }
+            hash = SDBMHash(hash, (u8)*str++);
 
         return hash;
     }
@@ -111,7 +109,7 @@ public:
 
 private:
     /// Hash value.
-    unsigned value_;
+    hash32 value_;
 };
 
 constexpr StringHash operator ""_hash(const char* str, size_t)

+ 1 - 1
Source/Urho3D/Math/Vector2.h

@@ -128,7 +128,7 @@ public:
     String ToString() const;
 
     /// Return hash value for HashSet & HashMap.
-    unsigned ToHash() const { return (unsigned)x_ * 31 + (unsigned)y_; }
+    hash32 ToHash() const { return (hash32)x_ * 31 + (hash32)y_; }
 
     /// Return length.
     float Length() const { return sqrtf((float)(x_ * x_ + y_ * y_)); }

+ 3 - 3
Source/Urho3D/Math/Vector3.h

@@ -131,7 +131,7 @@ public:
     String ToString() const;
 
     /// Return hash value for HashSet & HashMap.
-    unsigned ToHash() const { return (unsigned)x_ * 31 * 31 + (unsigned)y_ * 31 + (unsigned)z_; }
+    hash32 ToHash() const { return (hash32)x_ * 31 * 31 + (hash32)y_ * 31 + (hash32)z_; }
 
     /// Return length.
     float Length() const { return sqrtf((float)(x_ * x_ + y_ * y_ + z_ * z_)); }
@@ -443,9 +443,9 @@ public:
     String ToString() const;
 
     /// Return hash value for HashSet & HashMap.
-    unsigned ToHash() const
+    hash32 ToHash() const
     {
-        unsigned hash = 37;
+        hash32 hash = 37;
         hash = 37 * hash + FloatToRawIntBits(x_);
         hash = 37 * hash + FloatToRawIntBits(y_);
         hash = 37 * hash + FloatToRawIntBits(z_);

+ 2 - 2
Source/Urho3D/Math/Vector4.h

@@ -191,9 +191,9 @@ public:
     String ToString() const;
 
     /// Return hash value for HashSet & HashMap.
-    unsigned ToHash() const
+    hash32 ToHash() const
     {
-        unsigned hash = 37;
+        hash32 hash = 37;
         hash = 37 * hash + FloatToRawIntBits(x_);
         hash = 37 * hash + FloatToRawIntBits(y_);
         hash = 37 * hash + FloatToRawIntBits(z_);