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

@ -2,7 +2,7 @@
//! surfaces.
use crate::core::Color;
use crate::futures::{MaybeSend, MaybeSync};
use crate::{Error, Settings, Viewport};
use crate::{Error, Settings, Shell, Viewport};
use raw_window_handle::{HasDisplayHandle, HasWindowHandle};
use thiserror::Error;
@ -21,8 +21,9 @@ pub trait Compositor: Sized {
fn new<W: Window + Clone>(
settings: Settings,
compatible_window: W,
shell: Shell,
) -> impl Future<Output = Result<Self, Error>> {
Self::with_backend(settings, compatible_window, None)
Self::with_backend(settings, compatible_window, shell, None)
}
/// Creates a new [`Compositor`] with a backend preference.
@ -32,6 +33,7 @@ pub trait Compositor: Sized {
fn with_backend<W: Window + Clone>(
_settings: Settings,
_compatible_window: W,
_shell: Shell,
_backend: Option<&str>,
) -> impl Future<Output = Result<Self, Error>>;
@ -153,6 +155,7 @@ impl Compositor for () {
async fn with_backend<W: Window + Clone>(
_settings: Settings,
_compatible_window: W,
_shell: Shell,
_preferred_backend: Option<&str>,
) -> Result<Self, Error> {
Ok(())