From 1681ed16d91757d98dc3eb653b970e706ff84b78 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Mon, 22 Apr 2024 19:05:11 +0400 Subject: Change custom-shader to a prelude-epilogue system --- wiki/Configuration:-Animations.md | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'wiki/Configuration:-Animations.md') diff --git a/wiki/Configuration:-Animations.md b/wiki/Configuration:-Animations.md index 8c933fdd..440d10fa 100644 --- a/wiki/Configuration:-Animations.md +++ b/wiki/Configuration:-Animations.md @@ -234,31 +234,23 @@ See [this example shader](./examples/resize-custom-shader.frag) for a full docum If a custom shader fails to compile, niri will print a warning and fall back to the default, or previous successfully compiled shader. -> [!NOTE] +> [!WARNING] > > Custom shaders do not have a backwards compatibility guarantee. > I may need to change their interface as I'm developing new features. +Example: resize will show the next (after resize) window texture right away, stretched to the current geometry. + ``` animations { window-resize { spring damping-ratio=1.0 stiffness=800 epsilon=0.0001 custom-shader r" - #version 100 - precision mediump float; - - varying vec2 v_coords; - uniform mat3 input_to_curr_geo; - uniform sampler2D tex_next; - uniform mat3 geo_to_tex_next; - uniform float alpha; - - void main() { - vec3 coords_curr_geo = input_to_curr_geo * vec3(v_coords, 1.0); - vec3 coords_tex_next = geo_to_tex_next * coords_curr_geo; - vec4 color = texture2D(tex_next, vec2(coords_tex_next)); - gl_FragColor = color * alpha; + vec4 resize_color(vec3 coords_curr_geo, vec3 size_curr_geo) { + vec3 coords_tex_next = niri_geo_to_tex_next * coords_curr_geo; + vec4 color = texture2D(niri_tex_next, coords_tex_next.st); + return color; } " } -- cgit