Various shaders fail to compile in vulkan

  • Posts: 83
3 weeks 2 days ago #1 by Niko of Death
(apologies if this belongs in the shaders section)
A decent variety of shaders that work perfectly fine in non-vulkan games are failing to compile for some reason when I try to use them in Vulkan, with reshade compiled from the latest master. The shaders that don't work are identical across 3 games I tested (No Man's Sky, RAGE 2, and World War Z), and for comparison (since it has a DX11 and a Vulkan renderer) I uploaded the logs I get when trying to activate every shader I have in World War Z:
DX11: pastebin.com/3txXVj7t
Vulkan: pastebin.com/V28WtE1Q
As you can see from the vulkan log, qUINT_mxao.fx, qUINT_ssr.fx, MagicBloom.fx, Bloom.fx, SMAA.fx, and DOF.fx all fail to compile with no errors presented, while AdaptiveFog.fx, FilmicAnamorphSharpen.fx, qUINT_sharp.fx, FXAA.fx, LumaSharpen.fx, LUT.fx, MultiLUT.fx, PPFX_Bloom.fx, PPFX_Godrays.fx, Splitscreen.fx, StageDepth.fx, PPFX_SSDO.fx, Tonemap.fx, UIDetect.fx, UIMask.fx, Vibrance.fx, AdaptiveSharpen.fx, qUINT_dof.fx, AmbientLight.fx, qUINT_lightroom.fx, Colourfulness.fx, CRT.fx, Deband.fx, Denoise.fx, DisplayDepth.fx, and FakeHDR.fx compile successfully.

Please Log in or Create an account to join the conversation.

  • Posts: 3635
3 weeks 1 day ago #2 by crosire
Try with master again. Luckily I added the "Not overriding features set via 'VkPhysicalDeviceFeatures2' in structure chain." log message to remind me to fix something I ignored so far, which is now fixed in master.

Please Log in or Create an account to join the conversation.

  • Posts: 83
3 weeks 1 day ago #3 by Niko of Death
Still fails to compile, but now has error messages:
10:15:24:911 [17544] | ERROR | Failed to create graphics pipeline for pass 1 in technique 'SMAA'! Vulkan error code is -1.
10:15:24:911 [17544] | ERROR | Failed to compile "C:\ProgramData\ReShade\reshade-shaders\Shaders\SMAA.fx":
10:15:53:237 [17544] | ERROR | Failed to create graphics pipeline for pass 4 in technique 'BloomAndLensFlares'! Vulkan error code is -1.
10:15:53:237 [17544] | ERROR | Failed to compile "C:\ProgramData\ReShade\reshade-shaders\Shaders\Bloom.fx":
10:16:16:343 [17544] | ERROR | Failed to create graphics pipeline for pass 4 in technique 'MXAO'! Vulkan error code is -1.
10:16:16:344 [17544] | ERROR | Failed to compile "C:\ProgramData\ReShade\reshade-shaders\Shaders\qUINT_mxao.fx":
10:16:40:519 [17544] | ERROR | Failed to create graphics pipeline for pass 3 in technique 'SSR'! Vulkan error code is -1.
10:16:40:519 [17544] | ERROR | Failed to compile "C:\ProgramData\ReShade\reshade-shaders\Shaders\qUINT_ssr.fx":
10:16:47:774 [17544] | ERROR | Failed to create graphics pipeline for pass 1 in technique 'MagicBloom'! Vulkan error code is -1.
10:16:47:774 [17544] | ERROR | Failed to compile "C:\ProgramData\ReShade\reshade-shaders\Shaders\MagicBloom.fx":
10:16:49:356 [17544] | ERROR | Failed to create graphics pipeline for pass 2 in technique 'RingDOF'! Vulkan error code is -1.
10:16:49:356 [17544] | ERROR | Failed to compile "C:\ProgramData\ReShade\reshade-shaders\Shaders\DOF.fx":

Please Log in or Create an account to join the conversation.

  • Posts: 3635
