Created attachment 135457 [details]
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.