Bug 51958 - #line directive extra tokens not recognized
Summary: #line directive extra tokens not recognized
Status: RESOLVED NOTABUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-10 19:09 UTC by scrawl
Modified: 2012-07-20 17:01 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description scrawl 2012-07-10 19:09:00 UTC
Mesa version: 8.1-devel

How to reproduce: Compile a shader that includes a line like this:

#line 5 "/home/user/my-shader.frag"

What should happen: GLSL compiler picks this up and uses this line / file for error reporting

What happens: GLSL compiler exits with the error "0:2(2): preprocessor error: Invalid tokens after #"

The #line directive above is a standard output of the excellent MCPP ( http://mcpp.sourceforge.net/ ) preprocessor, and it is recognized by both NVIDIA and ATI closed drivers.
Comment 1 Ian Romanick 2012-07-20 16:03:38 UTC
This cannot be valid GLSL: the double-quote character isn't a valid character in shaders at all.  It sucks that AMD and NVIDIA accept this.  This is valid C / C++ (mcpp is a C / C++ preprocessor).

Page 16 (page 22 of the PDF) of GLSL 4.20 spec says:


    "#line must have, after macro substitution, one of the following forms:

        #line line
        #line line source-string-number

    where line and source-string-number are constant integer expressions."

"/home/user/my-shader.frag" is not a constant integer expression.
Comment 2 scrawl 2012-07-20 17:01:51 UTC
Okay, then I was mislead by the fact that closed drivers not only allow this line, but also mention in potential error messages that they belong to the file "/home/user/my-shader.frag".


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.