From 7f0883b383b73af7bc68dcf8c2ee845c5eab5807 Mon Sep 17 00:00:00 2001 From: Erik Reider <35975961+ErikReider@users.noreply.github.com> Date: Tue, 27 Feb 2024 18:05:58 +0100 Subject: [FX Renderer] Add blur (#30) * Initial blur implementation * Added additional blur effects from SwayFX * Simplified blur pass functions to match the other pass functions * Minor fixes * Added support for optimized blur * tinywl: Don't set decoration values every frame * Updated public blur function docs * Simplified blur buffer management * Moved ignore transparent bool into a per buffer option * Clip the scene_buffer when blur is enabled * Added back corner and shadow checks in opaque_region function * Renamed fx_render_blur_options to fx_render_blur_pass_options * Fixed nits * Removed unused fx_framebuffer_bind_wlr_fbo function * Removed wlr_scene impl. Should be moved into future PR instead * Made blur impl independent of wlr_scene * Moved shader init back into fx_renderer.c * Renamed fx_framebuffer_get_or_create_bufferless to fx_framebuffer_get_or_create_custom --- render/fx_renderer/gles2/shaders/stencil_mask.frag | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'render/fx_renderer/gles2/shaders/stencil_mask.frag') diff --git a/render/fx_renderer/gles2/shaders/stencil_mask.frag b/render/fx_renderer/gles2/shaders/stencil_mask.frag index 523adc8..e1fd76a 100644 --- a/render/fx_renderer/gles2/shaders/stencil_mask.frag +++ b/render/fx_renderer/gles2/shaders/stencil_mask.frag @@ -11,12 +11,12 @@ uniform vec2 position; uniform float radius; void main() { - vec2 q = abs(gl_FragCoord.xy - position - half_size) - half_size + radius; - float dist = min(max(q.x,q.y), 0.0) + length(max(q, 0.0)) - radius; - float smoothedAlpha = 1.0 - smoothstep(-1.0, 0.5, dist); - gl_FragColor = mix(vec4(0.0), vec4(1.0), smoothedAlpha); + vec2 q = abs(gl_FragCoord.xy - position - half_size) - half_size + radius; + float dist = min(max(q.x,q.y), 0.0) + length(max(q, 0.0)) - radius; + float smoothedAlpha = 1.0 - smoothstep(-1.0, 0.5, dist); + gl_FragColor = mix(vec4(0.0), vec4(1.0), smoothedAlpha); - if (gl_FragColor.a < 1.0) { - discard; - } + if (gl_FragColor.a < 1.0) { + discard; + } } -- cgit v1.2.3