Update Wasm dependencies to fix WebGPU spec change crash in Firefox with Vello (#2027)

* Update wasm deps

* Bump wasm-bindgen and fix the depricated methods
This commit is contained in:
James Lindsay
2024-10-12 22:28:39 +01:00
committed by GitHub
parent f7d83d2632
commit 3b0e9587eb
8 changed files with 425 additions and 444 deletions

View File

@@ -78,14 +78,14 @@ impl Hash for TextureFrame {
fn hash<H: Hasher>(&self, state: &mut H) {
self.transform.to_cols_array().iter().for_each(|x| x.to_bits().hash(state));
#[cfg(feature = "wgpu")]
self.texture.global_id().hash(state);
self.texture.hash(state);
}
}
impl PartialEq for TextureFrame {
fn eq(&self, other: &Self) -> bool {
#[cfg(feature = "wgpu")]
return self.transform.eq(&other.transform) && self.texture.global_id() == other.texture.global_id();
return self.transform.eq(&other.transform) && self.texture == other.texture;
#[cfg(not(feature = "wgpu"))]
self.transform.eq(&other.transform)

View File

@@ -793,13 +793,7 @@ impl GraphicElementRendered for ImageFrame<Color> {
if image.data.is_empty() {
return;
}
let image = vello::peniko::Image {
data: image.to_flat_u8().0.into(),
width: image.width,
height: image.height,
format: peniko::Format::Rgba8,
extend: peniko::Extend::Repeat,
};
let image = vello::peniko::Image::new(image.to_flat_u8().0.into(), peniko::Format::Rgba8, image.width, image.height).with_extend(peniko::Extend::Repeat);
let transform = transform * self.transform * DAffine2::from_scale(1. / DVec2::new(image.width as f64, image.height as f64));
scene.draw_image(&image, vello::kurbo::Affine::new(transform.to_cols_array()));
@@ -876,23 +870,11 @@ impl GraphicElementRendered for Raster {
if image.data.is_empty() {
return;
}
let image = vello::peniko::Image {
data: image.to_flat_u8().0.into(),
width: image.width,
height: image.height,
format: peniko::Format::Rgba8,
extend: peniko::Extend::Repeat,
};
let image = vello::peniko::Image::new(image.to_flat_u8().0.into(), peniko::Format::Rgba8, image.width, image.height).with_extend(peniko::Extend::Repeat);
(image, image_frame.alpha_blending)
}
Raster::Texture(texture) => {
let image = vello::peniko::Image {
data: vec![].into(),
width: texture.texture.width(),
height: texture.texture.height(),
format: peniko::Format::Rgba8,
extend: peniko::Extend::Repeat,
};
let image = vello::peniko::Image::new(vec![].into(), peniko::Format::Rgba8, texture.texture.width(), texture.texture.height()).with_extend(peniko::Extend::Repeat);
let id = image.data.id();
context.ressource_overrides.insert(id, texture.texture.clone());
(image, texture.alpha_blend)