[gtk+] vulkan: Compute right size for outset shadow
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] vulkan: Compute right size for outset shadow
- Date: Wed, 18 Jan 2017 15:46:47 +0000 (UTC)
commit cde933ebd971c4d398ac118f62bd76ee243d08eb
Author: Benjamin Otte <otte redhat com>
Date: Wed Jan 18 16:39:27 2017 +0100
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.
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 7b76e53..2b7c94c 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]