A shader like #define defined gl_Position void main() { defined = vec4(1.0); } should either file to compile at line 1 or it should "just work." Instead, Mesa produces a fairly obtuse error message: 0:5(2): error: `defined' undeclared 0:5(2): error: value of type vec4 cannot be assigned to variable of type error Apparently some dEQP test expects '#define defined' and '#undef defined' to just work, but glslang generates an error. See also https://github.com/KhronosGroup/glslang/issues/59. Either way, Mesa's behavior is wrong.
deqp strikes again with completely absurd tests. I'm relieved, reading the github issue that C/C++ say that 'defined' is not macro name, and that glslang has merged a patch to reject such stupidity.
I posted a patch to disallow this on mesa-dev: https://lists.freedesktop.org/archives/mesa-dev/2016-February/108008.html Given that GCC, Clang, and now glslang disallow it, it seems pretty clear what the right behavior ought to be. Nothing good can come from making this work.
Fixed in master: commit 1c694a6c20da21f31c584fd41d28e2f03522617d Author: Kenneth Graunke <kenneth@whitecape.org> Date: Wed Feb 17 17:15:23 2016 -0800 glcpp: Disallow "defined" as a macro name. Both GCC and Clang disallow this, and glslang has recently started disallowing it as well. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94188 Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> unless of course we have to make #define defined actually work, but hopefully not, because that would be silly and pointless. We can always reopen or something if that happens.
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.