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

@ -1,4 +1,4 @@
use crate::graphics::Antialiasing;
use crate::graphics::{Antialiasing, Shell};
use crate::primitive;
use crate::quad;
use crate::text;
@ -18,6 +18,7 @@ pub struct Engine {
#[cfg(any(feature = "image", feature = "svg"))]
pub(crate) image_pipeline: crate::image::Pipeline,
pub(crate) primitive_storage: Arc<RwLock<primitive::Storage>>,
_shell: Shell,
}
impl Engine {
@ -27,6 +28,7 @@ impl Engine {
queue: wgpu::Queue,
format: wgpu::TextureFormat,
antialiasing: Option<Antialiasing>, // TODO: Initialize AA pipelines lazily
shell: Shell,
) -> Self {
Self {
format,
@ -52,14 +54,16 @@ impl Engine {
device,
queue,
_shell: shell,
}
}
#[cfg(any(feature = "image", feature = "svg"))]
pub fn create_image_cache(
&self,
device: &wgpu::Device,
) -> crate::image::Cache {
self.image_pipeline.create_cache(device)
pub fn create_image_cache(&self) -> crate::image::Cache {
self.image_pipeline.create_cache(
&self.device,
&self.queue,
&self._shell,
)
}
}