GLSL spec section 4.3.2 says "Initializers for const declarations must be constant expressions". Apparently below 2 examples are not constant expressions, so should not be allowed: piglit/tests/glslparsertest/shaders/constFunc.frag: const vec3 v = vec3(1.0, func()); // user defined functions do not return const value piglit/tests/glslparsertest/shaders/ParseTest3.frag: float f = 1.0; const vec4 v2 = vec4(float(vec4(1,2,3,f))); // f is not constant And below example is not allowed in GLSL v1.10, but allowed starting from GLSL v1.20 (allowing built-in function call whose arguments are all constant expressions): piglit/tests/glslparsertest/shaders/ParseTest3.frag: const vec4 v = vec4(normalize(vec4(1))); // builtIn functions do not return const const vec4 v1 = vec4(clamp(1.0, .20, 3.0)); // builtIn functions do not return const All of above examples are allowed in current mesa.
Fixed with glsl2 merge
verified with mesa master d442a01ac14382d83cdaac87d2832315ceb3e963.
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.