-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
GS: Add hash based texture cache #5545
Conversation
I tested LCS with the Hash Cache option and the lag spikes when loading "new" parts of the city are completely gone for me. This is at default EE clockspeed and 4x Native |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good a nice speedup in some games and lower GS % overall.
I get a segfault past the initial loading screen on Need for Speed - Hot Persuit 2 on Linux with both OpenGL and Vulkan and both Partial and Full preloading. I've got a Radeon RX 570 on Mesa 21.3.6. Backtrace, if it helps:
PCSX2 is also reporting that it is disabling the cache in Baldur's Gate: Dark Alliance for both full and partial because it is using about a gig of VRAM. I've got 4, so only about 3.5ish available for PCSX2. So maybe I am just running out. Does this check to see how much VRAM is available or does it automatically disable itself past a certain threshold? |
I think 1gb is just a cutoff for the difference between games that are compatible with the system and games that do things that make them incompatible with it (allowing the system to use more vram will just leave more useless images in vram, and won't make things go faster) I can say for sure that Baldur's Gate is incompatible with the system (it suballocates textures and updates small parts of them at a time, so hashing whole textures would just result in them constantly changing and needing to be reuploaded anyways) |
Let me guess, AVX2 build? Should be fixed with the last push. |
Yup, you got it! :) |
I just wanna say this is amazing. Gave me a huge boost with Gran Turismo 4. |
Description of Changes
This PR adds a hash-based cache to the texture cache for sources, as addition to the existing TEX0-key-based-cache.
As the hash cache entries are based on the texture data and not the location in VRAM, it eliminates uploads in games that stream textures to different locations in VRAM across frames (e.g. GTA: SA). Some games like GTA: LCS are an extreme case of this, where texture uploads previously exceeded 1,000 per frame.
Since it's based on the texture data, this has another nice property; we can use them for texture replacements. I have already done a proof-of-concept and it works quite well.
Rationale behind Changes
Making upload heavy GS games faster.
Suggested Testing Steps
There should be no regressions in rendering or performance in the default config. Partial preloading is equivalent to the current preloading setting, and full uses the hash cache. Test this in games with heavy uploads (e.g. SA, LCS) and examine performance.