GS/HW: Optimize GPU CLUT update frequency + convert GS draw count to u64 #13714
+108
−81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Changes
Optimizes the GPU CLUT updating so it only does so when necessary.
Also changed the GS draw count (s_n) to finally be u64 instead of int (max 2,147,483,647, not as hard as you think to reach).
Rationale behind Changes
The GPU CLUT was copying from the target every single draw, even if it was used in the previous draw, which was causing a lot of unnecessary work on games which are quite heavy on the GPU CLUT. This makes sure it only updates if the target changes or the target has been drawn to since the last time it was used.
Updating the GS draw counter to u64 makes it not a reason to fall over after ~3 hours of play time on a heavy game and go massively negative draw counts, screwing everything up, instead you'll have to play for many years, and even then it will just loop back to zero instead of going negative, like it can do right now.
Suggested Testing Steps
Test games that use GPU CLUT and note any performance differences. For the draw count.. idk, not really testable, just smoke test dumps, games, resetting etc.
Did you use AI to help find, test, or implement this issue or feature?
No.
Should improve GPU CLUT speed and stop the GS potentially falling over after 3-4 hours. This makes it so GPU CLUT (inside target) can be used for Dragon Ball Z BT games instead of a CRC hack without any performance loss.