diff --git a/wgpu-core/src/binding_model.rs b/wgpu-core/src/binding_model.rs index 7d8ab6302..710ae8ea1 100644 --- a/wgpu-core/src/binding_model.rs +++ b/wgpu-core/src/binding_model.rs @@ -16,12 +16,15 @@ use crate::{ use arrayvec::ArrayVec; use rendy_descriptor::{DescriptorRanges, DescriptorSet}; +#[cfg(feature = "serde")] +use serde::{Deserialize, Serialize}; use std::borrow::Borrow; pub const MAX_BIND_GROUPS: usize = 4; bitflags::bitflags! { #[repr(transparent)] + #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct ShaderStage: u32 { const NONE = 0; const VERTEX = 1; @@ -32,6 +35,7 @@ bitflags::bitflags! { #[repr(C)] #[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum BindingType { UniformBuffer = 0, StorageBuffer = 1, @@ -43,6 +47,7 @@ pub enum BindingType { #[repr(C)] #[derive(Clone, Debug, Hash, PartialEq)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct BindGroupLayoutBinding { pub binding: u32, pub visibility: ShaderStage, diff --git a/wgpu-core/src/resource.rs b/wgpu-core/src/resource.rs index 79e1da968..1456fbb44 100644 --- a/wgpu-core/src/resource.rs +++ b/wgpu-core/src/resource.rs @@ -276,6 +276,7 @@ impl Default for TextureAspect { #[repr(C)] #[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum TextureViewDimension { D1, D2,