summaryrefslogtreecommitdiffstats
path: root/glow/src/shader/quad.frag
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-05-21 01:01:47 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-05-21 01:01:47 +0200
commitd77492c0c37dec1207049b340a318e263cb96b82 (patch)
tree334cb0e1b0ac0a997ad05334290e9522d2e8c3d3 /glow/src/shader/quad.frag
parente0e4ee73feead3f05730625c7e1917b63f0b384e (diff)
downloadiced-d77492c0c37dec1207049b340a318e263cb96b82.tar.gz
iced-d77492c0c37dec1207049b340a318e263cb96b82.tar.bz2
iced-d77492c0c37dec1207049b340a318e263cb96b82.zip
Avoid relying `origin_upper_left`
It seems to cause considerable glitches when resizing.
Diffstat (limited to '')
-rw-r--r--glow/src/shader/quad.frag9
1 files changed, 6 insertions, 3 deletions
diff --git a/glow/src/shader/quad.frag b/glow/src/shader/quad.frag
index d9e74664..17e7216f 100644
--- a/glow/src/shader/quad.frag
+++ b/glow/src/shader/quad.frag
@@ -1,6 +1,7 @@
#version 450
-layout(origin_upper_left) in vec4 gl_FragCoord;
+layout(location = 2) uniform float u_Screen_Height;
+
layout(location = 0) in vec4 v_Color;
layout(location = 1) in vec4 v_BorderColor;
layout(location = 2) in vec2 v_Pos;
@@ -31,12 +32,14 @@ float distance(in vec2 frag_coord, in vec2 position, in vec2 size, float radius)
void main() {
vec4 mixed_color;
+ vec2 fragCoord = vec2(gl_FragCoord.x, u_Screen_Height - gl_FragCoord.y);
+
// TODO: Remove branching (?)
if(v_BorderWidth > 0) {
float internal_border = max(v_BorderRadius - v_BorderWidth, 0);
float internal_distance = distance(
- gl_FragCoord.xy,
+ fragCoord,
v_Pos + vec2(v_BorderWidth),
v_Scale - vec2(v_BorderWidth * 2.0),
internal_border
@@ -54,7 +57,7 @@ void main() {
}
float d = distance(
- gl_FragCoord.xy,
+ fragCoord,
v_Pos,
v_Scale,
v_BorderRadius