mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-29 19:01:31 +11:00
crt-royale: Fix division by zero when border is 0.
When border size is 0, a division by zero causes the border to become infinitely large. Special-case this.
This commit is contained in:
parent
4d97229d22
commit
316b234b09
|
@ -679,6 +679,8 @@ float get_border_dim_factor(const float2 video_uv, const float2 geom_aspect)
|
||||||
const float2 border_penetration =
|
const float2 border_penetration =
|
||||||
max(float2(border_size) - edge_dists, float2(0.0));
|
max(float2(border_size) - edge_dists, float2(0.0));
|
||||||
const float penetration_ratio = length(border_penetration)/border_size;
|
const float penetration_ratio = length(border_penetration)/border_size;
|
||||||
|
if (border_size == 0.0)
|
||||||
|
penetration_ratio = 0.0;
|
||||||
const float border_escape_ratio = max(1.0 - penetration_ratio, 0.0);
|
const float border_escape_ratio = max(1.0 - penetration_ratio, 0.0);
|
||||||
const float border_dim_factor =
|
const float border_dim_factor =
|
||||||
pow(border_escape_ratio, border_darkness) * max(1.0, border_compress);
|
pow(border_escape_ratio, border_darkness) * max(1.0, border_compress);
|
||||||
|
|
Loading…
Reference in a new issue