Bug 29164 - [GLSL 1.20] invariant variable shouldn't be used before declaration
[GLSL 1.20] invariant variable shouldn't be used before declaration
Product: Mesa
Classification: Unclassified
Component: glsl-compiler
All Linux (All)
: low normal
Assigned To: Ian Romanick
Depends on:
  Show dependency treegraph
Reported: 2010-07-20 00:30 UTC by Gordon Jin
Modified: 2011-02-11 21:41 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Note You need to log in before you can comment on or make changes to this bug.
Description Gordon Jin 2010-07-20 00:30:39 UTC
piglit/tests/glslparsertest/glsl2/invariant-05.vert has been failed since committed on July 1st, with either mesa master branch or glsl2 branch: It's expected to be compiled fail, but it gets compiled successfully.

Tested on Piketon.


/* FAIL -
 * From page 27 (page 33 of the PDF) of the GLSL 1.20 spec:
 *     "All uses of invariant must be at the global scope, and before any use
 *     of the variables being declared as invariant."
#version 120

void main() 
  gl_Position = gl_Vertex;

invariant gl_Position;
Comment 1 Gordon Jin 2010-12-15 17:39:25 UTC
it still fails now.
Comment 2 Chad Versace 2011-01-10 15:48:39 UTC
If the IR were to maintain the source location of each variable's declarations and usages, the bugfix would not be difficult. With the IR's status quo, though, I don't see a good fix.
Comment 3 Ian Romanick 2011-01-10 17:23:38 UTC
I marked the bug as assigned because I'm working a fix for this and some related issues.
Comment 4 Ian Romanick 2011-01-25 17:40:05 UTC
Fixed by 48e81e3b9eb8b880cd702a4ca3237101e3bc6f2d (7.9) and aff41708493f9145c4f424e4b37e76978e78a1c4 (7.10).
Comment 5 Gordon Jin 2011-02-11 21:41:31 UTC