Remove unnecessary branch in trail shader

Branches have an outsize penalty in shaders as does discard. We don't
need the check that the fragment is in the region anyway ans the
rendering pipeline takes care of that for us, I think. At least I can
see no visual difference with it removed.

@jinhwanlazy please review
This commit is contained in:
Kovid Goyal 2024-12-11 21:14:57 +05:30
parent 29040d719c
commit 4b12bffcb1
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -7,10 +7,5 @@ in vec2 frag_pos;
out vec4 final_color;
void main() {
if (cursor_edge_x[0] <= frag_pos.x && frag_pos.x <= cursor_edge_x[1] &&
cursor_edge_y[1] <= frag_pos.y && frag_pos.y <= cursor_edge_y[0]) {
discard;
} else {
final_color = vec4(trail_color, trail_opacity);
}
final_color = vec4(trail_color, trail_opacity);
}