<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 - Link time error when using multiple builtin functions"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=99154">99154</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Link time error when using multiple builtin functions
          </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>glsl-compiler
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>niels_ole@salscheider-online.de
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-3d-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=128570" name="attach_128570" title="Simple test case">attachment 128570</a> <a href="attachment.cgi?id=128570&action=edit" title="Simple test case">[details]</a></span>
Simple test case

When using multiple builtin functions, linking of a shader can fail if
temporary variables of the GLSL compiler collide.

builtin_builder::binop creates variables named "x" and "y" for the parameters
of builtin functions. Later, ir_call::generate_inline inlines the call to the
builtins. It clones the variables (without changing the name) and assigns the
function inputs to them.

This can cause a collision of variable names, e. g. when using multiple builtin
functions with parameters of different types. The attached test case can be
used to reproduce the problem.

I can work around the problem by adding a sequence number and possibly a prefix
to the variable names but I am not sure if that is the correct solution.

Thanks to imirkin and robclark for helping me to figure this out on IRC.</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>