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]
iced_winit = { path = "../../winit" }
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]
async-std = "1.0"
directories = "2.0"
directories-next = "2.0"
[target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = { version = "0.3", features = ["Window", "Storage"] }

View File

@ -499,7 +499,7 @@ enum SaveError {
impl SavedState {
fn path() -> std::path::PathBuf {
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()
} else {

View File

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
//! Draw geometry using meshes of triangles.
use bytemuck::{Pod, Zeroable};
/// 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.
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Zeroable, Pod)]
#[repr(C)]
pub struct Vertex2D {
/// The vertex position
@ -24,9 +25,3 @@ pub struct Vertex2D {
/// The vertex color in __linear__ RGBA.
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_glyph = "0.10"
glyph_brush = "0.7"
zerocopy = "0.3"
bytemuck = "1.2"
raw-window-handle = "0.3"
log = "0.4"
guillotiere = "0.6"
futures = "0.3"
[dependencies.bytemuck]
version = "1.4"
features = ["derive"]
[dependencies.iced_native]
version = "0.2"
path = "../native"

View File

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

View File

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

View File

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

View File

@ -1,8 +1,9 @@
//! Draw meshes of triangles.
use crate::{settings, Transformation};
use iced_graphics::layer;
use bytemuck::{Pod, Zeroable};
use std::mem;
use zerocopy::AsBytes;
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) =
wgpu::BufferSize::new(uniforms.len() as u64)
@ -409,7 +410,7 @@ impl Pipeline {
}
#[repr(C)]
#[derive(Debug, Clone, Copy, AsBytes)]
#[derive(Debug, Clone, Copy, Zeroable, Pod)]
struct Uniforms {
transform: [f32; 16],
// We need to align this to 256 bytes to please `wgpu`...