In GLSL, is it legal for a function to read from an out
argument, after it has already written to it?
For example
void f(out float x) {
x = ...
x = sqrt(x);
}
Or is it needed to write it as
void f(out float output_x) {
float x = ...
output_x = sqrt(x);
}
It seems to work correctly when testing, but the specification seems to say nothing specifically about this. (only “Evaluation of an out
parameter results in an l-value that is used to copy out a value when the function returns.”)