<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Nier:Automata - "if" in fragment shader incorrectly evaluated, causes artifacts"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=103743">103743</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Nier:Automata - "if" in fragment shader incorrectly evaluated, causes artifacts
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>git
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Drivers/Gallium/radeonsi
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dri-devel@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>philip.rebohle@tu-dortmund.de
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>dri-devel@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=135457" name="attach_135457" title="Fragment shader with workaround">attachment 135457</a> <a href="attachment.cgi?id=135457&action=edit" title="Fragment shader with workaround">[details]</a></span>
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):
<a href="https://mega.nz/#!JaBD0IoT!yBekRb7ZmvsSY60mo0E7N6uwaYfp_KfRDlnQWL0-QOo">https://mega.nz/#!JaBD0IoT!yBekRb7ZmvsSY60mo0E7N6uwaYfp_KfRDlnQWL0-QOo</a>

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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>