In OpenGL ES 2 you can set an array of strings as the shader source
void ShaderSource( uint shader, sizei count, const char **string, const int *length );
Which can be used to “inject” macros into the shader source. The corresponding function in WebGL only takes a single string as it seems.
void shaderSource(WebGLShader shader, DOMString source)
Is the only possibility to use macros to manually insert them in the source string?
I’m not sure what you mean by
inject macrosis functionally equivalent to
So, in answer to you question. If you want to insert macros prepend them to the string you supply to gl.shaderSource. There’s nothing special about macros and which string they come. As far as GL is concerned it’s just one big string.