From 1f13a91361258a1607c71f4840a26a6437f88612 Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector@hecrj.dev>
Date: Fri, 22 Mar 2024 05:27:31 +0100
Subject: Make `iced_tiny_skia` optional with a `tiny-skia` feature

---
 wgpu/src/primitive/pipeline.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'wgpu/src/primitive/pipeline.rs')

diff --git a/wgpu/src/primitive/pipeline.rs b/wgpu/src/primitive/pipeline.rs
index c6b7c5e2..814440ba 100644
--- a/wgpu/src/primitive/pipeline.rs
+++ b/wgpu/src/primitive/pipeline.rs
@@ -1,5 +1,5 @@
 //! Draw primitives using custom pipelines.
-use crate::core::{Rectangle, Size};
+use crate::core::{self, Rectangle, Size};
 
 use std::any::{Any, TypeId};
 use std::collections::HashMap;
@@ -58,7 +58,7 @@ pub trait Primitive: Debug + Send + Sync + 'static {
 }
 
 /// A renderer than can draw custom pipeline primitives.
-pub trait Renderer: crate::core::Renderer {
+pub trait Renderer: core::Renderer {
     /// Draws a custom pipeline primitive.
     fn draw_pipeline_primitive(
         &mut self,
-- 
cgit 


From f5bcfec8211c04c4b05f63d01d52d3e5d2cc123e Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector@hecrj.dev>
Date: Mon, 1 Apr 2024 11:59:46 +0200
Subject: Use `rustc-hash` for most of our `HashMap` and `HashSet` instances

---
 wgpu/src/primitive/pipeline.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'wgpu/src/primitive/pipeline.rs')

diff --git a/wgpu/src/primitive/pipeline.rs b/wgpu/src/primitive/pipeline.rs
index 814440ba..59c54db9 100644
--- a/wgpu/src/primitive/pipeline.rs
+++ b/wgpu/src/primitive/pipeline.rs
@@ -1,8 +1,8 @@
 //! Draw primitives using custom pipelines.
 use crate::core::{self, Rectangle, Size};
 
+use rustc_hash::FxHashMap;
 use std::any::{Any, TypeId};
-use std::collections::HashMap;
 use std::fmt::Debug;
 use std::sync::Arc;
 
@@ -82,7 +82,7 @@ impl Renderer for crate::Renderer {
 /// Stores custom, user-provided pipelines.
 #[derive(Default, Debug)]
 pub struct Storage {
-    pipelines: HashMap<TypeId, Box<dyn Any + Send>>,
+    pipelines: FxHashMap<TypeId, Box<dyn Any + Send>>,
 }
 
 impl Storage {
-- 
cgit 


From d922b478156488a7bc03c6e791e05c040d702634 Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector@hecrj.dev>
Date: Mon, 8 Apr 2024 15:04:35 +0200
Subject: Reintroduce support for custom primitives in `iced_wgpu`

---
 wgpu/src/primitive/pipeline.rs | 115 -----------------------------------------
 1 file changed, 115 deletions(-)

(limited to 'wgpu/src/primitive/pipeline.rs')

diff --git a/wgpu/src/primitive/pipeline.rs b/wgpu/src/primitive/pipeline.rs
index 59c54db9..8b137891 100644
--- a/wgpu/src/primitive/pipeline.rs
+++ b/wgpu/src/primitive/pipeline.rs
@@ -1,116 +1 @@
-//! Draw primitives using custom pipelines.
-use crate::core::{self, Rectangle, Size};
 
-use rustc_hash::FxHashMap;
-use std::any::{Any, TypeId};
-use std::fmt::Debug;
-use std::sync::Arc;
-
-#[derive(Clone, Debug)]
-/// A custom primitive which can be used to render primitives associated with a custom pipeline.
-pub struct Pipeline {
-    /// The bounds of the [`Pipeline`].
-    pub bounds: Rectangle,
-
-    /// The [`Primitive`] to render.
-    pub primitive: Arc<dyn Primitive>,
-}
-
-impl Pipeline {
-    /// Creates a new [`Pipeline`] with the given [`Primitive`].
-    pub fn new(bounds: Rectangle, primitive: impl Primitive) -> Self {
-        Pipeline {
-            bounds,
-            primitive: Arc::new(primitive),
-        }
-    }
-}
-
-impl PartialEq for Pipeline {
-    fn eq(&self, other: &Self) -> bool {
-        self.primitive.type_id() == other.primitive.type_id()
-    }
-}
-
-/// A set of methods which allows a [`Primitive`] to be rendered.
-pub trait Primitive: Debug + Send + Sync + 'static {
-    /// Processes the [`Primitive`], allowing for GPU buffer allocation.
-    fn prepare(
-        &self,
-        format: wgpu::TextureFormat,
-        device: &wgpu::Device,
-        queue: &wgpu::Queue,
-        bounds: Rectangle,
-        target_size: Size<u32>,
-        scale_factor: f32,
-        storage: &mut Storage,
-    );
-
-    /// Renders the [`Primitive`].
-    fn render(
-        &self,
-        storage: &Storage,
-        target: &wgpu::TextureView,
-        target_size: Size<u32>,
-        viewport: Rectangle<u32>,
-        encoder: &mut wgpu::CommandEncoder,
-    );
-}
-
-/// A renderer than can draw custom pipeline primitives.
-pub trait Renderer: core::Renderer {
-    /// Draws a custom pipeline primitive.
-    fn draw_pipeline_primitive(
-        &mut self,
-        bounds: Rectangle,
-        primitive: impl Primitive,
-    );
-}
-
-impl Renderer for crate::Renderer {
-    fn draw_pipeline_primitive(
-        &mut self,
-        bounds: Rectangle,
-        primitive: impl Primitive,
-    ) {
-        self.draw_primitive(super::Primitive::Custom(super::Custom::Pipeline(
-            Pipeline::new(bounds, primitive),
-        )));
-    }
-}
-
-/// Stores custom, user-provided pipelines.
-#[derive(Default, Debug)]
-pub struct Storage {
-    pipelines: FxHashMap<TypeId, Box<dyn Any + Send>>,
-}
-
-impl Storage {
-    /// Returns `true` if `Storage` contains a pipeline with type `T`.
-    pub fn has<T: 'static>(&self) -> bool {
-        self.pipelines.get(&TypeId::of::<T>()).is_some()
-    }
-
-    /// Inserts the pipeline `T` in to [`Storage`].
-    pub fn store<T: 'static + Send>(&mut self, pipeline: T) {
-        let _ = self.pipelines.insert(TypeId::of::<T>(), Box::new(pipeline));
-    }
-
-    /// Returns a reference to pipeline with type `T` if it exists in [`Storage`].
-    pub fn get<T: 'static>(&self) -> Option<&T> {
-        self.pipelines.get(&TypeId::of::<T>()).map(|pipeline| {
-            pipeline
-                .downcast_ref::<T>()
-                .expect("Pipeline with this type does not exist in Storage.")
-        })
-    }
-
-    /// Returns a mutable reference to pipeline `T` if it exists in [`Storage`].
-    pub fn get_mut<T: 'static>(&mut self) -> Option<&mut T> {
-        self.pipelines.get_mut(&TypeId::of::<T>()).map(|pipeline| {
-            pipeline
-                .downcast_mut::<T>()
-                .expect("Pipeline with this type does not exist in Storage.")
-        })
-    }
-}
-- 
cgit 


From f88488543f0b2d0ca95753d1e6527ba06981290a Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector@hecrj.dev>
Date: Mon, 8 Apr 2024 15:05:12 +0200
Subject: Remove leftover `primitive::pipeline` module

---
 wgpu/src/primitive/pipeline.rs | 1 -
 1 file changed, 1 deletion(-)
 delete mode 100644 wgpu/src/primitive/pipeline.rs

(limited to 'wgpu/src/primitive/pipeline.rs')

diff --git a/wgpu/src/primitive/pipeline.rs b/wgpu/src/primitive/pipeline.rs
deleted file mode 100644
index 8b137891..00000000
--- a/wgpu/src/primitive/pipeline.rs
+++ /dev/null
@@ -1 +0,0 @@
-
-- 
cgit