This commit is contained in:
2025-11-29 22:08:29 +01:00
parent 18d4e448b8
commit 0ce5f92afd

View File

@@ -32,7 +32,6 @@ enum BlurVariant {
True {
fx_buffers: EffectsFramebufffersUserData,
config: niri_config::Blur,
damage_at: RefCell<Option<Instant>>,
},
}
@@ -146,7 +145,6 @@ impl Blur {
BlurVariant::True {
fx_buffers: fx_buffers.clone(),
config: self.config,
damage_at: Default::default(),
}
} else {
BlurVariant::Optimized {
@@ -166,7 +164,6 @@ impl Blur {
BlurVariant::True {
fx_buffers: fx_buffers.clone(),
config: self.config,
damage_at: Default::default(),
}
} else {
BlurVariant::Optimized {
@@ -185,23 +182,12 @@ impl Blur {
&& inner.corner_radius == corner_radius
&& inner.render_loc == render_loc
{
let should_rerender = match &inner.variant {
BlurVariant::Optimized { texture }
if !matches!(&inner.variant, BlurVariant::Optimized { texture }
if texture.size().w == fx_buffers.output_size().w
&& texture.size().h == fx_buffers.output_size().h =>
{
false
}
BlurVariant::True {
damage_at: rerender_at,
..
} if rerender_at.borrow().is_none_or(|r| r > Instant::now()) => false,
_ => true,
};
if should_rerender {
&& texture.size().h == fx_buffers.output_size().h)
{
// If we are true blur, or if our output size changed, we need to re-render.
// TODO: is there a better solution for true blur?
// PERF: is there a better solution for true blur?
inner.damage_all();
}
@@ -436,13 +422,7 @@ impl RenderElement<GlesRenderer> for BlurRenderElement {
Some(&program),
&self.uniforms,
),
BlurVariant::True {
fx_buffers,
config,
damage_at,
} => {
damage_at.set(get_rerender_at());
BlurVariant::True { fx_buffers, config } => {
let mut fx_buffers = fx_buffers.borrow_mut();
fx_buffers.current_buffer = CurrentBuffer::Normal;