(GLSL) Flat keyword support in WebGL2?

According to this blog post, the flat keyword was introduced in WebGL 2 when using GLSL versions 3 and up. However when attempting to use it in my (vertex) shader:

flat varying vec3 normal;

I get:

ERROR: 0:11: 'flat' : Illegal use of reserved word 

Weirder, when I try something like:

out vec3 normal;

I the error:

'out' : storage qualifier supported in GLSL ES 3.00 and above only 

Which is very strange because I know for sure that the compiled shader has the version definition at the top, because when I print out the shader chunk I can see it’s prefixed with:

#version 300 es
#define attribute in
#define varying out
#define texture2D texture
#define GL2

Any idea what’s wrong?

1 Like