Bug 29164

Summary: [GLSL 1.20] invariant variable shouldn't be used before declaration
Product: Mesa Reporter: Gordon Jin <gordon.jin>
Component: glsl-compilerAssignee: Ian Romanick <idr>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: low CC: chadversary
Version: git   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

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.



invariant-05.vert:

/* 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
verified

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.