Fix Vello rendering the infinite canvas without a white background color (#2361)

Fix infinite canvas for vello

Remove debugging fill

Remove debug log
This commit is contained in:
Dennis Kobert 2025-03-06 12:37:00 +01:00 committed by GitHub
parent e7cde88c04
commit 6becaef980
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 6 deletions

View file

@ -8,7 +8,7 @@ use dyn_any::{DynAny, StaticType};
use gpu_executor::{ComputePassDimensions, GPUConstant, StorageBufferOptions, TextureBufferOptions, TextureBufferType, ToStorageBuffer, ToUniformBuffer};
use graphene_core::application_io::{ApplicationIo, EditorApi, SurfaceHandle};
use graphene_core::transform::{Footprint, Transform};
use graphene_core::{Cow, Node, SurfaceFrame, Type};
use graphene_core::{Color, Cow, Node, SurfaceFrame, Type};
use anyhow::{bail, Result};
use futures::Future;
@ -133,7 +133,7 @@ pub use graphene_core::renderer::RenderContext;
// }
impl WgpuExecutor {
pub async fn render_vello_scene(&self, scene: &Scene, surface: &WgpuSurface, width: u32, height: u32, context: &RenderContext) -> Result<()> {
pub async fn render_vello_scene(&self, scene: &Scene, surface: &WgpuSurface, width: u32, height: u32, context: &RenderContext, background: Color) -> Result<()> {
let surface = &surface.surface.inner;
let surface_caps = surface.get_capabilities(&self.context.adapter);
surface.configure(
@ -151,13 +151,14 @@ impl WgpuExecutor {
);
let surface_texture = surface.get_current_texture()?;
let [r, g, b, _] = background.to_rgba8_srgb();
let render_params = RenderParams {
// We are using an explicit opaque color here to eliminate the alpha premultiplication step
// which would be required to support a transparent webgpu canvas
base_color: vello::peniko::Color::from_rgba8(0x22, 0x22, 0x22, 0xff),
base_color: vello::peniko::Color::from_rgba8(r, g, b, 0xff),
width,
height,
antialiasing_method: AaConfig::Msaa8,
antialiasing_method: AaConfig::Msaa16,
};
{