Desktop GLSL allows things like uniform int foo; int bar = foo + 10; void main() { ... } However, the GLSL ES 3.0 and 3.1 specifications have the following language in section 4.3: "Initializers may only be used in declarations of globals with no storage qualifier or with a const qualifier. Such initializers must be a constant expression." There is anecdotal evidence that other implementations, at least on Android, enforce this restriction. At the very least, we should emit a portability warning. We probably should emit an error (in GLSL ES only) and have a driconf option to disable.
Looks like this is a duplicate of Bug 92304. Piglit tests which testing this are fixed now: spec/glsl-es-1.00/compiler/global-initializer/from-attribute.vert spec/glsl-es-1.00/compiler/global-initializer/from-uniform.vert spec/glsl-es-1.00/compiler/global-initializer/from-uniform.frag spec/glsl-es-1.00/compiler/global-initializer/from-global.vert spec/glsl-es-1.00/compiler/global-initializer/from-global.frag spec/glsl-es-1.00/compiler/global-initializer/from-varying.frag spec/glsl-es-3.00/compiler/global-initializer/from-uniform.vert spec/glsl-es-3.00/compiler/global-initializer/from-uniform.frag spec/glsl-es-3.00/compiler/global-initializer/from-in.vert spec/glsl-es-3.00/compiler/global-initializer/from-in.frag spec/glsl-es-3.00/compiler/global-initializer/from-global.vert spec/glsl-es-3.00/compiler/global-initializer/from-global.frag
Ian, please close if this is a dup
*** This bug has been marked as a duplicate of bug 92304 ***
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.