<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 - interpolateAtSample check for input parameter is too strict"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=101378">101378</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>interpolateAtSample check for input parameter is too strict
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>17.0
          </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>glsl-compiler
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>freedesktop@ca.sh13.net
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-3d-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code snippet fails on Mesa 17.0.3 with the following error:

    in GeometryToPixel
    {
        vec3 color;
        vec2 uv;
    } gs2ps;

   out vec4 Color;

   void main ()
   {
        Color = vec4(gs2ps.color, 1);

        if (length(interpolateAtSample(gs2ps.uv, gl_SampleID))>1) {
                discard;
        }
    }

This is the error:

    0:10(1): error: if a fragment input is (or contains) an integer, then it
must be qualified with 'flat'
    0:10(8): error: `gl_SampleID' redeclared
    0:18(33): error: parameter `interpolant` must be a shader input
    0:18(6): error: no matching function for call to `length(error)';
candidates are:
    0:18(6): error:    float length(float)
    0:18(6): error:    float length(vec2)
    0:18(6): error:    float length(vec3)
    0:18(6): error:    float length(vec4)
    0:18(6): error:    double length(double)
    0:18(6): error:    double length(dvec2)
    0:18(6): error:    double length(dvec3)
    0:18(6): error:    double length(dvec4)
    0:18(6): error: operands to relational operators must be scalar and numeric
    0:18(6): error: if-statement condition must be scalar boolean

Changing the shader to use:

    in  vec3 icolor;
    in  vec2 iuv;

fixes the problem. This seems to be related to
<a href="https://patchwork.freedesktop.org/patch/15298/">https://patchwork.freedesktop.org/patch/15298/</a>, but the input variable check is
too strict. It should work with an input block as well, which is for instance
used by the G-Truc samples:
<a href="https://github.com/g-truc/ogl-samples/blob/655559499c23b9566ac432cc2af33cde6646271c/data/gl-400/fbo-multisample-interpolate.frag">https://github.com/g-truc/ogl-samples/blob/655559499c23b9566ac432cc2af33cde6646271c/data/gl-400/fbo-multisample-interpolate.frag</a>

Code in question works fine on AMD desktop drivers.</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>