Reading from `out` function argument in GLSL

  Kiến thức lập trình

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.”)

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT