summaryrefslogtreecommitdiff
path: root/gsk/resources
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2018-01-15 10:55:40 +0100
committerTimm Bäder <mail@baedert.org>2018-01-15 10:56:43 +0100
commit4946810960f2cca865961ecb87d87c7584be3ccf (patch)
tree351eef9c964d0e42cd9d5829b849218f2c037328 /gsk/resources
parentdf35d00a1d107fa4871765bcb9f47efa0d12195e (diff)
downloadgtk+-4946810960f2cca865961ecb87d87c7584be3ccf.tar.gz
gl renderer: Render unblurred outset shadows differently
We don't need to draw anything to a texure for those.
Diffstat (limited to 'gsk/resources')
-rw-r--r--gsk/resources/glsl/unblurred_outset_shadow.fs.glsl25
1 files changed, 25 insertions, 0 deletions
diff --git a/gsk/resources/glsl/unblurred_outset_shadow.fs.glsl b/gsk/resources/glsl/unblurred_outset_shadow.fs.glsl
new file mode 100644
index 0000000000..1ae48ecb49
--- /dev/null
+++ b/gsk/resources/glsl/unblurred_outset_shadow.fs.glsl
@@ -0,0 +1,25 @@
+uniform float u_spread;
+uniform vec4 u_color;
+uniform vec2 u_offset;
+uniform vec4 u_outline;
+uniform vec4 u_corner_widths;
+uniform vec4 u_corner_heights;
+
+
+void main() {
+ vec4 f = gl_FragCoord;
+
+ f.x += u_viewport.x;
+ f.y = (u_viewport.y + u_viewport.w) - f.y;
+
+ RoundedRect outline = RoundedRect(vec4(u_outline.xy, u_outline.xy + u_outline.zw),
+ u_corner_widths, u_corner_heights);
+ RoundedRect inside = rounded_rect_shrink(outline, vec4(u_spread));
+
+ vec2 offset = vec2(u_offset.x, - u_offset.y);
+ vec4 color = vec4(u_color.rgb * u_color.a, u_color.a);
+ color = color * clamp (rounded_rect_coverage (outline, f.xy - offset) -
+ rounded_rect_coverage (inside, f.xy),
+ 0.0, 1.0);
+ setOutputColor(color * u_alpha);
+}