diff options
author | Benjamin Otte <otte@redhat.com> | 2017-01-18 16:39:27 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2017-01-18 16:39:27 +0100 |
commit | cde933ebd971c4d398ac118f62bd76ee243d08eb (patch) | |
tree | 3f8eac58bf4129417d8fc4b66c804767337999d1 /gsk | |
parent | fb47a8d714f075130c944cc5a3d38a4757c902dd (diff) | |
download | gtk+-cde933ebd971c4d398ac118f62bd76ee243d08eb.tar.gz |
vulkan: Compute right size for outset shadow
We were emitting the box and not the shadow box as the rectangle. So we
didn't draw any shadows. Oops.
Diffstat (limited to 'gsk')
-rw-r--r-- | gsk/resources/vulkan/outset-shadow.vert | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gsk/resources/vulkan/outset-shadow.vert b/gsk/resources/vulkan/outset-shadow.vert index 7b76e532d5..2b7c94c00f 100644 --- a/gsk/resources/vulkan/outset-shadow.vert +++ b/gsk/resources/vulkan/outset-shadow.vert @@ -17,6 +17,7 @@ layout(location = 3) out flat vec4 outOutlineCornerHeights; layout(location = 4) out flat vec4 outColor; layout(location = 5) out flat vec2 outOffset; layout(location = 6) out flat float outSpread; +layout(location = 7) out flat float outBlurRadius; out gl_PerVertex { vec4 gl_Position; @@ -29,8 +30,16 @@ vec2 offsets[6] = { vec2(0.0, 0.0), vec2(1.0, 0.0), vec2(1.0, 1.0) }; +float radius_pixels(float radius) { + return radius * (3.0 * sqrt(2 * 3.141592653589793) / 4) * 1.5; +} + void main() { - vec4 rect = clip (inOutline); + vec4 rect = inOutline; + float spread = inSpread + radius_pixels(inBlurRadius); + rect += vec4(inOffset - spread, vec2(2 * spread)); + + clip (inOutline); vec2 pos = rect.xy + rect.zw * offsets[gl_VertexIndex]; gl_Position = push.mvp * vec4 (pos, 0.0, 1.0); @@ -42,4 +51,5 @@ void main() { outColor = inColor; outOffset = inOffset; outSpread = inSpread; + outBlurRadius = inBlurRadius; } |