Aeva / m.grl

Midnight Graphics & Recreation Library
http://mgrl.midnightsisters.org
GNU Lesser General Public License v3.0
44 stars 3 forks source link

glsl complier doesn't support single-line multiple assignment for globals #202

Open Aeva opened 8 years ago

Aeva commented 8 years ago

Not a terribly high priority because this is groady syntax and I'm not sure I want to support it anyway, but documenting it here for the moment. Basically, this line can't work with the current compiler:

const float a=10.0, b=20.0, c=30.0;

The problem is hereish, wherein the compiler will use a regex to try to match a global variable declaration, and assumes that ";" or "=" ends the declaration.

Fixing this will probably mean that things will need to change so that the regex matches all the way to the semicolon, and that "=" can be terminated by "," or ";", and have different behavior depending on which.

The current system supports the following just fine though, so please use it instead for now:

const float a=10.0;
const float b=20.0;
const float c=30.0;

Also note that initializing multiple values works, so the following is totally fine:

uniform float some_var, some_array[32], some_other_var;