1

I have this defined outside of any functions in a shader.
I get the error Expected initialization of constant

const vec2 rels[4] = {
    vec2(-1.0, 0.0),
    vec2(1.0, 0.0),
    vec2(0.0, -1.0),
    vec2(0.0, 1.0)
};  

But in the godot documentation I can see it shows initializing an array of vec2 in a function scope and a const array of scalars in the global scope.
Is it possible that initializing an array of vec2 in the global scope is not supported?

Petruza
  • 11,744
  • 25
  • 84
  • 136
  • 1
    After testing, it appears that const arrays are only supported inside function bodies, not in global scope. I think you can report this as a bug at https://github.com/godotengine/godot/issues - Either this was an oversight on the implementation, or the documentation needs to address this. A bug either way. – Theraot Jun 22 '21 at 17:13

0 Answers0