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
Ubershaders 2.0 #5702
Ubershaders 2.0 #5702
Conversation
a7006ff
to
89fc5a5
Compare
| @@ -1279,8 +1280,12 @@ void ShaderCache::PrecompileUberShaders() | |||
|
|
|||
| void ShaderCache::WaitForBackgroundCompilesToComplete() | |||
| { | |||
| m_async_shader_compiler->WaitUntilCompletion(); | |||
| m_async_shader_compiler->WaitUntilCompletion([](size_t completed, size_t total) { | |||
| Host_UpdateProgressDialog("Compiling shaders...", static_cast<int>(completed), | |||
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
i7 6700k here with an amd rx480 graphics card playing at 4k with the default number of threads using Windows 10. Vulkan Hybrid mode is not playable, tried a few games and get the following error on each:
Oddly, exclusive mode sees no error but as you mentioned is really slow (50% decrease in speed) so it's hard to gauge stuttering. D3D Hybrid mode works and removes stuttering completely in my tests! Exclusive mode also works but is very slow. OGL Seemed to be mostly the same as D3D but being an AMD user I never use it so I have little to compare it to! |
|
AMD RX460 user on windows 10 |
|
GT Cube (GTCJBL): When you're in the garage menu, switching between Disabled/Hybrid and Exclusive noticeably changes lighting. I think a light disappears with ubershaders. (on Nvidia/Windows using either OpenGL or Direct3D, Vulkan errors out with "Failed to submit command buffer.") |
|
More AMD results, Windows 7, amd radeon hd 7790, driver version 17.4.4. I have only briefly tested new super mario bros with a portable.text and only changing the IR to 3x:
|
|
Arch Linux x64, Intel Core i7 6800k, AMD Radeon RX 460 on the Mesa 17.1.3 open-source drivers. Did a quick test of the ubershaders (with mostly Super Smash Bros Brawl, the game I have that suffers the most from shader stuttering on an empty cache) and got the following results: |
|
@gourdcaptain unfortunately we rely on drivers a lot. Your card is more than good enough, but, the open source drivers aren't there yet to be able to run this at full speed. AMD always seems to struggle on OpenGL for performance. Hopefully we can make ubershaders more efficient and hopefully driver devs care enough to help to make our use case more efficient as well. Thanks for the crash report, that will get looked into immediately. |
|
When I say it's too slow, Hybrid OpenGL runs full speed at 3x IR and still stutters a bit as noted it might. Exclusive runs full speed at 1x IR, but as noted, can't do larger IRs. Just want to make sure it didn't sound worse than it actually was. (The card in general has decent performance on recent stable Mesa under Vulkan or on most games in OpenGL.) |
|
3x IR on Vulkan/OpenGL can't happen on almost anything right now. 3x/4x IR is possible on D3D. Hopefully we can increase performance on OpenGL/Vulkan soon to at least match D3D's performance on ubershaders. Thanks for the clarification, that makes more sense. I'm really impressed the open source drivers can do 1x IR full speed. |
|
using intel i5 4210u and a geforce 840m and windows 10, using latest drivers. ubershaders works well, esp. in Final Fantasy Crystal Chronicles - The Crystal Bearers, a game notorious for its heavy use async shader compilation. it stutters like heck, esp in the desert area, with no ubershaders. With it on, after an initial run through an area, repeated runs stutter less and less. there will still be some stuttering even in a place you have been lots of time, but it does not hurt gameplay. tested with d3d11,vulkan and ogl. |
|
Is there a build for this available somewhere? |
|
@Tilka Do you have per-pixel lighting on? That's the only setting that let me reproduce what you're describing with the fifolog. Per-pixel lighting should disable ubershaders though, so there's a bug if that's not happening, I'll look into it. Edit: Should be fixed now @mimimi085181 I have a feeling the older D3DCompiler that ships with Win7 may be choking on our shaders. Try grabbing d3dcompiler_47.dll from "C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64", and copying it to the Dolphin directory. @theboy181 https://dl.dolphin-emu.org/prs/pr-5702-dolphin-latest-x64.7z |
|
Yeah.... I think that's an OSX driver issue. |
|
Confirmed, macOS is doing reeaaally weird things with this PR! Even with ubershaders off. That's the brawl into video, with ubershaders off. In addition to being black and white and upsidedown, brawl's intro video was weirdly slow (something pr5679 shares with it, weirdly enough!) Taito no Tatsujin Wii only shows cyan, and changing the ubershaders options on or off changes nothing. Changing the setting, closing the emulator, and then running a game doesn't affect anything either. Setting "PrecompileUberShaders = False" in the INI options made Brawl's into video full speed again, but didn't change the visuals. So um, drivers. Yay! Unfortunately since turning off ubershaders is broken it's kind of a big deal... Tested on: |
|
@stenzek: That .dll fixes the compilation error. |
|
Should we ship that dll? |
|
@JMC47 potentially. From what I've read, you're allowed to distribute it: https://blogs.msdn.microsoft.com/chuckw/2012/05/07/hlsl-fxc-and-d3dcompile/ |
|
Though perhaps we should just precompile the ubershaders instead. |
|
Or drop downlevel support \o/ |
|
Tatsunoko vs. Capcom: Ultimate All-Stars. 5xIR with Per-pixel lighting disabled. Run great and smooth gameplay. Almost no noticeable stuttering. :) Windows 10 insider build 16199. |
|
@gourdcaptain The latest push fixes the crash on anv, hopefully will do the same for radv. If not, I'll set up my AMD box again and investigate. For those curious, seems switch (x) { default: return float3(0.0, 0.0, 0.0); } causes the SPV->NIR compiler to crash. Might be worth reporting. |
66a9b8d
to
b45c85e
Compare
Should give a decent speedup to boot time.
At runtime, we only really want a single shader compiler thread. However, for initial boots, we can use a higher number to speed things up.
Disable it at shader generation time instead. This way the UIDs are sharable.
Fixes the mouse cursor being left visible after ubershader precompilation when the hide option is checked.
|
Congrats! |
|
Please note there is currently a known issue with primus, which causes Dolphin to crash on boot in OpenGL mode regardless of whether ubershaders are enabled. I'm going to look at this as soon as possible, but in the meantime, setting ShaderCompilerThreads=0 and ShaderPrecompilerThreads=0 in GFX.ini (Settings section) should allow you to continue to use Dolphin. |
|
This might sound a bit strange, but is force 24-bit color always enabled in exclusive mode? There's a game that actually needs it disabled called cyber sled since it causes color artifacts on the flat shaded polygons in game. Disabling it works with none or hybrid, but not exclusive. |
|
@spring568 sounds like a bug. Could you please record and upload a fifolog of the issue? It may not be related to only the 24-bit color setting. |
|
@stenzek edit: reuploaded, it had a dud fifo log |
|
@spring568 Thanks, I'll have a look when I next get a chance. |
|
Sure no problem! Ah I also forgot you need ignore format changes and store efb copies to texture unchecked for proper graphics. |
|
Incredible work, all! The hybrid mode seems to work well on MacOS on an integrated chip (Intel HD Iris 6100), can't wait to try this on AMD with Mesa / Vulkan. |
|
@spring568 PR #5858 should sort out this issue, or, at least it does for me when playing back the fifolog. |
https://bugs.dolphin-emu.org/issues/7104 https://bugs.dolphin-emu.org/issues/8452 https://bugs.dolphin-emu.org/issues/9040 https://bugs.dolphin-emu.org/issues/10554 https://bugs.dolphin-emu.org/issues/10059 https://bugs.dolphin-emu.org/issues/10155 https://bugs.dolphin-emu.org/issues/10324 https://bugs.dolphin-emu.org/issues/10758 https://bugs.dolphin-emu.org/issues/10759 https://bugs.dolphin-emu.org/issues/10930 dolphin-emu#5702 (comment) dolphin-emu#5717 https://forums.dolphin-emu.org/Thread-big-brain-academy-problem https://forums.dolphin-emu.org/Thread-netflix-instant-streaming-disc-testing https://forums.dolphin-emu.org/Thread-wii-new-carnival-games?pid=469822#pid469822
https://bugs.dolphin-emu.org/issues/7104 https://bugs.dolphin-emu.org/issues/8452 https://bugs.dolphin-emu.org/issues/9040 https://bugs.dolphin-emu.org/issues/10554 https://bugs.dolphin-emu.org/issues/10059 https://bugs.dolphin-emu.org/issues/10155 https://bugs.dolphin-emu.org/issues/10324 https://bugs.dolphin-emu.org/issues/10758 https://bugs.dolphin-emu.org/issues/10759 https://bugs.dolphin-emu.org/issues/10930 dolphin-emu#5702 (comment) dolphin-emu#5717 https://forums.dolphin-emu.org/Thread-big-brain-academy-problem https://forums.dolphin-emu.org/Thread-netflix-instant-streaming-disc-testing https://forums.dolphin-emu.org/Thread-wii-new-carnival-games?pid=469822#pid469822




If users want to test, use this link: https://dl.dolphin-emu.org/prs/pr-5702-dolphin-latest-x64.7z
This pull request completes the implemention of ubershaders in the graphics backends, started by @phire. Most of the hard work was done already by them, I just had to write the vertex ubershaders, integrate it into the backends, and fix bugs.
Last time I checked, ubershaders are fifoci regression-free on GL. Haven't tried D3D or Vulkan.
In the graphics options under the enhancements tab, there is a new drop-down field, "Ubershader mode". The options are:
There's also a few hidden options, which you can modify via the ini:
Feel free to report bugs at this point. Please attach a fifolog where possible, and provide as much detail as you can, as this will allow me to get the issue fixed faster.
For the best experience depending on your operating system and GPU vendor:
Few notes: