summaryrefslogtreecommitdiffstats
path: root/wgpu/src/quad.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-11-10 20:06:24 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-11-10 20:06:24 +0100
commit9d4f664c946e6475eaf2e8719ba56beee84a8fb8 (patch)
treef76ca213383363b60988a9f92078b7dbf14a6fa1 /wgpu/src/quad.rs
parentb86accfe1cdc0a4404416eb3c68aa3cf9c242f6a (diff)
downloadiced-9d4f664c946e6475eaf2e8719ba56beee84a8fb8.tar.gz
iced-9d4f664c946e6475eaf2e8719ba56beee84a8fb8.tar.bz2
iced-9d4f664c946e6475eaf2e8719ba56beee84a8fb8.zip
Update `bytemuck` and remove `zerocopy` in `iced_wgpu`
Diffstat (limited to 'wgpu/src/quad.rs')
-rw-r--r--wgpu/src/quad.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/wgpu/src/quad.rs b/wgpu/src/quad.rs
index d54f2577..24d20cfa 100644
--- a/wgpu/src/quad.rs
+++ b/wgpu/src/quad.rs
@@ -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,