3 weeks 1 day ago - 3 weeks 1 day ago #4 by crosire
AMD driver does not accept the SPIR-V it seems. Or something else in the pipeline does not correspond to their wishes (although ReShade only uses core Vulkan there, so it can't be some extension AMD does not support again). It can mean a lot of things.
I'd suggest running the debug app again with Vulkan ("Debug App" target, with "--vulkan" command line option), which has validation layers active and check if they spit out anything useful with those effects. They don't report any errors on NVIDIA, but AMD has always been a special flower ...

It's weird that it only starts failing after multiple passes. For all those effects the pipeline for the first pass (aka 0) is still created without problems apparently.

Please Log in or Create an account to join the conversation.

  • Posts: 83
3 weeks 1 day ago #5 by Niko of Death
I'm still getting the
Unhandled exception at 0x0000000000000000 in ReShade64.exe: 0xC0000005: Access violation executing location 0x0000000000000000.
at 534 of vulkan_hooks.cpp
I tried uninstalling my previous vulkan sdk installation and installing the latest. For some reason Visual Studio isn't following my exception settings to prevent it from breaking at that.

Please Log in or Create an account to join the conversation.

  • Posts: 83
3 weeks 1 day ago #6 by Niko of Death
Also, perhaps looking at Retroarch's slang shader system could be of some use?

Please Log in or Create an account to join the conversation.

  • Posts: 3635
2 weeks 6 days ago - 2 weeks 6 days ago #7 by crosire
Slang is not going to help, since they don't create their own SPIR-V, but instead just create GLSL and use Khronos' glslang. The unique thing about ReShade is that it has its own full-blown compiler that compiles down to SPIR-V. And that tends to unearth driver bugs, because the drivers are generally only tested against glslang and dxc (the Microsoft HLSL compiler, which is also capable of producing SPIR-V). And those make a couple of assumptions about the shaders that ReShade does not make (while still keeping true to the SPIR-V spec). I found two confirmed NVIDIA driver bugs (which have been fixed since) because of this and at least one on AMD (not to mention two more in general Vulkan). Which makes this particularly hard.
But anyway, the pipeline creation failure should be gone now in master. ReShade generated non-spec-conform SPIR-V in certain scenarios, which broke the AMD driver. This is fixed, but I'm told it now just hangs indefinetly for some shaders inside the AMD driver, so yeah, more fun to figure out.

Please Log in or Create an account to join the conversation.

  • Posts: 83
2 weeks 6 days ago #8 by Niko of Death

crosire wrote: Slang is not going to help, since they don't create their own SPIR-V, but instead just create GLSL and use Khronos' glslang. The unique thing about ReShade is that it has its own full-blown compiler that compiles down to SPIR-V. And that tends to unearth driver bugs, because the drivers are generally only tested against glslang and dxc (the Microsoft HLSL compiler, which is also capable of producing SPIR-V). And those make a couple of assumptions about the shaders that ReShade does not make (while still keeping true to the SPIR-V spec). I found two confirmed NVIDIA driver bugs (which have been fixed since) because of this and at least one on AMD (not to mention two more in general Vulkan). Which makes this particularly hard.
But anyway, the pipeline creation failure should be gone now in master. ReShade generated non-spec-conform SPIR-V in certain scenarios, which broke the AMD driver. This is fixed, but I'm told it now just hangs indefinetly for some shaders inside the AMD driver, so yeah, more fun to figure out.

Built with latest master (20f31f8), still have the identical error, no hanging or anything like that.

Please Log in or Create an account to join the conversation.

  • Posts: 3635
2 weeks 3 days ago #9 by crosire
So, AMD driver bug got confirmed. But I also managed to figure out an (albeit ugly) workaround until it's fixed. So master now works on AMD.
The following user(s) said Thank You: Niko of Death

Please Log in or Create an account to join the conversation.

  • Posts: 83
2 weeks 3 days ago #10 by Niko of Death

crosire wrote: So, AMD driver bug got confirmed. But I also managed to figure out an (albeit ugly) workaround until it's fixed. So master now works on AMD.

Was just about to post here to confirm that the latest master fixes the shaders in question :)
Thanks for the fix!

Please Log in or Create an account to join the conversation.