From 25a82d100f862ea65c3d92a523d3298ee36831ca Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Tue, 6 Aug 2024 11:33:39 +0200 Subject: [PATCH] Set Vello to render an explicit background color behind artboards (#1902) * Set explicit background color * Add todo comment for chrome bug --- node-graph/wgpu-executor/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/node-graph/wgpu-executor/src/lib.rs b/node-graph/wgpu-executor/src/lib.rs index 404e8be0..e8fac332 100644 --- a/node-graph/wgpu-executor/src/lib.rs +++ b/node-graph/wgpu-executor/src/lib.rs @@ -145,7 +145,7 @@ impl WgpuExecutor { width, height, present_mode: surface_caps.present_modes[0], - alpha_mode: surface_caps.alpha_modes[0], + alpha_mode: wgpu::CompositeAlphaMode::Opaque, view_formats: vec![], desired_maximum_frame_latency: 2, }, @@ -153,7 +153,9 @@ impl WgpuExecutor { let surface_texture = surface.get_current_texture()?; let render_params = RenderParams { - base_color: vello::peniko::Color::TRANSPARENT, + // We are using an explicit opaque color here to eliminate the alpha premulitplication step + // which would be required to support a transparent webgpu canvas + base_color: vello::peniko::Color::rgb8(0x22, 0x22, 0x22), width, height, antialiasing_method: AaConfig::Msaa8,