<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 - invariant qualifier is not valid for shader inputs"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=96971">96971</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>invariant qualifier is not valid for shader inputs
          </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/DRI/i965
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>idr@freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>qiankun.miao@intel.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-3d-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Currently, only glsl es in mesa follows this rule. But glsl compiler should
also follow this rule. The behavior is specified in GLSLangSpec.4.40, in
Section 4.8.1 The Invariant Qualifier: "Only variables output from a shader can
be candidates for invariance." and "As only outputs need be declared with
invariant, an output from one shader stage will still match an input of a
subsequent stage without the input being declared as invariant."

So, input without invariant declaration should be valid.
But following code snippet in mesa/src/compiler/glsl/link_varyings.cpp makes it
an error:


   if (!prog->IsES && input->data.invariant != output->data.invariant) {
      linker_error(prog,                                                        
                   "%s shader output `%s' %s invariant qualifier, "
                   "but %s shader input %s invariant qualifier\n",
                   _mesa_shader_stage_to_string(producer_stage),
                   output->name,
                   (output->data.invariant) ? "has" : "lacks",
                   _mesa_shader_stage_to_string(consumer_stage),
                   (input->data.invariant) ? "has" : "lacks");
      return;
   }</pre>
        </div>
      </p>


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

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