nil: Add a helper to get samples from a SampleLayout

Fixes: 6a84d5439d ("nvk: Move the ANTI_ALIAS_CONTROL logic to the MME")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31585>
This commit is contained in:
Faith Ekstrand 2024-10-09 14:57:56 -05:00 committed by Marge Bot
parent cf31388a9a
commit f8c0377421

View file

@ -55,6 +55,22 @@ impl SampleLayout {
}
}
pub fn samples(&self) -> u32 {
match self {
SampleLayout::_1x1 => 1,
SampleLayout::_2x1 => 2,
SampleLayout::_2x2 => 4,
SampleLayout::_4x2 => 8,
SampleLayout::_4x4 => 16,
SampleLayout::Invalid => panic!("Invalid sample layout"),
}
}
#[no_mangle]
pub extern "C" fn nil_sample_layout_samples(self) -> u32 {
self.samples()
}
pub fn px_extent_sa(&self) -> Extent4D<units::Samples> {
match self {
SampleLayout::_1x1 => Extent4D::new(1, 1, 1, 1),