mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
move SwizzleComponent impl into proc module
This commit is contained in:
26
src/lib.rs
26
src/lib.rs
@@ -773,32 +773,6 @@ pub enum SwizzleComponent {
|
||||
W = 3,
|
||||
}
|
||||
|
||||
impl SwizzleComponent {
|
||||
pub const XYZW: [SwizzleComponent; 4] = [
|
||||
SwizzleComponent::X,
|
||||
SwizzleComponent::Y,
|
||||
SwizzleComponent::Z,
|
||||
SwizzleComponent::W,
|
||||
];
|
||||
|
||||
pub fn index(&self) -> u32 {
|
||||
match *self {
|
||||
SwizzleComponent::X => 0,
|
||||
SwizzleComponent::Y => 1,
|
||||
SwizzleComponent::Z => 2,
|
||||
SwizzleComponent::W => 3,
|
||||
}
|
||||
}
|
||||
pub fn from_index(idx: u32) -> Self {
|
||||
match idx {
|
||||
0 => SwizzleComponent::X,
|
||||
1 => SwizzleComponent::Y,
|
||||
2 => SwizzleComponent::Z,
|
||||
_ => SwizzleComponent::W,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bitflags::bitflags! {
|
||||
/// Memory barrier flags.
|
||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||
|
||||
@@ -267,3 +267,24 @@ impl std::hash::Hash for crate::ScalarValue {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl super::SwizzleComponent {
|
||||
pub const XYZW: [Self; 4] = [Self::X, Self::Y, Self::Z, Self::W];
|
||||
|
||||
pub fn index(&self) -> u32 {
|
||||
match *self {
|
||||
Self::X => 0,
|
||||
Self::Y => 1,
|
||||
Self::Z => 2,
|
||||
Self::W => 3,
|
||||
}
|
||||
}
|
||||
pub fn from_index(idx: u32) -> Self {
|
||||
match idx {
|
||||
0 => Self::X,
|
||||
1 => Self::Y,
|
||||
2 => Self::Z,
|
||||
_ => Self::W,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user