GSDX user hack for incorrect sprite UV rounding #3624
Closed
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.
GSDX user hack for incorrect sprite UV rounding in game Cho Aniki: Seinaru Protein Densetsu (and possibly others?).
This PR is in reference to the sprite issues at #3552. The problem was that sprites were being drawn whose UV coords at the right-most/bottom-most pixels were exactly on the boundary of 2 texels. The texel on the top/left of the boundary was the correct one but it seems OpenGl, DirectX, and the SW renderer all round up (to the bottom/right) resulting in incorrect texels. The hack here is basically to detect cases where:
If this happens we just subtract 1/16 from the input U (or V) so that they will be rounded down instead of up in the final texturing.
So far this is only tested to work on a single GS dump of a single game referenced above on the issue. If anyone else knows of similar issues that I can test out (or even better has the dump) it would be greatly appreciated.
This hack affect both the HW renderer and the SW renderer because it was inserted far enough up the pipeline. There might be a more accurate fix for just the SW renderer but TBH I haven't messed much with the SW renderer and I don't know the true behavior of the GS is to know what is the most accurate way to do things (can anyone reading this run tests on an actual PS2?).
In the GUI I had to put this under "HW Hacks" because there is nowhere else for hacks that affect both HW/SW. If anyone thinks this should only be a HW hack only please let me know.
There are a few other hacks that deal with sprite offset issues but it seems as if they are only meant for upscaling issues (I also tried to force enable them for native res and they did not fix this issue). The code for this is actually based on another upscaling hack (RoundSpriteOffset) but they do slightly different things (in particular this hack only affects the bottom/right boundaries of the sprite instead of all boundaries).
Any comments/criticism would be very much welcome and appreciated. Thanks!