summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
authorLibravatar Malte Veerman <malte.veerman@gmail.com>2020-01-17 20:48:49 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-02-25 13:27:03 +0100
commit2f695ef9803c9c08f64961f1b9902a661a385160 (patch)
tree1bdac539b758e6c101ffcb7a3312daf42b8b5036 /wgpu
parentc0996923c6aab39bb61ca6d3310149c66a73fac8 (diff)
downloadiced-2f695ef9803c9c08f64961f1b9902a661a385160.tar.gz
iced-2f695ef9803c9c08f64961f1b9902a661a385160.tar.bz2
iced-2f695ef9803c9c08f64961f1b9902a661a385160.zip
Updated shaders and removed debug_stub_derive dependency
Diffstat (limited to '')
-rw-r--r--wgpu/Cargo.toml1
-rw-r--r--wgpu/src/image.rs32
-rw-r--r--wgpu/src/image/raster.rs13
-rw-r--r--wgpu/src/image/vector.rs24
-rw-r--r--wgpu/src/shader/image.frag.spvbin684 -> 584 bytes
-rw-r--r--wgpu/src/shader/image.vert.spvbin2324 -> 1596 bytes
6 files changed, 51 insertions, 19 deletions
diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml
index f8b5bb8c..56839cf0 100644
--- a/wgpu/Cargo.toml
+++ b/wgpu/Cargo.toml
@@ -22,7 +22,6 @@ glam = "0.8"
font-kit = "0.4"
log = "0.4"
guillotiere = "0.4"
-debug_stub_derive = "0.3"
[dependencies.image]
version = "0.22"
diff --git a/wgpu/src/image.rs b/wgpu/src/image.rs
index 9443b876..2fd73b54 100644
--- a/wgpu/src/image.rs
+++ b/wgpu/src/image.rs
@@ -15,7 +15,6 @@ use std::mem;
use std::cell::RefCell;
use guillotiere::{Allocation, AtlasAllocator, Size};
-use debug_stub_derive::*;
#[derive(Debug)]
pub struct Pipeline {
@@ -477,11 +476,9 @@ impl ImageAllocation {
}
}
-#[derive(DebugStub)]
pub enum ArrayAllocation {
AtlasAllocation {
layer: usize,
- #[debug_stub = "Allocation"]
allocation: Allocation,
},
WholeLayer {
@@ -518,16 +515,35 @@ impl ArrayAllocation {
}
}
-#[derive(DebugStub)]
+impl std::fmt::Debug for ArrayAllocation {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ ArrayAllocation::AtlasAllocation { layer, .. } => {
+ write!(f, "ArrayAllocation::AtlasAllocation {{ layer: {} }}", layer)
+ },
+ ArrayAllocation::WholeLayer { layer } => {
+ write!(f, "ArrayAllocation::WholeLayer {{ layer: {} }}", layer)
+ }
+ }
+ }
+}
+
pub enum TextureLayer {
Whole,
- Atlas(
- #[debug_stub="AtlasAllocator"]
- AtlasAllocator
- ),
+ Atlas(AtlasAllocator),
Empty,
}
+impl std::fmt::Debug for TextureLayer {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ TextureLayer::Whole => write!(f, "TextureLayer::Whole"),
+ TextureLayer::Atlas(_) => write!(f, "TextureLayer::Atlas"),
+ TextureLayer::Empty => write!(f, "TextureLayer::Empty"),
+ }
+ }
+}
+
#[derive(Debug)]
pub struct TextureArray {
texture: wgpu::Texture,
diff --git a/wgpu/src/image/raster.rs b/wgpu/src/image/raster.rs
index bca2ebda..648df0ff 100644
--- a/wgpu/src/image/raster.rs
+++ b/wgpu/src/image/raster.rs
@@ -3,9 +3,7 @@ use iced_native::image;
use std::{
collections::{HashMap, HashSet},
};
-use debug_stub_derive::*;
-#[derive(DebugStub)]
pub enum Memory {
Host(::image::ImageBuffer<::image::Bgra<u8>, Vec<u8>>),
Device(ImageAllocation),
@@ -24,6 +22,17 @@ impl Memory {
}
}
+impl std::fmt::Debug for Memory {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ Memory::Host(_) => write!(f, "Memory::Host"),
+ Memory::Device(_) => write!(f, "Memory::Device"),
+ Memory::NotFound => write!(f, "Memory::NotFound"),
+ Memory::Invalid => write!(f, "Memory::Invalid"),
+ }
+ }
+}
+
#[derive(Debug)]
pub struct Cache {
map: HashMap<u64, Memory>,
diff --git a/wgpu/src/image/vector.rs b/wgpu/src/image/vector.rs
index 9bddcc2b..a8746566 100644
--- a/wgpu/src/image/vector.rs
+++ b/wgpu/src/image/vector.rs
@@ -3,14 +3,9 @@ use iced_native::svg;
use std::{
collections::{HashMap, HashSet},
};
-use debug_stub_derive::*;
-#[derive(DebugStub)]
pub enum Svg {
- Loaded(
- #[debug_stub="ReplacementValue"]
- resvg::usvg::Tree
- ),
+ Loaded(resvg::usvg::Tree),
NotFound,
}
@@ -27,10 +22,17 @@ impl Svg {
}
}
-#[derive(DebugStub)]
+impl std::fmt::Debug for Svg {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ Svg::Loaded(_) => write!(f, "Svg::Loaded"),
+ Svg::NotFound => write!(f, "Svg::NotFound"),
+ }
+ }
+}
+
pub struct Cache {
svgs: HashMap<u64, Svg>,
- #[debug_stub="ReplacementValue"]
rasterized: HashMap<(u64, u32, u32), ImageAllocation>,
svg_hits: HashSet<u64>,
rasterized_hits: HashSet<(u64, u32, u32)>,
@@ -144,3 +146,9 @@ impl Cache {
self.rasterized_hits.clear();
}
}
+
+impl std::fmt::Debug for Cache {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "vector::Cache")
+ }
+} \ No newline at end of file
diff --git a/wgpu/src/shader/image.frag.spv b/wgpu/src/shader/image.frag.spv
index ebee82ac..6a6445b4 100644
--- a/wgpu/src/shader/image.frag.spv
+++ b/wgpu/src/shader/image.frag.spv
Binary files differ
diff --git a/wgpu/src/shader/image.vert.spv b/wgpu/src/shader/image.vert.spv
index da76eca0..cceff73a 100644
--- a/wgpu/src/shader/image.vert.spv
+++ b/wgpu/src/shader/image.vert.spv
Binary files differ