Bug 96602

Summary: [radeonsi] Dreamfall Chapters: one shader fails to compile, minor visual corruption
Product: Mesa Reporter: Kai <kai>
Component: Drivers/Gallium/radeonsiAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact: Default DRI bug account <dri-devel>
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 77449    
Attachments: DFC shader dump produced with R600_DEBUG=fs,vs,gs,ps,cs,tcs,tes
The problematic shader
Simplified version that also used to trigger the error

Description Kai 2016-06-20 19:29:02 UTC
Created attachment 124625 [details]
DFC shader dump produced with R600_DEBUG=fs,vs,gs,ps,cs,tcs,tes

Since the release of book five of "Dreamfall Chapters: The longest Journey" and their switch to a OpenGL 4.1+ context I'm getting the following error on load:
> LLVM triggered Diagnostic Handler: Illegal instruction detected: Illegal immediate value for operand.
> LLVM failed to compile shader
> radeonsi: can't create a shader
with the stack detailed below.

The game loads and book five is entirely playable. However almost all scenes show minor visual corruption in the form of wrongly coloured pixels (not sure, if the shader failing is responsible for that or if it's a different bug). Usually in a very noticeable bright green (#0f0), but some other colours are also observable (blue, yellow, red and few white and black ones as well). There is only one scene during the epilogue where the character of Zoë Castillo is shown sitting on a balcony where a large part of the background shows wrong colours (I would assume it should be metallic roofs reflecting sunlight but instead they are just plain yellow and red where the light hits).

Attached to this bug you'll find a shader dump produced with R600_DEBUG=fs,vs,gs,ps,cs,tcs,tes passed to the game. The dump is intermixed with what the game/Unity3D wrote to STDERR. In fact this is identical to Unity's Player.log. In lines 119284-119286 you'll find the error message quoted above. Since the full log was several MBytes in size I compressed it with xz.

The stack used was (Debian testing, fully updated, as a base):
GPU: Hawaii PRO [Radeon R9 290] (ChipID = 0x67b1)
Mesa: Git:master/5a64549f54
libdrm: 2.4.68-1
LLVM: SVN:trunk/r272995 (3.9 devel)
X.Org: 2:1.18.3-1
Linux: 4.6.2
Firmware: firmware-amd-graphics/20160110-1
libclc: Git:master/20d977a3e6
DDX: 1:7.7.0-1
Comment 1 Nicolai Hähnle 2016-06-21 08:16:00 UTC
Hello Kai, thank you for the thorough bug report. I can reproduce the problem here.
Comment 2 Nicolai Hähnle 2016-06-21 10:43:54 UTC
With the patch at http://reviews.llvm.org/D21551 for LLVM, the shader in the provided log file compiles without error. Let us know if there are any other problems with the game.
Comment 3 Kai 2016-06-21 18:58:34 UTC
(In reply to Nicolai Hähnle from comment #2)
> With the patch at http://reviews.llvm.org/D21551 for LLVM, the shader in the
> provided log file compiles without error. Let us know if there are any other
> problems with the game.

Thanks for the fast reply and patch! I can confirm, that with the stack detailed below I'm no longer seeing the shader compilation failure. The minor visual corruption is still there, but I'll open a separate bug for that, since it seems unconnected.

You can have my:
 Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org>
for <http://reviews.llvm.org/D21551?id=61349&download=true>

The stack used was (Debian testing, fully updated, as a base):
GPU: Hawaii PRO [Radeon R9 290] (ChipID = 0x67b1)
Mesa: Git:master/5a64549f54
libdrm: 2.4.68-1
LLVM: SVN:trunk/r273281 (3.9 devel) + <http://reviews.llvm.org/D21551?id=61349&download=true>
X.Org: 2:1.18.3-1
Linux: 4.6.2
Firmware: firmware-amd-graphics/20160110-1
libclc: Git:master/20d977a3e6
DDX: 1:7.7.0-1
Comment 4 Kai 2016-06-29 20:10:31 UTC
<http://reviews.llvm.org/D21551> needs some more work and hasn't landed yet on LLVM trunk, I closed this bug a bit prematurely, since the issue at hand was fixed fore *me* after applying the patch.

I'm sure Nicolai will close it again, once he had time to address the outstanding comments on his patch.
Comment 5 Kai 2016-07-12 16:35:24 UTC
The fix has now landed on upstream's SVN trunk: <http://reviews.llvm.org/D21551#480953>
Comment 6 Nicolai Hähnle 2016-09-09 08:27:26 UTC
Created attachment 126363 [details]
The problematic shader

Adding the extracted shader for future reference.
Comment 7 Nicolai Hähnle 2016-09-09 08:27:45 UTC
Created attachment 126364 [details]
Simplified version that also used to trigger the error

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.