It is advisable to sparingly use branching in shader code.
But glsl in built functions such as clamp , min or max inherently use "if" to determine final value.
My question: If for clamp(x , 0.0, 1.0) we replace it by
.Code :x = (x < 0.0) ? 0.0 : (x > 1.0)? 1.0 : x;
Will this be faster than clamp() ???
similarly, if min() and max() or step() are expanded using "if", will there be a speed slowdown? If yes, then why such built-in functions are fast?



. No need for arithmetic like that. 