GS/HW: Support for integer depth.#13854
Conversation
|
Fixes z-fighting in the following games without using the Limit Depth to 24 bits hack: Harry Potter and the Goblet of FireIt no longer breaks the graphics in this cutscene (see #13805 (comment)): |
|
Does this include the recent zfighting fixes that are in master? If it does this breaks those, with a couple of games i tested it went back to big zfighting just like it was before zfighting recent fixes were merged. gsdump |
In theory there should be no difference between mode 1 and 2 so this might be a bug. Would it be possible to have a dump showing this?
Yes, there was a rebase error with Z floor in VK that is hopefully fixed on the last push. |
Fixed in last push 👍 |
a591493 to
5dbf5c3
Compare
80c7e4d to
c5c21c3
Compare
4284ea0 to
3bcdc33
Compare
3bcdc33 to
ba6a0de
Compare
a2bb262 to
0a9d016
Compare
0a9d016 to
7dadda1
Compare
57ed17b to
fb4a262
Compare
bbe45f3 to
b55707b
Compare
|
Last push incorporates a simpler and more performant process for interpolating 32 bit integer values on the GPU, given by @TellowKrinkle. It also adds an initial port to DX11 and GL. Changes have not been thoroughly tested and may have bugs. |










Status: this is a WIP for early testing. There are several performance and code cleanup issues to be addressed. Committed on top of ROV, but has not been fully tested.
Description of Changes
Adds support for integer depth format to DX12/VK/GL/DX11.
Procedure for interpolating 32 bit Z values was given by @TellowKrinkle:
This should work as long as each triangle's Z range fits in 24 bits (which appears to be the case in all GS dumps examined so far).
Rationale behind Changes
Makes depth accuracy about the same as SW when the full 32 bit range is used non-trivially (i.e., upper bits of depth take multiple values). I don't know of many cases where this is actually needed, so this is more of a "nice to have" feature. It comes at a significant performance cost, so a less expensive fix is preferable (Z floor and/or limit 24 bit setting) unless absolutely required.
Draws with integer depth will usually require full barriers since we need to read/write the buffer for depth testing. This might be impractical in many cases, though it could be more usable when combined with ROVs.
Suggested Testing Steps
Use the following setting in the INI:
The values are:
HWZIntegerMode = 0: Disabled.HWZIntegerMode = 1: Enabled. Use integer depth when the Z values go outside the 24 bit range and switch back to regular depth if the range goes back.HWZIntegerMode = 2: Always. Always use integer depth. This is more more testing than for practical use.Then use VK and/or DX12.
Example
The only case I know where 32 bit Z is used non-trivially (thanks @refractionpcsx2 ):
Shox_SLUS-20533_20260111064920.gs.xz (see the signs in the distance and sides of the road)
Master VK

Master SW

PR VK

Did you use AI to help find, test, or implement this issue or feature?
Yes, to get help with the API usage/shader programming and info about extensions. Also, for reviewing the 64 bit arithmetic code.