summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorbaby.lueshi <baby.lueshi@gmail.com>2011-02-04 22:51:17 +0000
committerbaby.lueshi <baby.lueshi@gmail.com>2011-02-04 22:51:17 +0000
commitcd9e6a8d23a830d45f6f6b39c5ced27bb568dcfc (patch)
treef34709784d35ed939a41c5d4f5ec6160a876b385 /Source/Core/Common
parentf7d757b46eaa271e7f58e1c61df4fb34b5ff47f9 (diff)
Change the recent speedup to the hashing function to fall back to the old version for custom textures.
Re-fixed custom textures higher than 1024x1024. (It must have accidentally got reverted somewhere during the video plugin merge) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7064 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Src/Hash.cpp9
-rw-r--r--Source/Core/Common/Src/Hash.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/Source/Core/Common/Src/Hash.cpp b/Source/Core/Common/Src/Hash.cpp
index 6741ec2f14..f7e6dba6f5 100644
--- a/Source/Core/Common/Src/Hash.cpp
+++ b/Source/Core/Common/Src/Hash.cpp
@@ -133,18 +133,23 @@ u64 GetCRC32(const u8 *src, int len, u32 samples)
#endif
}
-u64 GetHash64(const u8 *src, int len, u32 samples)
+u64 GetHash64(const u8 *src, int len, u32 samples, bool legacy)
{
const u64 m = 0xc6a4a7935bd1e995;
u64 h = len * m;
#if _M_SSE >= 0x402
- if (cpu_info.bSSE4_2)
+ if (cpu_info.bSSE4_2 && !legacy)
{
h = GetCRC32(src, len, samples);
}
else
#endif
+ /* NOTE: This hash function is used for custom texture loading/dumping, so
+ it should not be changed, which would require all custom textures to be
+ recalculated for their new hash values. If the hashing function is
+ changed, make sure this one is still used when the legacy parameter is
+ true. */
{
const int r = 47;
u32 Step = (len / 8);
diff --git a/Source/Core/Common/Src/Hash.h b/Source/Core/Common/Src/Hash.h
index 5b71444f32..fb5a3b1127 100644
--- a/Source/Core/Common/Src/Hash.h
+++ b/Source/Core/Common/Src/Hash.h
@@ -25,5 +25,5 @@ u32 HashAdler32(const u8* data, size_t len); // Fairly accurate, slightl
u32 HashFNV(const u8* ptr, int length); // Another fast and decent hash
u32 HashEctor(const u8* ptr, int length); // JUNK. DO NOT USE FOR NEW THINGS
u64 GetCRC32(const u8 *src, int len, u32 samples); // SSE4.2 version of CRC32
-u64 GetHash64(const u8 *src, int len, u32 samples);
+u64 GetHash64(const u8 *src, int len, u32 samples, bool legacy = false);
#endif // _HASH_H_