https://bugs.freedesktop.org/show_bug.cgi?id=103743
Bug ID: 103743 Summary: Nier:Automata - "if" in fragment shader incorrectly evaluated, causes artifacts Product: Mesa Version: git Hardware: x86-64 (AMD64) OS: Linux (All) Status: NEW Severity: normal Priority: medium Component: Drivers/Gallium/radeonsi Assignee: dri-devel@lists.freedesktop.org Reporter: philip.rebohle@tu-dortmund.de QA Contact: dri-devel@lists.freedesktop.org
Created attachment 135457 --> https://bugs.freedesktop.org/attachment.cgi?id=135457&action=edit Fragment shader with workaround
When compiling Mesa against LLVM >= 5.0, Nier:Automata shows lighting artifacts that are caused by a misbehaving 'if' in a fragment shader.
Apitrace that shows the issue (2.5G, bz2-compressed): https://mega.nz/#!JaBD0IoT!yBekRb7ZmvsSY60mo0E7N6uwaYfp_KfRDlnQWL0-QOo
I attached a copy of the fragment shader that causes the problem, but also includes a workaround. The file name for MESA_SHADER_READ_PATH is FS_feba74122c9590d1522b92bbec52d662ecd99012.glsl.
The offending code is located at line 135:
R1.x = uintBitsToFloat(floatBitsToUint(R0).y >= 0x4u ? 0xffffffffu : 0u); if (bool(floatBitsToUint(R1).x))
The artifacts go away when changing the original 'if' condition to the following:
if (floatBitsToUint(R0).y >= 0x4u)
This happens with both Mesa 17.2 and latest Mesa-git when compiling against LLVM 5.0 or later. This does *not* happen with LLVM 4.0.1. My GPU is an RX 480.