Open kas1e opened 5 years ago
Yes, indeed. Because th eshader is generated, in many possible case the final Alpha color can only be known after the fetch of the texel. Still, I agree that in some cases like this one, doing the discard before may help perf. I'll see if I can do something.
Wasn't that optimization take place in all the recent work last year ?:) Just if so we can close this one.
Nope, this particular optimization is not in place in fpe_shader for now. It's a bit tricky to do (but I do have some idea on how to implement it without to much changes). Maybe a bit later (I am doing some refactoring on VertexAttribute for now...).
When we test Lugaru, we found that gl4es created such fragment shader
And one of devs says: I don't know how clever those GLSL compilers are, but it seems to me that it might be possible to discard the fragment before texture is sampled and color multiplied, i.e:
But probabaly it done like this just because you need to cope with all the situations, so the generated shaders can't be 100% optimized ?