mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 13:31:27 +12:00
rsx/util: Add simple consistent hash function
rsx/vk/shaders_cache: Move vp control mask to dynamic state rsx/vk/gl: adds a shader cache for GL. Also Separates pipeline storage for each backend rsx: Add more texture state variables to the cache
This commit is contained in:
parent
c7dca1dbef
commit
00c6a589a5
13 changed files with 150 additions and 66 deletions
27
Utilities/hash.h
Normal file
27
Utilities/hash.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
namespace rpcs3
|
||||
{
|
||||
template<typename T>
|
||||
static size_t hash_base(T value)
|
||||
{
|
||||
return static_cast<size_t>(value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static size_t hash_struct(const T& value)
|
||||
{
|
||||
// FNV 64-bit
|
||||
size_t result = 14695981039346656037ull;
|
||||
const unsigned char *bytes = reinterpret_cast<const unsigned char*>(&value);
|
||||
|
||||
for (size_t n = 0; n < sizeof(T); ++n)
|
||||
{
|
||||
result ^= bytes[n];
|
||||
result *= 1099511628211ull;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue