render/blur: Fix div-by-zero in shaders
This commit is contained in:
parent
43d6145afd
commit
f424abbc29
2 changed files with 10 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue