<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 - Incorrect handling of GLSL #line directive"
href="https://bugs.freedesktop.org/show_bug.cgi?id=88815">88815</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incorrect handling of GLSL #line directive
</td>
</tr>
<tr>
<th>Product</th>
<td>Mesa
</td>
</tr>
<tr>
<th>Version</th>
<td>10.1
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>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>idr@freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>willusher.life@gmail.com
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>intel-3d-bugs@lists.freedesktop.org
</td>
</tr></table>
<p>
<div>
<pre>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`
<span class="quote">> 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.</span >
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:
<span class="quote">> 0:2(1): error: syntax error, unexpected NEW_IDENTIFIER</span >
>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:
<span class="quote">> 4(1) : warning C7022: unrecognized profile specifier "not_valid"
> 4(1) : error C0502: syntax error at token "not_valid"</span >
Information about my Mesa & GL version:
<span class="quote">> 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</span >
Thanks!</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>