-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
WIP: Shader Cache #3160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
WIP: Shader Cache #3160
Changes from 38 commits
16e981c
c188b7c
08cd231
cbeaf46
2aee032
09f844a
bde3873
24f17f5
b32ba29
3eb8000
a500b98
3e56133
b9b75cf
bcc65e7
6c8a792
019172f
2a34708
3600a92
84ee3f9
c04f04e
cc911b3
fa0505a
742b3ce
dd0365f
ddb11fe
4d48276
8a35cc9
e4f1914
bee3f10
321ed8b
06cae18
f9f75ef
408bd35
107c4ac
85b42b6
469c8fc
1e71ac8
a4ae1de
3346c5a
438e1cd
9195f59
f9e199e
e418249
292b287
d4432c7
56e98b3
1c8c009
b1db45a
4a3bbb3
0da10ee
da81833
e522918
f456df7
95a81a1
c171657
99cad6e
4909818
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
|
||
#include <iostream> | ||
#include <vector> | ||
#include "common/logging/log.h" | ||
|
||
using u32 = uint32_t; | ||
|
||
template <typename T> | ||
void writeBin(std::ostream& os, const T& v) { | ||
LOG_INFO(Render_Recompiler, "BinaryHelper: Pos: {}", static_cast<int64_t>(os.tellp())); | ||
os.write(reinterpret_cast<const char*>(&v), sizeof(T)); | ||
} | ||
|
||
template <typename T> | ||
void readBin(std::istream& is, T& v) { | ||
Fire-Cube marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (is.eof()) { | ||
LOG_WARNING(Render_Recompiler, "BinaryHelper: EOF"); | ||
Fire-Cube marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
is.read(reinterpret_cast<char*>(&v), sizeof(T)); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,7 @@ | |
|
||
#include "common/types.h" | ||
|
||
[[nodiscard]] inline u64 HashCombine(const u64 seed, const u64 hash) { | ||
return seed ^ (hash + 0x9e3779b9 + (seed << 12) + (seed >> 4)); | ||
} | ||
|
||
[[nodiscard]] inline u32 HashCombine(const u32 seed, const u32 hash) { | ||
return seed ^ (hash + 0x9e3779b9 + (seed << 6) + (seed >> 2)); | ||
template <typename T, typename U> | ||
T HashCombine(const T& seed, const U& value) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Caution. You can see how the 32 but and 64 bit versions of the hash are different (see the bit shifts). I don't know if this affects the quality of the hash. You should check this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’ve now adjusted it so that it always shifts like the 64-bit version that shouldn’t really cause any issues. |
||
return seed ^ (static_cast<T>(value) + 0x9e3779b9 + (seed << 6) + (seed >> 2)); | ||
} |
Uh oh!
There was an error while loading. Please reload this page.