Updated shaders and removed debug_stub_derive dependency

This commit is contained in:
Malte Veerman 2020-01-17 20:48:49 +01:00 committed by Héctor Ramón Jiménez
parent c0996923c6
commit 2f695ef980
6 changed files with 51 additions and 19 deletions

View file

@ -22,7 +22,6 @@ glam = "0.8"
font-kit = "0.4" font-kit = "0.4"
log = "0.4" log = "0.4"
guillotiere = "0.4" guillotiere = "0.4"
debug_stub_derive = "0.3"
[dependencies.image] [dependencies.image]
version = "0.22" version = "0.22"

View file

@ -15,7 +15,6 @@ use std::mem;
use std::cell::RefCell; use std::cell::RefCell;
use guillotiere::{Allocation, AtlasAllocator, Size}; use guillotiere::{Allocation, AtlasAllocator, Size};
use debug_stub_derive::*;
#[derive(Debug)] #[derive(Debug)]
pub struct Pipeline { pub struct Pipeline {
@ -477,11 +476,9 @@ impl ImageAllocation {
} }
} }
#[derive(DebugStub)]
pub enum ArrayAllocation { pub enum ArrayAllocation {
AtlasAllocation { AtlasAllocation {
layer: usize, layer: usize,
#[debug_stub = "Allocation"]
allocation: Allocation, allocation: Allocation,
}, },
WholeLayer { 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 { pub enum TextureLayer {
Whole, Whole,
Atlas( Atlas(AtlasAllocator),
#[debug_stub="AtlasAllocator"]
AtlasAllocator
),
Empty, 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)] #[derive(Debug)]
pub struct TextureArray { pub struct TextureArray {
texture: wgpu::Texture, texture: wgpu::Texture,

View file

@ -3,9 +3,7 @@ use iced_native::image;
use std::{ use std::{
collections::{HashMap, HashSet}, collections::{HashMap, HashSet},
}; };
use debug_stub_derive::*;
#[derive(DebugStub)]
pub enum Memory { pub enum Memory {
Host(::image::ImageBuffer<::image::Bgra<u8>, Vec<u8>>), Host(::image::ImageBuffer<::image::Bgra<u8>, Vec<u8>>),
Device(ImageAllocation), 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)] #[derive(Debug)]
pub struct Cache { pub struct Cache {
map: HashMap<u64, Memory>, map: HashMap<u64, Memory>,

View file

@ -3,14 +3,9 @@ use iced_native::svg;
use std::{ use std::{
collections::{HashMap, HashSet}, collections::{HashMap, HashSet},
}; };
use debug_stub_derive::*;
#[derive(DebugStub)]
pub enum Svg { pub enum Svg {
Loaded( Loaded(resvg::usvg::Tree),
#[debug_stub="ReplacementValue"]
resvg::usvg::Tree
),
NotFound, 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 { pub struct Cache {
svgs: HashMap<u64, Svg>, svgs: HashMap<u64, Svg>,
#[debug_stub="ReplacementValue"]
rasterized: HashMap<(u64, u32, u32), ImageAllocation>, rasterized: HashMap<(u64, u32, u32), ImageAllocation>,
svg_hits: HashSet<u64>, svg_hits: HashSet<u64>,
rasterized_hits: HashSet<(u64, u32, u32)>, rasterized_hits: HashSet<(u64, u32, u32)>,
@ -144,3 +146,9 @@ impl Cache {
self.rasterized_hits.clear(); 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")
}
}

Binary file not shown.

Binary file not shown.