rusticl/mem: move pipe_image_host_access into Image

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27376>
This commit is contained in:
Karol Herbst
2024-01-31 03:13:37 +01:00
committed by Marge Bot
parent 9ce9ddc5e8
commit 90eae30bcb

View File

@@ -682,19 +682,6 @@ impl MemBase {
pub fn is_mapped_ptr(&self, ptr: *mut c_void) -> bool {
self.maps.lock().unwrap().contains_ptr(ptr)
}
pub fn pipe_image_host_access(&self) -> u16 {
// those flags are all mutually exclusive
(if bit_check(self.flags, CL_MEM_HOST_READ_ONLY) {
PIPE_IMAGE_ACCESS_READ
} else if bit_check(self.flags, CL_MEM_HOST_WRITE_ONLY) {
PIPE_IMAGE_ACCESS_WRITE
} else if bit_check(self.flags, CL_MEM_HOST_NO_ACCESS) {
0
} else {
PIPE_IMAGE_ACCESS_READ_WRITE
}) as u16
}
}
impl Drop for MemBase {
@@ -1347,6 +1334,19 @@ impl Image {
Ok(ptr)
}
pub fn pipe_image_host_access(&self) -> u16 {
// those flags are all mutually exclusive
(if bit_check(self.flags, CL_MEM_HOST_READ_ONLY) {
PIPE_IMAGE_ACCESS_READ
} else if bit_check(self.flags, CL_MEM_HOST_WRITE_ONLY) {
PIPE_IMAGE_ACCESS_WRITE
} else if bit_check(self.flags, CL_MEM_HOST_NO_ACCESS) {
0
} else {
PIPE_IMAGE_ACCESS_READ_WRITE
}) as u16
}
pub fn read(
&self,
dst: *mut c_void,