Does the GLSL sign() function cause branching and how does it work?

Viewed 3034

It seems like some functions that have outputs in cases might use an if statement as the underlying implementation, thus causing branching. I don't think it does, but I wonder.

For sign(x), if the number is positive, negative, or zero, it reruns 1, -1 and 0 respectively.

So how does this function work?

1 Answers
Related