I have heard many times that if statements in shaders slow down the gpu massively. But I also heard that texture samples are very expensive.
Which one is more endurable? Which one is less impactful?
I am asking, because I need to decide on if I should multiply a value by 0, or put an if statement.
I’ve heard that using
mix()
instead (or whatever GDShader calls that GLSL function) can be more performant, since it doesn’t branch. Is that true?@PoolloverNathan Afaik that is true, yes! mix is the same instruction for all fragments, so if you can replace a branching if with a mix that should be an improvement