-
Notifications
You must be signed in to change notification settings - Fork 2.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
Add epsilon hack to work around rounding issue in texture lookup #9407
Add epsilon hack to work around rounding issue in texture lookup #9407
Conversation
I'm sure others will have opinions, my main concern is that this is turned on for games in general to fix a bug on some vendor GPUs but might negatively impact the GPUs that work correctly. I wonder if we should create a driver issue and only turn it on for some drivers (ex: Nvidia)? EDIT: we don't have any game specific driver bugs at the moment, so... |
I can't test this at the moment but this PR might also fix dancer corruption in earlier Just Dance titles too. I'm not completely sure if the Just Dance corruption affects all GPU vendors or just NVIDIA, though... |
@iwubcode In shader generators, I could just check if the hack is enabled and if the drivers have a bug. After such a change, I should probably add information in the description that the hack does not affect the image on properly working GPUs. I'm just not sure which cards are affected by this bug. Should I enable it for all user-reported configurations on the issue page? This bug also occurs on the Mali-G71 that I have access to, and from what I can see, no one has reported this bug for this GPU. @mbc07 I don't have access to Just Dance so unfortunately I can't verify how the hack affects it, but the issue description sounds very similar. If anyone could confirm that turning on the hack fixes it, I can add a settings file for this game |
Tested Just Dance, Just Dance 2 and Just Dance 3 and indeed this epsilon hack affects them. I tested on Intel Ivy Bridge (very old, only the DX11 backend still works with it) and on NVIDIA Kepler: Intel, without the hack
NVIDIA, without the hack
Intel, with the epsilon hack
NVIDIA, with the epsilon hack
Different games seems to need different epsilon values, considering that the current 0.25 value actually made things worse in JD3 with NVIDIA, despite fixing the corruption on JD and games with VP6 videos, and greatly reducing it on JD2. So, in case this PR goes further, could the epsilon value be made adjustable at runtime? Perhaps keep the hack toggle available on the UI (or even remove it completely, rendering the hack only accessible through the INI) but have an additional option (INI only too) to set the desired epsilon value? |
Thanks for the tests. I think being able to change values is a good idea. In GUI, I can change the checkbox to a slider, and in the description, mention that the value should be as low as possible. |
I looked at tests of various games on the wiki and in some games the problem with VP6 movies was also reported for AMD graphics cards (eg Red Steel 2). All cards seem to be affected, but in some games it is almost invisible. So I don't think enabling the hack only for some gpu is correct. |
@dolphin-emu-bot rebuild |
After discussing this PR on #dolphin-dev, the slider is too complicated. @Extrems mentioned something that could be a valid solution to the texture lookup problem, but I don't have enough knowledge to implement it yet. Below I add his messages, maybe they will be helpful for someone: 21:47 https://github.com/extremscorner/libogc-rice/blob/master/libogc/gx.c#L1751 + https://github.com/extremscorner/emgba/blob/main/source/gx.c#L65-L92 is what I needed to cancel the error on real hardware. |
Any update on this PR? |
Someone on Reddit detailed another possible solution a few days ago. I'm not entirely sure on where the code snippet should go for a proper test build, so I'll just leave the link there... |
That should replace this line: https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoCommon/PixelShaderGen.cpp#L1204 |
If we made a PR build I could test it. Or in a few hours I could setup a build here and try it out. |
|
It is based on the solution (hack) proposed by @endrift in #3807. It fixes the issue with VP6 videos and possibly some others.
Since it's not a perfect solution, I added it as a togglable hack. As mentioned in the original PR, an ideal solution to this problem would be to integerize texture lookups, but it would be much slower. I added a comment about it in the shader code. I also updated the game settings files accordingly, based on this wiki page.
I tested it with the GTX 1080 ti on Windows (drivers version 460.89) and with the Mali-G71 on Android 9 (Galaxy S8+) in several games.