Skip to content

Commit

Permalink
[msl-out] Put serde(default) on the whole struct, not on each field. (g…
Browse files Browse the repository at this point in the history
…fx-rs#1463)

This has no effect, but makes the code more legible.
  • Loading branch information
jimblandy authored Oct 16, 2021
1 parent 62cc5fc commit 528f52f
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/back/msl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,11 @@ pub enum BindSamplerTarget {
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
#[cfg_attr(any(feature = "serialize", feature = "deserialize"), serde(default))]
pub struct BindTarget {
#[cfg_attr(feature = "deserialize", serde(default))]
pub buffer: Option<Slot>,
#[cfg_attr(feature = "deserialize", serde(default))]
pub texture: Option<Slot>,
#[cfg_attr(feature = "deserialize", serde(default))]
pub sampler: Option<BindSamplerTarget>,
#[cfg_attr(feature = "deserialize", serde(default))]
pub mutable: bool,
}

Expand All @@ -66,29 +63,25 @@ pub type BindingMap = std::collections::BTreeMap<crate::ResourceBinding, BindTar
#[derive(Clone, Debug, Default, Hash, Eq, PartialEq)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
#[cfg_attr(any(feature = "serialize", feature = "deserialize"), serde(default))]
pub struct PerStageResources {
#[cfg_attr(feature = "deserialize", serde(default))]
pub resources: BindingMap,

#[cfg_attr(feature = "deserialize", serde(default))]
pub push_constant_buffer: Option<Slot>,

/// The slot of a buffer that contains an array of `u32`,
/// one for the size of each bound buffer that contains a runtime array,
/// in order of [`crate::GlobalVariable`] declarations.
#[cfg_attr(feature = "deserialize", serde(default))]
pub sizes_buffer: Option<Slot>,
}

#[derive(Clone, Debug, Default, Hash, Eq, PartialEq)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
#[cfg_attr(any(feature = "serialize", feature = "deserialize"), serde(default))]
pub struct PerStageMap {
#[cfg_attr(feature = "deserialize", serde(default))]
pub vs: PerStageResources,
#[cfg_attr(feature = "deserialize", serde(default))]
pub fs: PerStageResources,
#[cfg_attr(feature = "deserialize", serde(default))]
pub cs: PerStageResources,
}

Expand Down

0 comments on commit 528f52f

Please sign in to comment.