chore: Derive `Pod` and `Zeroable` traits from `bytemuck`
This removes all `unsafe` impls of `bytemuck` traits
This commit is contained in:
parent
1c620b2c9b
commit
e69503ee67
|
@ -1,5 +1,7 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "ab_glyph_rasterizer"
|
||||
version = "0.1.4"
|
||||
|
@ -269,6 +271,20 @@ name = "bytemuck"
|
|||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a4bad0c5981acc24bc09e532f35160f952e35422603f0563cd7a73c2c2e65a0"
|
||||
dependencies = [
|
||||
"bytemuck_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck_derive"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e215f8c2f9f79cb53c8335e687ffd07d5bfcb6fe5fc80723762d0be46e7cc54"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
|
|
|
@ -13,7 +13,7 @@ log = "0.4"
|
|||
lyon = "0.17.5"
|
||||
ruffle_core = { path = "../../core" }
|
||||
futures = "0.3.12"
|
||||
bytemuck = "1.5.0"
|
||||
bytemuck = { version = "1.5.0", features = ["derive"] }
|
||||
raw-window-handle = "0.3.3"
|
||||
clap = { version = "3.0.0-beta.2", optional = true }
|
||||
enum-map = "0.6.3"
|
||||
|
|
|
@ -12,14 +12,11 @@ pub struct Globals {
|
|||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Pod, Zeroable)]
|
||||
struct GlobalsUniform {
|
||||
view_matrix: [[f32; 4]; 4],
|
||||
}
|
||||
|
||||
unsafe impl Pod for GlobalsUniform {}
|
||||
unsafe impl Zeroable for GlobalsUniform {}
|
||||
|
||||
impl Globals {
|
||||
pub fn new(device: &wgpu::Device) -> Self {
|
||||
let layout_label = create_debug_label!("Globals bind group layout");
|
||||
|
|
|
@ -127,25 +127,19 @@ pub enum MaskState {
|
|||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Pod, Zeroable)]
|
||||
struct Transforms {
|
||||
world_matrix: [[f32; 4]; 4],
|
||||
}
|
||||
|
||||
unsafe impl Pod for Transforms {}
|
||||
unsafe impl Zeroable for Transforms {}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Pod, Zeroable)]
|
||||
struct TextureTransforms {
|
||||
u_matrix: [[f32; 4]; 4],
|
||||
}
|
||||
|
||||
unsafe impl Pod for TextureTransforms {}
|
||||
unsafe impl Zeroable for TextureTransforms {}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Pod, Zeroable)]
|
||||
struct ColorAdjustments {
|
||||
mult_color: [f32; 4],
|
||||
add_color: [f32; 4],
|
||||
|
@ -170,19 +164,13 @@ impl From<ColorTransform> for ColorAdjustments {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe impl Pod for ColorAdjustments {}
|
||||
unsafe impl Zeroable for ColorAdjustments {}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Pod, Zeroable)]
|
||||
struct GpuVertex {
|
||||
position: [f32; 2],
|
||||
color: [f32; 4],
|
||||
}
|
||||
|
||||
unsafe impl Pod for GpuVertex {}
|
||||
unsafe impl Zeroable for GpuVertex {}
|
||||
|
||||
impl WgpuRenderBackend<SwapChainTarget> {
|
||||
pub fn for_window<W: HasRawWindowHandle>(
|
||||
window: &W,
|
||||
|
|
|
@ -6,7 +6,7 @@ use ruffle_core::backend::audio::swf::CharacterId;
|
|||
use wgpu::BufferSize;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Pod, Zeroable)]
|
||||
pub struct GradientUniforms {
|
||||
pub colors: [[f32; 4]; 16],
|
||||
pub ratios: [f32; 16],
|
||||
|
@ -17,9 +17,6 @@ pub struct GradientUniforms {
|
|||
pub focal_point: f32,
|
||||
}
|
||||
|
||||
unsafe impl Pod for GradientUniforms {}
|
||||
unsafe impl Zeroable for GradientUniforms {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Mesh {
|
||||
pub draws: Vec<Draw>,
|
||||
|
|
Loading…
Reference in New Issue