mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-24 16:31:11 +01:00
move SwizzleComponent impl into proc module
This commit is contained in:
1 parent
20c6fd1862
commit
b439868c00
2 files changed
+21
-26
No files matched your search
-26
@@ -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