-
-
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-HW: Use integers for depth conversion shaders #5518
GS-HW: Use integers for depth conversion shaders #5518
Conversation
DBZ BT3 fixed as noted Master: PR: Toro to Kyuujitsu as noted in #4674 fixed in Vulkan. Master: PR: |
It's a homebrew demo called Aura for Laura |
I don't see how precision should be changed at all by multiplying by a power of 2 (like Are you sure the accuracy improvement here isn't actually due to the changes to the depth ↔︎ color conversion functions? |
Okay I tested our current algorithm, and while I expected it to break on weird edge cases, I didn't expect it to break on literally every nonzero integer Test and results here (Yes, it's in Metal. Sorry. Results are included so you don't need to run it.)
Edit: On an Nvidia and Intel GPU, the values were instead slightly too high for 192/255, at 0x3f40c0c2 instead of 3f40c0c1. Note that this is using the So we should definitely test fixing the conversion functions before we attempt unrestricted depth, as I don't think that's the issue |
Refraction and I actually tested using integers for converting the incoming colour values and found that it wasn't sufficient for DTZ BT3 (at least with the conversions it uses; rgba8->float24). So while it does sound like there's an issue with the float-based conversion, I was trying to leave that path unchanged in this PR. |
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.
Forgot to change the dx11 equivalent shaders in tfx.fx.
Also fixes #4051 |
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.
Depth seems broken on dx11 on dbz bt3.
Fixes z-fighting in reflections in DBZ BT3, maybe others?
Sadly it doesn't fix Sonic Heroes massive Z fighting issue with distant buildings, here is the multiframe dump: https://drive.google.com/file/d/1uYlLEXnY6BFdVy21RFA3_38Py4hlr_Uf/view?usp=sharing Edit: However this PR does fix The sims 2. |
@gilderoylockhart01 yes this PR doesn't aim to fix MOST z-fighting problems, it's very specific ones, usually localised (so they appear as thin lines rather than missing polys). |
I made a note of that in the OP. This only affects depth buffer round trips. |
@gilderoylockhart01 what bug in The Sims 2? Have you got comparison shots? |
Description of Changes
This improves the precision when reinterpreting textures to the depth buffer, reducing round-trip error which causes depth fighting in the games listed below.
Sadly, it doesn't improve precision in rendering alone (e.g. Quake 3), since that requires more than 23 bits of precision. For what it's worth, using unrestricted depth range and reinterpreting the unsigned 32-bit depth value as a float does fix Quake's rendering, but this will cause problems at the upper end of the range once it hits NaNs/inf, and requires slow depth/disables early-Z (writing gl_FragDepth).
Rationale behind Changes
Fixing bugs.
Fixes #4051
Fixes #4674
Fixes #2219
Suggested Testing Steps
Test games with z-fighting, make sure there's no regressions in others which use format conversions.