glsl-man
glsl-man copied to clipboard
Failures with macro functions
I'm back
glsl.parse(`void main(){
#define thing(a, b, c) \
{ \
a *= b+c; \
}
uint a = 2u;
}`)
Error:
uint a = 2u;
^
Expected "(" but "a" found.
It also fails with single line macros without { }, although the error is different I think.
This is a fun one: three problems in one. First, indeed multi-line macros fail to parse and also the code generator did not generate parameter lists for macros. The above example unfortunately does not produce a multi-line macro, but it seems to cause a different issue where parsing fails if a variable declaration after a define has leading indentation.
I have to admit, it's a bit of a head scratcher, so I will have to look at this with rested eyes.