<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:kenneth@whitecape.org" title="Kenneth Graunke <kenneth@whitecape.org>"> <span class="fn">Kenneth Graunke</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Compiler rejects chained assignments involving array dereferences"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=74026">bug 74026</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>ASSIGNED
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>FIXED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Compiler rejects chained assignments involving array dereferences"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=74026#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Compiler rejects chained assignments involving array dereferences"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=74026">bug 74026</a>
              from <span class="vcard"><a class="email" href="mailto:kenneth@whitecape.org" title="Kenneth Graunke <kenneth@whitecape.org>"> <span class="fn">Kenneth Graunke</span></a>
</span></b>
        <pre>commit 44a86e2b4fca7c7cab243dfa62dc17f4379fc8e3
Author: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>>
Date:   Fri Jan 24 10:47:49 2014 -0800

    glsl: Fix chained assignments of vector channels.

    Simple shaders such as:

        void splat(vec2 v, float f) {
            v[0] = v[1] = f;
        }

    failed to compile with the following error:
    error: value of type vec2 cannot be assigned to variable of type float

    First, we would process v[1] = f, and transform:
    LHS: (expression float vector_extract (var_ref v) (constant int (1)))
    RHS: (var_ref f)
    into:
    LHS: (var_ref v)
    RHS: (expression vec2 vector_insert (var_ref v) (constant int (1))
                     (var_ref f))

    Note that the LHS type is now vec2, not a float.  This is surprising,
    but not the real problem.

    After emitting assignments, this ultimately becomes:
    (declare (temporary) vec2 assignment_tmp)
    (assign (xy)
      (var_ref assignment_tmp)
      (expression vec2 vector_insert (var_ref v) (constant int (1))
                  (var_ref f)))
      (assign (xy) (var_ref v) (var_ref assignment_tmp))

    We would then return (var_ref assignment_tmp) as the rvalue, which has
    the wrong type---it should be float, but is instead a vec2.

    To fix this, we simply return (vector_extract (var_ref assignment_temp)
    <the appropriate channel>) to pull out the desired float value.

    Fixes Piglit's chained-assignment-with-vector-constant-index.vert and
    chained-assignment-with-vector-dynamic-index.vert tests.

    Cc: <a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.org</a>
    Bugzilla: <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Compiler rejects chained assignments involving array dereferences"
   href="show_bug.cgi?id=74026">https://bugs.freedesktop.org/show_bug.cgi?id=74026</a>
    Reported-by: Dan Ginsburg <<a href="mailto:dang@valvesoftware.com">dang@valvesoftware.com</a>>
    Reviewed-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>>
    Reviewed-by: Matt Turner <<a href="mailto:mattst88@gmail.com">mattst88@gmail.com</a>>
    Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>></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>