Hi there,
some years ago I read that if-statements should be avoided in shader source to get better performance.
Code :if (UniformTwoSided && Dot < 0.0) { Dot *= Flip; FragNormal *= Flip; }
Is that still the case? And if yes, is that a faster alternative for the code above?
Code :float Flip = UniformTwoSidedFlipVec[int(step(0.0, Dot))]; Dot *= Flip; FragNormal *= Flip;
Code :static const float FlipVec[2][2] = { {1.0f, 1.0f}, {-1.0f, 1.0f} }; glUniform2fv(FlipVecLocation, 1, FlipVec[(int) TwoSided]);
Basically the second code uses a vector and some client side switch
to achieve the same result but makes the code less readable.
Not even sure if it makes it faster so your comments are really welcome!
Thanks!



