From dd996adbcb76e1f35b4f44f3759728e589007e8b Mon Sep 17 00:00:00 2001 From: Timon Date: Thu, 3 Dec 2026 23:06:25 +0000 Subject: [PATCH] Take the premultiplied render target from the texture pool (fixup #4807) --- .../wgpu-executor/src/vello_render.rs | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/node-graph/libraries/wgpu-executor/src/vello_render.rs b/node-graph/libraries/wgpu-executor/src/vello_render.rs index 8dac9856e4..460fbd97be 100644 --- a/node-graph/libraries/wgpu-executor/src/vello_render.rs +++ b/node-graph/libraries/wgpu-executor/src/vello_render.rs @@ -55,8 +55,6 @@ pub(crate) struct VelloRenderer { pub struct VelloCanvas { /// Scenes to draw into, one for each depth of effects groups nested in a render, reused between renders to keep their allocations. spare_scenes: Vec, - /// The premultiplied texture Vello GPU renders into before conversion to straight alpha, kept while the render size stays the same. - premultiplied_target: Option, images: ImageTextures, effect_textures: EffectTextures, } @@ -357,21 +355,10 @@ impl RenderContext<'_> { // Vello GPU renders premultiplied, which is converted to straight alpha unless the target wants it premultiplied let target_view = target.create_view(&wgpu::TextureViewDescriptor::default()); - let premultiplied_view = match (target_alpha, &self.canvas.premultiplied_target) { - (TargetAlpha::Premultiplied, _) => target_view.clone(), - (TargetAlpha::Straight, Some(texture)) if texture.width() == size.x && texture.height() == size.y => texture.create_view(&wgpu::TextureViewDescriptor::default()), - (TargetAlpha::Straight, _) => { - let texture = create_texture( - device, - "vello_gpu_premultiplied_target", - size, - TEXTURE_FORMAT, - wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::TEXTURE_BINDING, - ); - let view = texture.create_view(&wgpu::TextureViewDescriptor::default()); - self.canvas.premultiplied_target = Some(texture); - view - } + let premultiplied_target = (target_alpha == TargetAlpha::Straight).then(|| self.executor.request_texture(size)); + let premultiplied_view = match &premultiplied_target { + Some(texture) => texture.create_view(&wgpu::TextureViewDescriptor::default()), + None => target_view.clone(), }; let target_init = TargetInit::Clear(ClearSettings::Viewport { color: peniko::Color::TRANSPARENT });