nil: Match on gob types in the tiled image copy code
This depends on GOB types but we really only support Turing for now. Add the match statement anyway so we panic if we see an unsupported GOB type instead of pretending it's TuringColor2D and copying anyway. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35660>
This commit is contained in:
committed by
Marge Bot
parent
d8c43ff46a
commit
76e72d63f0
+27
-17
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use crate::extent::{units, Extent4D, Offset4D};
|
||||
use crate::tiling::Tiling;
|
||||
use crate::tiling::{GOBType, Tiling};
|
||||
|
||||
use std::ffi::c_void;
|
||||
use std::ops::Range;
|
||||
@@ -551,14 +551,19 @@ pub unsafe extern "C" fn nil_copy_linear_to_tiled(
|
||||
linear_plane_stride_B,
|
||||
);
|
||||
|
||||
copy_tiled::<CopyGOBTuring2D<RawCopyToTiled>>(
|
||||
*tiling,
|
||||
level_extent_B,
|
||||
tiled_dst,
|
||||
linear_pointer,
|
||||
offset_B,
|
||||
end_B,
|
||||
);
|
||||
match tiling.gob_type {
|
||||
GOBType::TuringColor2D => {
|
||||
copy_tiled::<CopyGOBTuring2D<RawCopyToTiled>>(
|
||||
*tiling,
|
||||
level_extent_B,
|
||||
tiled_dst,
|
||||
linear_pointer,
|
||||
offset_B,
|
||||
end_B,
|
||||
);
|
||||
}
|
||||
_ => panic!("Unsupported GOB type"),
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
@@ -583,12 +588,17 @@ pub unsafe extern "C" fn nil_copy_tiled_to_linear(
|
||||
linear_plane_stride_B,
|
||||
);
|
||||
|
||||
copy_tiled::<CopyGOBTuring2D<RawCopyToLinear>>(
|
||||
*tiling,
|
||||
level_extent_B,
|
||||
tiled_src,
|
||||
linear_pointer,
|
||||
offset_B,
|
||||
end_B,
|
||||
);
|
||||
match tiling.gob_type {
|
||||
GOBType::TuringColor2D => {
|
||||
copy_tiled::<CopyGOBTuring2D<RawCopyToLinear>>(
|
||||
*tiling,
|
||||
level_extent_B,
|
||||
tiled_src,
|
||||
linear_pointer,
|
||||
offset_B,
|
||||
end_B,
|
||||
);
|
||||
}
|
||||
_ => panic!("Unsupported GOB type"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user