Draft multi-threaded image rendering in iced_wgpu
This commit is contained in:
parent
92888a3639
commit
cb8d2710da
22 changed files with 886 additions and 305 deletions
|
|
@ -1,14 +1,16 @@
|
|||
use crate::core::Size;
|
||||
use crate::image::atlas::{self, allocator};
|
||||
use crate::image::atlas::allocator;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Allocation {
|
||||
Partial {
|
||||
layer: usize,
|
||||
region: allocator::Region,
|
||||
atlas_size: u32,
|
||||
},
|
||||
Full {
|
||||
layer: usize,
|
||||
size: u32,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -23,14 +25,21 @@ impl Allocation {
|
|||
pub fn size(&self) -> Size<u32> {
|
||||
match self {
|
||||
Allocation::Partial { region, .. } => region.size(),
|
||||
Allocation::Full { .. } => Size::new(atlas::SIZE, atlas::SIZE),
|
||||
Allocation::Full { size, .. } => Size::new(*size, *size),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn layer(&self) -> usize {
|
||||
match self {
|
||||
Allocation::Partial { layer, .. } => *layer,
|
||||
Allocation::Full { layer } => *layer,
|
||||
Allocation::Full { layer, .. } => *layer,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn atlas_size(&self) -> u32 {
|
||||
match self {
|
||||
Allocation::Partial { atlas_size, .. } => *atlas_size,
|
||||
Allocation::Full { size, .. } => *size,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue