Bug 107477

Summary: [DXVK] Setting high shader quality in GTA V results in LLVM error
Product: Mesa Reporter: Clément Guérin <libcg>
Component: Drivers/Vulkan/radeonAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: GTA 5 RADV_DEBUG log
checkir.log
shaders,preoptir,spirv.log
possible fix
Smoke glitches
fix v2

Description Clément Guérin 2018-08-04 02:11:54 UTC
In GTA V, setting Shader Quality to anything higher than Normal will result in a LLVM error shortly after starting the game:

LLVM ERROR: Cannot select: 0x7f5af06d35b8: f32 = bitcast 0x7f5af0782ba0
  0x7f5af0782ba0: v2i32,ch = CopyFromReg 0x7f5af063d4d8, Register:v2i32 %42
    0x7f5af06d4150: v2i32 = Register %42

Info:
- DXVK 0.64
- wine-staging 3.12
- mesa-git 471bce5689
- llvm-svn 338485
Comment 1 Clément Guérin 2018-08-04 02:13:06 UTC
Forgot to mention that I'm using a R9 Fury.
Comment 2 Samuel Pitoiset 2018-08-21 08:04:19 UTC
Can you try to reproduce the crash with RADV_DEBUG=shaders,preoptir and upload the output somewhere?
Comment 3 Clément Guérin 2018-08-23 05:01:40 UTC
Created attachment 141244 [details]
GTA 5 RADV_DEBUG log

Here's the log attached as requested.
Comment 4 Samuel Pitoiset 2018-08-23 09:07:52 UTC
Can you also try with RADV_DEBUG=checkir and show me the output please?
Comment 5 Samuel Pitoiset 2018-08-23 10:25:13 UTC
Actually, I would need the SPIRV too in order to reproduce the problem myself. Can you try with RADV_DEBUG=shaders,preoptir,spirv and attach the output?

You will need spirv-dis in your path. Thanks!
Comment 6 Clément Guérin 2018-08-23 15:31:31 UTC
Created attachment 141249 [details]
checkir.log
Comment 7 Clément Guérin 2018-08-23 15:36:37 UTC
Created attachment 141250 [details]
shaders,preoptir,spirv.log

Here's the output logs.
Comment 8 Samuel Pitoiset 2018-08-23 17:06:13 UTC
Created attachment 141256 [details] [review]
possible fix

Can you apply this patch? It should fix the LLVM IR error.
Comment 9 Clément Guérin 2018-08-24 04:03:13 UTC
Created attachment 141267 [details]
Smoke glitches

Great. I can confirm that the game no longer crashes at ultra settings with this patch. However, I'm seeing some graphical glitches on smoke, see screenshot attached.

Unfortunately I won't be able to get an apitrace today.
Comment 10 Samuel Pitoiset 2018-08-24 14:21:47 UTC
I would prefer a renderdoc capture if you can provide that.
Comment 11 Clément Guérin 2018-08-24 16:02:49 UTC
Here's the capture: https://send.firefox.com/download/157438a5ba/#DzGe_CjcHthydTi1jPT-0A
Comment 12 Samuel Pitoiset 2018-08-28 13:42:48 UTC
Are you sure the link is correct? "This link has expired or never existed in the first place!"
Comment 13 Clément Guérin 2018-08-28 17:46:35 UTC
Let's try again: https://send.firefox.com/download/0a9b6178c5/#mjwYjQDZZbGvFqAKq5fhig
Comment 14 Samuel Pitoiset 2018-08-29 13:48:30 UTC
Created attachment 141347 [details] [review]
fix v2

Does this fix the smoke issue too?
Comment 15 Clément Guérin 2018-08-29 17:39:34 UTC
I haven't found the time to test it yet. Is forcing `output_usage_mask` at line 71 intentional?
Comment 16 Samuel Pitoiset 2018-08-29 19:15:20 UTC
Yeah, it was just a workaround for a weird issue but I fixed it since. I'm improving the patch for supporting cull distances as well.
Comment 17 Samuel Pitoiset 2018-08-29 20:56:03 UTC
Here's the real fix: https://patchwork.freedesktop.org/patch/246462/

Can you confirm that fixes the issue on your side? Thanks!
Comment 18 Clément Guérin 2018-08-30 02:59:50 UTC
I confirm it works. I'm able to run the game at Ultra settings without any visible glitches. Thanks for your hard work!

There's another small issue with inverted reflections, it's still unclear if it's a game bug, DXVK bug or driver bug. I'll open up another bug report if necessary.
Comment 19 Samuel Pitoiset 2018-08-31 15:52:43 UTC
Fixed with https://cgit.freedesktop.org/mesa/mesa/commit/?id=6f47df312943b05653efc0494551ebf8c3903d43

Feel free to open a new bug report if you think the reflection issue is on the driver side.

Thanks a lot for reporting this!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.