Draft multi-threaded image rendering in iced_wgpu

This commit is contained in:
Héctor Ramón Jiménez 2025-10-24 17:23:40 +02:00
parent 92888a3639
commit cb8d2710da
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
22 changed files with 886 additions and 305 deletions

View file

@ -6,9 +6,9 @@ use crate::core::{
self, Background, Color, Font, Image, Pixels, Point, Rectangle, Size, Svg,
Transformation,
};
use crate::graphics;
use crate::graphics::compositor;
use crate::graphics::mesh;
use crate::graphics::{self, Shell};
use std::borrow::Cow;
@ -216,6 +216,7 @@ where
async fn with_backend<W: compositor::Window + Clone>(
settings: graphics::Settings,
compatible_window: W,
shell: Shell,
backend: Option<&str>,
) -> Result<Self, graphics::Error> {
use std::env;
@ -242,8 +243,13 @@ where
let mut errors = vec![];
for backend in candidates.iter().map(Option::as_deref) {
match A::with_backend(settings, compatible_window.clone(), backend)
.await
match A::with_backend(
settings,
compatible_window.clone(),
shell.clone(),
backend,
)
.await
{
Ok(compositor) => return Ok(Self::Primary(compositor)),
Err(error) => {
@ -251,8 +257,13 @@ where
}
}
match B::with_backend(settings, compatible_window.clone(), backend)
.await
match B::with_backend(
settings,
compatible_window.clone(),
shell.clone(),
backend,
)
.await
{
Ok(compositor) => return Ok(Self::Secondary(compositor)),
Err(error) => {