[Mesa-dev] [Bug 106590] Wrong line numbers expanded while compiling shaders

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon May 21 06:05:31 UTC 2018


            Bug ID: 106590
           Summary: Wrong line numbers expanded while compiling shaders
           Product: Mesa
           Version: 17.1
          Hardware: ARM
                OS: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: glsl-compiler
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: zhaowei.yuan at samsung.com
        QA Contact: intel-3d-bugs at lists.freedesktop.org

Created attachment 139657
  --> https://bugs.freedesktop.org/attachment.cgi?id=139657&action=edit
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
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

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180521/b13bba2a/attachment-0001.html>

More information about the mesa-dev mailing list