On Mon Apr 17 19:36:09 2023 +0000, Axel Davy wrote:
Hi, To give a bit of background, the motivation for the development of this test comes from a nine bug in a game with fog, despite nine getting good results in wine tests. While investigating the bug, I realized that I had misunderstood the documentation, and possibly the others before me as well, as I think neither nine, nor wined3d, nor dxvk have completely correct formula here. Here is the patch for nine, and the lengthy explanation in the commit message: https://gitlab.freedesktop.org/axeldavy/mesa/-/commit/b337b0d0f89112266669ee... Basically wine tests use an orthogonal projection matrix, and the case of the non-orthogonal projection matrix was not studied enough. This merge request fills the gap. The tests show than when a non-orthogonal projection matrix is set, w is used for fog not z (wfog), no matter what the shaders are. Depthbias, etc do not affect w. In many places where w should be used, using z doesn't give something that looks bad because in quite often the range of z and w is similar, and so the fog formula gives close results. Still that's not the correct output for someone who cares about accuracy. The odepth test is to know whether zfog (orthogonal projection matrix) is impacted by writing odepth. This is due to the r300/500 hardware manual showing there is fog named registers which tell whether to pick the depth written by the shader or the depth outputted by the rasterizer. It seems that odepth doesn't affect in practice though, but it's good to have it tested.
Thanks for the explanation, that makes it easier to follow what's going on. I got distracted by updating my hacky visual studio build setup to work with current Wine code, so I didn't test this on my hardware yet.
What game is broken by this? I guess we'll have to fix our shaders too, and are probably out of luck on HW with only fixed function opengl (not that we care particularly much these days any more). (Plus, when a future Windows version / GPU / driver breaks the test it helps to have a comment explaining why the correct behavior matters)