Search code examples
openglglslshaderc-preprocessor

Is variadic macro expansion possible in GLSL?


In C99 we have variadic macro expansion via the #define XXX(...) __VA_ARGS__ syntax.

This doesn't seem to work in GLSL. Is there a similar mechanism with different syntax? Is this implementation specific?


Solution

  • The GLSL specification borrows most of its preprocessor behavior from C++. Specifically, C++98. As such, it does not have variadic macros. Nor does it have anything like them.