render/blur: Fix div-by-zero in shaders

This commit is contained in:
Victoria Brekenfeld 2026-05-22 17:15:16 +02:00 committed by Victoria Brekenfeld
parent 43d6145afd
commit f424abbc29
2 changed files with 10 additions and 2 deletions

View file

@ -22,5 +22,9 @@ void main() {
sum += texture2D(tex, v_coords + vec2(half_pixel.x, -half_pixel.y) * offset);
sum += texture2D(tex, v_coords - vec2(half_pixel.x, -half_pixel.y) * offset);
gl_FragColor = sum / sum.a;
if (sum.a == 0.0) {
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
} else {
gl_FragColor = sum / sum.a;
}
}

View file

@ -23,5 +23,9 @@ void main() {
sum += texture2D(tex, v_coords + vec2(0.0, -half_pixel.y * 2.0) * offset);
sum += texture2D(tex, v_coords + vec2(-half_pixel.x, -half_pixel.y) * offset) * 2.0;
gl_FragColor = sum / sum.a;
if (sum.a == 0.0) {
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
} else {
gl_FragColor = sum / sum.a;
}
}