Bug 107477 - [DXVK] Setting high shader quality in GTA V results in LLVM error
Summary: [DXVK] Setting high shader quality in GTA V results in LLVM error
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/radeon (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
Depends on:
Reported: 2018-08-04 02:11 UTC by Clément Guérin
Modified: 2018-08-31 15:52 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

GTA 5 RADV_DEBUG log (294.15 KB, text/x-log)
2018-08-23 05:01 UTC, Clément Guérin
checkir.log (6.43 KB, text/x-log)
2018-08-23 15:31 UTC, Clément Guérin
shaders,preoptir,spirv.log (1.05 MB, text/x-log)
2018-08-23 15:36 UTC, Clément Guérin
possible fix (987 bytes, patch)
2018-08-23 17:06 UTC, Samuel Pitoiset
Details | Splinter Review
Smoke glitches (7.17 MB, image/png)
2018-08-24 04:03 UTC, Clément Guérin
fix v2 (3.32 KB, patch)
2018-08-29 13:48 UTC, Samuel Pitoiset
Details | Splinter Review

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

- 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]

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]
Comment 7 Clément Guérin 2018-08-23 15:36:37 UTC
Created attachment 141250 [details]

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.