<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 - radv: OpBitfieldUExtract returns incorrect result when count is zero"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=107276">107276</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>radv: OpBitfieldUExtract returns incorrect result when count is zero
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>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/Vulkan/radeon
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

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

        <tr>
          <th>QA Contact</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=140691" name="attach_140691" title="One of the affected shaders (GLSL version)">attachment 140691</a> <a href="attachment.cgi?id=140691&action=edit" title="One of the affected shaders (GLSL version)">[details]</a></span>
One of the affected shaders (GLSL version)

Hello,

when building Mesa with LLVM 7.0-svn, OpBitfieldUExtract sometimes returns the
original source operand instead of zero when the bit count is zero. With LLVM
6.0.1, it works as expected.

This causes the following bug in DXVK:
<a href="https://github.com/doitsujin/dxvk/issues/497">https://github.com/doitsujin/dxvk/issues/497</a>

Here's a renderdoc capture (recorded on Polaris) showing the issue:
<a href="https://mega.nz/#!8W5nDTxT!P7PI4BZ_gpmZDIoh1Iziq0PHpLp448hiUqJN9iEhukg">https://mega.nz/#!8W5nDTxT!P7PI4BZ_gpmZDIoh1Iziq0PHpLp448hiUqJN9iEhukg</a>

The attached shader is a GLSL version of the vertex shader used in the
bookmarked draw call. I added some comments around like 220 for observed vs.
expected behaviour of the shader code.

I tried to reproduce the problem outside of DXVK, but had no luck so far: A
small demo app testing the GLSL bitfieldExtract function in a compute shader
always returns the correct values.

Handling the count = 0 case explicitly in the NIR->LLVM translation fixes the
issue in Far Cry 5.

Regards,
- Philip</pre>
        </div>
      </p>


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

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