nil: Expose px_to_B helpers to C

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30044>
This commit is contained in:
Mohamed Ahmed
2024-09-21 01:06:10 +03:00
committed by Marge Bot
parent c6adb0ac68
commit 7314177245
+18
View File
@@ -157,6 +157,15 @@ pub extern "C" fn nil_extent4d_px_to_tl(
extent_px.to_tl(tiling, format, sample_layout)
}
#[no_mangle]
pub extern "C" fn nil_extent4d_px_to_B(
extent_px: Extent4D<units::Pixels>,
format: Format,
sample_layout: SampleLayout,
) -> Extent4D<units::Bytes> {
extent_px.to_B(format, sample_layout)
}
impl Extent4D<units::Samples> {
pub fn to_px(self, sample_layout: SampleLayout) -> Extent4D<units::Pixels> {
self.div_ceil(sample_layout.px_extent_sa())
@@ -311,6 +320,15 @@ pub extern "C" fn nil_offset4d_px_to_tl(
offset.to_tl(tiling, format, sample_layout)
}
#[no_mangle]
pub extern "C" fn nil_offset4d_px_to_B(
offset: Offset4D<units::Pixels>,
format: Format,
sample_layout: SampleLayout,
) -> Offset4D<units::Bytes> {
offset.to_B(format, sample_layout)
}
impl Offset4D<units::Elements> {
pub fn to_B(self, format: Format) -> Offset4D<units::Bytes> {
Offset4D {