Emu#dreams Forum | Download | RSS | IRC | ADD NEWS | last 7 days | last 31 days | MUSEUM

Dolphin 5.0-6842 [3417][powerzx], 2018-04-02 21:33:10

[Source: https://dolphin-emu.org/download/?ref=btn]

Dolphin Progress Report: February and March 2018

February came and went quietly, especially on the blog. While we do prefer to run a Progress Report every month, we were put into a bit of a bind. February saw a lot of interesting changes - but most of them were setting up for changes that weren`t quite ready to be merged yet. Rather than rushing things or writing a Progress Report about things that would be coming soon, we decided to wait.

Well this Progress Report is no April Fools` joke - a lot of big changes landed! While a lot of what`s important is under the hood, some of what has been finished has major user facing implications as well. If you were sad about missing a Progress Report for February, have no fear, this double report should more than make up for the lengthy delay!

Because so many of the changes rely on one another, we`re going to be jumping around quite a bit between the two months. So hold on tight, and get ready. This is a big one.

Notable Changes
5.0-6259 - Correct Infinity Behavior of A/C Fog Coefficients and 5.0-6335 - Implement Table Based Fog by stenzek
Before we get to any of the big stuff, a few changes hit in early February that may have gone unnoticed. These two bugs and the changes that fixed them are unrelated, so we don`t have the foggiest of ideas why these two entries got mashed together.

5.0-6259 fixes some fog bugs that have existed the better part of forever. In three titles (though no one knew these issues were related...) certain scenes would become blanketed in impenetrable fog. The most commonly reported of the titles was TMNT and My Word Coach. Prince of Persia: Warrior Within also ran into the same bug, but it manifested differently and was only reported earlier this year. What`s the commonality between all of these games? Ubisoft.
Among Dolphin`s developers, Ubisoft titles have become a bit notorious for having strange behaviors that rely on unintended/unknown hardware features. The Smurfs: Dance Party and Red Steel are both Ubisoft games with unique behaviors that we only recently fixed through thorough hardware testing and more in-depth emulation. So as soon as we saw these three Ubisoft games doing something weird, we knew we needed to test the games on console. Stenzek started poking at fog through hardware tests to figure out what could be going on.

So what did the tests reveal? Normally, when a game asks the GPU for fog, it sends 0 for the minimum fog range (as close as possible to the screen), 1 as the maximum fog range (as far as possible from the screen), and inbetween values for anything in the middle. However, these Ubisoft games are using NaNs (not a numbers) to represent the maximum and minimum fog ranges instead. The ArtX GPUs of the GameCube and Wii interpret NaNs into positive infinity or negative infinity, giving the result the game wants. Dolphin was forwarding the NaNs to the host GPU unaltered, but OpenGL and Vulkan don`t support NaNs and flushed them to 0 - the closest fog range. D3D handles NaNs correctly, rather than interpreting them to ┬▒infinity, leading to an equation that always results in the nearest fog range as well.

Even after he discovered what was going on, Stenzek still had the task of trying to find a logical way to introduce this case to Dolphin`s fog formula. Unfortunately, he couldn`t figure out a way and decided to special case it. So now, instead of giving incorrect fog, Dolphin will test for this particular case and intercept NaNs so that Dolphin can give the expected output to the host GPU. With this in place, the afflicted titles finally render correctly.
While he was doing hardware tests for one fog issue, Stenzek got roped into fixing up another minor issue in the area. Fortune Street has had quite a few interesting graphical issues in Dolphin over the years that have perplexed developers. One particular issue that was solved in the software renderer but not the hardware renderers was the table based fog mode the game used for the Memory Match mini-game.
In this case, he didn`t even need to do hardware tests! All he had to do was port over the software renderer implementation to the hardware backends. With this, all of Fortune Street`s known graphical issues are finally fixed.