Merge pull request #610 from hecrj/improvement/update-dependencies

Update dependencies
This commit is contained in:
Héctor Ramón 2020-11-11 18:06:27 +01:00 committed by GitHub
commit 73811c394a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 45 additions and 47 deletions

View File

@ -8,4 +8,4 @@ publish = false
[dependencies] [dependencies]
iced_winit = { path = "../../winit" } iced_winit = { path = "../../winit" }
iced_wgpu = { path = "../../wgpu" } iced_wgpu = { path = "../../wgpu" }
env_logger = "0.7" env_logger = "0.8"

View File

@ -12,7 +12,7 @@ serde_json = "1.0"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
async-std = "1.0" async-std = "1.0"
directories = "2.0" directories-next = "2.0"
[target.'cfg(target_arch = "wasm32")'.dependencies] [target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = { version = "0.3", features = ["Window", "Storage"] } web-sys = { version = "0.3", features = ["Window", "Storage"] }

View File

@ -499,7 +499,7 @@ enum SaveError {
impl SavedState { impl SavedState {
fn path() -> std::path::PathBuf { fn path() -> std::path::PathBuf {
let mut path = if let Some(project_dirs) = let mut path = if let Some(project_dirs) =
directories::ProjectDirs::from("rs", "Iced", "Todos") directories_next::ProjectDirs::from("rs", "Iced", "Todos")
{ {
project_dirs.data_dir().into() project_dirs.data_dir().into()
} else { } else {

View File

@ -7,4 +7,4 @@ publish = false
[dependencies] [dependencies]
iced = { path = "../..", features = ["image", "debug"] } iced = { path = "../..", features = ["image", "debug"] }
env_logger = "0.7" env_logger = "0.8"

View File

@ -15,11 +15,11 @@ image = []
svg = [] svg = []
[dependencies] [dependencies]
glow = "0.5" glow = "0.6"
glow_glyph = "0.3" glow_glyph = "0.4"
glyph_brush = "0.7" glyph_brush = "0.7"
euclid = "0.20" euclid = "0.22"
bytemuck = "1.2" bytemuck = "1.4"
log = "0.4" log = "0.4"
[dependencies.iced_native] [dependencies.iced_native]

View File

@ -12,11 +12,14 @@ font-icons = []
opengl = [] opengl = []
[dependencies] [dependencies]
bytemuck = "1.2" glam = "0.10"
glam = "0.9"
raw-window-handle = "0.3" raw-window-handle = "0.3"
thiserror = "1.0" thiserror = "1.0"
[dependencies.bytemuck]
version = "1.4"
features = ["derive"]
[dependencies.iced_native] [dependencies.iced_native]
version = "0.2" version = "0.2"
path = "../native" path = "../native"
@ -26,11 +29,11 @@ version = "0.1"
path = "../style" path = "../style"
[dependencies.lyon] [dependencies.lyon]
version = "0.15" version = "0.16"
optional = true optional = true
[dependencies.font-kit] [dependencies.font-kit]
version = "0.6" version = "0.8"
optional = true optional = true
[package.metadata.docs.rs] [package.metadata.docs.rs]

View File

@ -1,4 +1,5 @@
//! Draw geometry using meshes of triangles. //! Draw geometry using meshes of triangles.
use bytemuck::{Pod, Zeroable};
/// A set of [`Vertex2D`] and indices representing a list of triangles. /// A set of [`Vertex2D`] and indices representing a list of triangles.
/// ///
@ -16,7 +17,7 @@ pub struct Mesh2D {
} }
/// A two-dimensional vertex with some color in __linear__ RGBA. /// A two-dimensional vertex with some color in __linear__ RGBA.
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug, Zeroable, Pod)]
#[repr(C)] #[repr(C)]
pub struct Vertex2D { pub struct Vertex2D {
/// The vertex position /// The vertex position
@ -24,9 +25,3 @@ pub struct Vertex2D {
/// The vertex color in __linear__ RGBA. /// The vertex color in __linear__ RGBA.
pub color: [f32; 4], pub color: [f32; 4],
} }
#[allow(unsafe_code)]
unsafe impl bytemuck::Zeroable for Vertex2D {}
#[allow(unsafe_code)]
unsafe impl bytemuck::Pod for Vertex2D {}

View File

@ -16,13 +16,15 @@ default_system_font = ["iced_graphics/font-source"]
wgpu = "0.6" wgpu = "0.6"
wgpu_glyph = "0.10" wgpu_glyph = "0.10"
glyph_brush = "0.7" glyph_brush = "0.7"
zerocopy = "0.3"
bytemuck = "1.2"
raw-window-handle = "0.3" raw-window-handle = "0.3"
log = "0.4" log = "0.4"
guillotiere = "0.6" guillotiere = "0.6"
futures = "0.3" futures = "0.3"
[dependencies.bytemuck]
version = "1.4"
features = ["derive"]
[dependencies.iced_native] [dependencies.iced_native]
version = "0.2" version = "0.2"
path = "../native" path = "../native"

View File

@ -13,7 +13,8 @@ use iced_graphics::layer;
use iced_native::Rectangle; use iced_native::Rectangle;
use std::cell::RefCell; use std::cell::RefCell;
use std::mem; use std::mem;
use zerocopy::AsBytes;
use bytemuck::{Pod, Zeroable};
#[cfg(feature = "image")] #[cfg(feature = "image")]
use iced_native::image; use iced_native::image;
@ -219,14 +220,14 @@ impl Pipeline {
let vertices = let vertices =
device.create_buffer_init(&wgpu::util::BufferInitDescriptor { device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some("iced_wgpu::image vertex buffer"), label: Some("iced_wgpu::image vertex buffer"),
contents: QUAD_VERTS.as_bytes(), contents: bytemuck::cast_slice(&QUAD_VERTS),
usage: wgpu::BufferUsage::VERTEX, usage: wgpu::BufferUsage::VERTEX,
}); });
let indices = let indices =
device.create_buffer_init(&wgpu::util::BufferInitDescriptor { device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some("iced_wgpu::image index buffer"), label: Some("iced_wgpu::image index buffer"),
contents: QUAD_INDICES.as_bytes(), contents: bytemuck::cast_slice(&QUAD_INDICES),
usage: wgpu::BufferUsage::INDEX, usage: wgpu::BufferUsage::INDEX,
}); });
@ -385,12 +386,9 @@ impl Pipeline {
device, device,
); );
uniforms_buffer.copy_from_slice( uniforms_buffer.copy_from_slice(bytemuck::bytes_of(&Uniforms {
Uniforms {
transform: transformation.into(), transform: transformation.into(),
} }));
.as_bytes(),
);
} }
let mut i = 0; let mut i = 0;
@ -411,8 +409,9 @@ impl Pipeline {
device, device,
); );
instances_buffer instances_buffer.copy_from_slice(bytemuck::cast_slice(
.copy_from_slice(instances[i..i + amount].as_bytes()); &instances[i..i + amount],
));
let mut render_pass = let mut render_pass =
encoder.begin_render_pass(&wgpu::RenderPassDescriptor { encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
@ -463,7 +462,7 @@ impl Pipeline {
} }
#[repr(C)] #[repr(C)]
#[derive(Clone, Copy, AsBytes)] #[derive(Clone, Copy, Zeroable, Pod)]
pub struct Vertex { pub struct Vertex {
_position: [f32; 2], _position: [f32; 2],
} }
@ -486,7 +485,7 @@ const QUAD_VERTS: [Vertex; 4] = [
]; ];
#[repr(C)] #[repr(C)]
#[derive(Debug, Clone, Copy, AsBytes)] #[derive(Debug, Clone, Copy, Zeroable, Pod)]
struct Instance { struct Instance {
_position: [f32; 2], _position: [f32; 2],
_size: [f32; 2], _size: [f32; 2],
@ -500,7 +499,7 @@ impl Instance {
} }
#[repr(C)] #[repr(C)]
#[derive(Debug, Clone, Copy, AsBytes)] #[derive(Debug, Clone, Copy, Zeroable, Pod)]
struct Uniforms { struct Uniforms {
transform: [f32; 16], transform: [f32; 16],
} }

View File

@ -2,8 +2,6 @@ use crate::image::atlas::{self, Atlas};
use iced_native::svg; use iced_native::svg;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use zerocopy::AsBytes;
pub enum Svg { pub enum Svg {
Loaded(resvg::usvg::Tree), Loaded(resvg::usvg::Tree),
NotFound, NotFound,
@ -119,7 +117,7 @@ impl Cache {
let allocation = texture_atlas.upload( let allocation = texture_atlas.upload(
width, width,
height, height,
canvas.get_data().as_bytes(), bytemuck::cast_slice(canvas.get_data()),
device, device,
encoder, encoder,
)?; )?;

View File

@ -2,9 +2,9 @@ use crate::Transformation;
use iced_graphics::layer; use iced_graphics::layer;
use iced_native::Rectangle; use iced_native::Rectangle;
use bytemuck::{Pod, Zeroable};
use std::mem; use std::mem;
use wgpu::util::DeviceExt; use wgpu::util::DeviceExt;
use zerocopy::AsBytes;
#[derive(Debug)] #[derive(Debug)]
pub struct Pipeline { pub struct Pipeline {
@ -156,14 +156,14 @@ impl Pipeline {
let vertices = let vertices =
device.create_buffer_init(&wgpu::util::BufferInitDescriptor { device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some("iced_wgpu::quad vertex buffer"), label: Some("iced_wgpu::quad vertex buffer"),
contents: QUAD_VERTS.as_bytes(), contents: bytemuck::cast_slice(&QUAD_VERTS),
usage: wgpu::BufferUsage::VERTEX, usage: wgpu::BufferUsage::VERTEX,
}); });
let indices = let indices =
device.create_buffer_init(&wgpu::util::BufferInitDescriptor { device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some("iced_wgpu::quad index buffer"), label: Some("iced_wgpu::quad index buffer"),
contents: QUAD_INDICES.as_bytes(), contents: bytemuck::cast_slice(&QUAD_INDICES),
usage: wgpu::BufferUsage::INDEX, usage: wgpu::BufferUsage::INDEX,
}); });
@ -207,7 +207,7 @@ impl Pipeline {
device, device,
); );
constants_buffer.copy_from_slice(uniforms.as_bytes()); constants_buffer.copy_from_slice(bytemuck::bytes_of(&uniforms));
} }
let mut i = 0; let mut i = 0;
@ -271,7 +271,7 @@ impl Pipeline {
} }
#[repr(C)] #[repr(C)]
#[derive(Clone, Copy, AsBytes)] #[derive(Clone, Copy, Zeroable, Pod)]
pub struct Vertex { pub struct Vertex {
_position: [f32; 2], _position: [f32; 2],
} }
@ -296,7 +296,7 @@ const QUAD_VERTS: [Vertex; 4] = [
const MAX_INSTANCES: usize = 100_000; const MAX_INSTANCES: usize = 100_000;
#[repr(C)] #[repr(C)]
#[derive(Debug, Clone, Copy, AsBytes)] #[derive(Debug, Clone, Copy, Zeroable, Pod)]
struct Uniforms { struct Uniforms {
transform: [f32; 16], transform: [f32; 16],
scale: f32, scale: f32,

View File

@ -1,8 +1,9 @@
//! Draw meshes of triangles. //! Draw meshes of triangles.
use crate::{settings, Transformation}; use crate::{settings, Transformation};
use iced_graphics::layer; use iced_graphics::layer;
use bytemuck::{Pod, Zeroable};
use std::mem; use std::mem;
use zerocopy::AsBytes;
pub use iced_graphics::triangle::{Mesh2D, Vertex2D}; pub use iced_graphics::triangle::{Mesh2D, Vertex2D};
@ -322,7 +323,7 @@ impl Pipeline {
} }
} }
let uniforms = uniforms.as_bytes(); let uniforms = bytemuck::cast_slice(&uniforms);
if let Some(uniforms_size) = if let Some(uniforms_size) =
wgpu::BufferSize::new(uniforms.len() as u64) wgpu::BufferSize::new(uniforms.len() as u64)
@ -409,7 +410,7 @@ impl Pipeline {
} }
#[repr(C)] #[repr(C)]
#[derive(Debug, Clone, Copy, AsBytes)] #[derive(Debug, Clone, Copy, Zeroable, Pod)]
struct Uniforms { struct Uniforms {
transform: [f32; 16], transform: [f32; 16],
// We need to align this to 256 bytes to please `wgpu`... // We need to align this to 256 bytes to please `wgpu`...