GLSL always uses copying, but this doesn't have the same performance implications as C++. In particular, because there is no recursion, there isn't a stack, and typically either functions are inlined and optimized there by the GLSL compiler, or parameters are in fixed register locations and copying is unnecessary.
Note that passing by const& in C++ is completely different from "passing by reference." In passing by reference, the function is allowed to change the argument, and these changes are visible to the calling function. "inout
" achieves a similar result, but is not quite the same as vec4& in C++ if you pass the same variable to different parameters of a function.
vec4
is a primitive type in GLSL, you can expect it to behave like a int
or float
for performance. Finally, vec4 is only 128 bits, which is one or two cycles to copy.