<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [GLSL] Sampler arrays indexed with non-constant expressions"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=71723">71723</a>
          </td>
        </tr>

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

        <tr>
          <th>Summary</th>
          <td>[GLSL] Sampler arrays indexed with non-constant expressions
          </td>
        </tr>

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

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>vluchits@gmail.com
          </td>
        </tr>

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

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

        <tr>
          <th>Version</th>
          <td>9.2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Drivers/DRI/Radeon
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=89383" name="attach_89383" title="Test vertex shader">attachment 89383</a> <a href="attachment.cgi?id=89383&action=edit" title="Test vertex shader">[details]</a></span>
Test vertex shader

Hello,

in my opinion GLSL compiler in mesa is too restrictive when it comes to sampler
arrays. The attached vertex shader can not be compiled due to the "sampler
arrays indexed with non-constant expressions is forbidden in GLSL 1.30 and
later":

Lines 159-136 of src/glsl/ast_array_index.cpp say:

    * This restriction was added in GLSL 1.30.  Shaders using earlier version
    * of the language should not be rejected by the compiler front-end for
    * using this construct.  This allows useful things such as using a loop
    * counter as the index to an array of samplers.  If the loop in unrolled,
    * the code should compile correctly.  Instead, emit a warning.

If compiler actually attempted to unroll the loop above, it would notice that
the code does compile correctly in that case. Instead it just emits and error
and, in my opinion, contradicts the comment above by not allowing the
aforementioned "useful thing".

Can the compiler be changed to _first_ attempt to unroll the loop and then
check for sampler array indices being constants?</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>