Generate RGBA=R|G|B|A helper constant for ColorComponentFlags

When the misleading `all()` function was removed in #478 it also made
all color components for `ColorComponentFlags` significantly more
verbose to write, see #536.
This commit is contained in:
Marijn Suijten 2021-12-28 19:14:19 +01:00 committed by Benjamin Saunders
parent afdab863d0
commit 8a46a1508a
3 changed files with 7 additions and 8 deletions

View file

@ -26,3 +26,8 @@ impl Packed24_8 {
(self.0 >> 24) as u8 (self.0 >> 24) as u8
} }
} }
impl super::ColorComponentFlags {
/// Contraction of [`Self::R`] | [`Self::G`] | [`Self::B`] | [`Self::A`]
pub const RGBA: Self = Self(Self::R.0 | Self::G.0 | Self::B.0 | Self::A.0);
}

View file

@ -666,10 +666,7 @@ fn main() {
src_alpha_blend_factor: vk::BlendFactor::ZERO, src_alpha_blend_factor: vk::BlendFactor::ZERO,
dst_alpha_blend_factor: vk::BlendFactor::ZERO, dst_alpha_blend_factor: vk::BlendFactor::ZERO,
alpha_blend_op: vk::BlendOp::ADD, alpha_blend_op: vk::BlendOp::ADD,
color_write_mask: vk::ColorComponentFlags::R color_write_mask: vk::ColorComponentFlags::RGBA,
| vk::ColorComponentFlags::G
| vk::ColorComponentFlags::B
| vk::ColorComponentFlags::A,
}]; }];
let color_blend_state = vk::PipelineColorBlendStateCreateInfo::builder() let color_blend_state = vk::PipelineColorBlendStateCreateInfo::builder()
.logic_op(vk::LogicOp::CLEAR) .logic_op(vk::LogicOp::CLEAR)

View file

@ -319,10 +319,7 @@ fn main() {
src_alpha_blend_factor: vk::BlendFactor::ZERO, src_alpha_blend_factor: vk::BlendFactor::ZERO,
dst_alpha_blend_factor: vk::BlendFactor::ZERO, dst_alpha_blend_factor: vk::BlendFactor::ZERO,
alpha_blend_op: vk::BlendOp::ADD, alpha_blend_op: vk::BlendOp::ADD,
color_write_mask: vk::ColorComponentFlags::R color_write_mask: vk::ColorComponentFlags::RGBA,
| vk::ColorComponentFlags::G
| vk::ColorComponentFlags::B
| vk::ColorComponentFlags::A,
}]; }];
let color_blend_state = vk::PipelineColorBlendStateCreateInfo::builder() let color_blend_state = vk::PipelineColorBlendStateCreateInfo::builder()
.logic_op(vk::LogicOp::CLEAR) .logic_op(vk::LogicOp::CLEAR)