<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 - Wrong line numbers expanded while compiling shaders"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=106590">106590</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong line numbers expanded while compiling shaders
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>17.1
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>ARM
          </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>zhaowei.yuan@samsung.com
          </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=139657" name="attach_139657" title="patch that fix GLSL compiling issue">attachment 139657</a> <a href="attachment.cgi?id=139657&action=edit" title="patch that fix GLSL compiling issue">[details]</a></span>
patch that fix GLSL compiling issue

Following shader code is got from a CTS test case which is intend to check if
the shader compiler can expand macro with right line number:
1         #version 300 es
2         precision mediump float;
3         #define BBB      __LINE__, /*
4            */ __LINE__
5         #define AAA(a,b) BBB, a, b
6
7         void main()
8         {
9            out0 = vec4(AAA(__LINE__,
10                  __LINE__
11                  ));
12         }

It expects to make out0 filled with (11, 11, 9, 10) values, But mesa gives
(3,4, 9, 10).

There are 2 problems:
1. Macro BBB should be expanded as the line number exactly where it is
referenced, not declared
2. Macro BBB have a character '\n' within "/**/" which should be ignored and
treat 2 "__LINE__" as the in the same line

I fixed this problem with the attached patch, please review, thanks</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>