mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 05:15:00 +00:00
Remove artifact when a border side was not rendered
This introduces an extra conditional in the shader, there's probably a way of writing it without ifs but I like how the logic reads with it and it shouldn't be that big of a deal performance-wise.
This commit is contained in:
parent
32c070250c
commit
3de0ce6079
1 changed files with 12 additions and 6 deletions
|
@ -73,12 +73,18 @@ fragment float4 quad_fragment(
|
|||
border_width = center_to_point.y <= 0.0 ? input.quad.border_top : input.quad.border_bottom;
|
||||
}
|
||||
|
||||
float inset_distance = distance + border_width;
|
||||
float4 color = mix(
|
||||
coloru_to_colorf(input.quad.border_color),
|
||||
coloru_to_colorf(input.quad.background_color),
|
||||
saturate(0.5 - inset_distance)
|
||||
);
|
||||
float4 color;
|
||||
if (border_width == 0.) {
|
||||
color = coloru_to_colorf(input.quad.background_color);
|
||||
} else {
|
||||
float inset_distance = distance + border_width;
|
||||
color = mix(
|
||||
coloru_to_colorf(input.quad.border_color),
|
||||
coloru_to_colorf(input.quad.background_color),
|
||||
saturate(0.5 - inset_distance)
|
||||
);
|
||||
}
|
||||
|
||||
float4 coverage = float4(1.0, 1.0, 1.0, saturate(0.5 - distance));
|
||||
return coverage * color;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue