Wrong line numbers expanded while compiling shaders
Submitted by Zhaowei Yuan
Assigned to mes..@..op.org
Link to original bug (#106590)
Description
Created attachment 139657 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:
- Macro BBB should be expanded as the line number exactly where it is referenced, not declared
- 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
Attachment 139657, "patch that fix GLSL compiling issue":
0001-GLSL-compiling-Sync-line-number-for-macro.patch
Version: 17.1