Shader optimization: Is a ternary operator equivalent to branching?
I'm working on a vertex shader in which I want to conditionally drop some vertices: float visible = texture(VisibleTexture, index).x; if (visible > threshold) gl_Vertex.z = 9999; // send out of frustum I know that branches kill performance when there's little commonality between neighboring data. In this case, every other vertex may get a different 'visible' value, which would be bad for the performance of the local shader core cluster (from my understanding). To my question: Is a ternary operator better (irrespective of readability issues)? float visible = texture(VisibleTexture, index).x; gl