Hey all, I've noticed a bug in Mesa's treatment of the #line directive in GLSL 3.3+. The 3.3 spec changed the line number set by #line to be the line number for the following line of source (pg 11 GLSL 3.3 spec): #line `line` #line `line` `source-string-number` > After processing this directive (including its new-line), the implementation > will behave as if it is compiling at line number `line` and source string > number `source-string-number`. Subsequent source strings will be numbered > sequentially, until another #line directive overrides that numbering. So for a shader with some silly error in it: #version 330 core #line 1 4 not_valid vec4 thingy_error; #line 1 0 layout(location = 0) in vec4 pos; void main(void){ gl_Position = pos; } We'd expect the error to specify something about the incorrect identifier/token w/e on line 1 of source string 4, however Mesa's compilation log contains the following: > 0:2(1): error: syntax error, unexpected NEW_IDENTIFIER From some other shader compilers it seems like the first number refers to the source string number, which should be 4 here. The compiler also seems to be using the GLSL 1.5 line directive where the following line is line number `line` + 1. Nvidia's compiler gives the expected source string number and line number: > 4(1) : warning C7022: unrecognized profile specifier "not_valid" > 4(1) : error C0502: syntax error at token "not_valid" Information about my Mesa & GL version: > OpenGL Version: 3.3 (Core Profile) Mesa 10.1.3 > OpenGL Vendor: Intel Open Source Technology Center > OpenGL Renderer: Mesa DRI Intel(R) Ivybridge Mobile > GLSL Version: 3.30 Thanks!
Patches sent to mesa-dev mailing list: glsl: Update the #line behaviour on GLSL 3.30+ and GLSL ES+ http://lists.freedesktop.org/archives/mesa-dev/2015-March/080286.html glsl: respect the source number set by #line <line> <source> http://lists.freedesktop.org/archives/mesa-dev/2015-March/080287.html
(In reply to Antia Puentes from comment #1) > Patches sent to mesa-dev mailing list: > > glsl: Update the #line behaviour on GLSL 3.30+ and GLSL ES+ > http://lists.freedesktop.org/archives/mesa-dev/2015-March/080286.html commit 490621f0f2814ff1713c74f030acaff3f19cf8fb Author: Antia Puentes <apuentes@igalia.com> Date: Tue Mar 17 19:12:23 2015 +0100 glsl: Update the #line behaviour on GLSL 3.30+ and GLSL ES+ > glsl: respect the source number set by #line <line> <source> > http://lists.freedesktop.org/archives/mesa-dev/2015-March/080287.html commit c0a7014601ca93d30ba9bf1ec3c6d04da904d503 Author: Antia Puentes <apuentes@igalia.com> Date: Tue Mar 17 19:28:25 2015 +0100 glsl: respect the source number set by #line <line> <source> But presumably there's still more to be done for this bug.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/804.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.