rusticl: fix clippy errors on image_slice_pitch change to usize

That field got changed from `unsigned` to `uintptr_t` on the C side, so
now we can drop a bit of code dealing with conversions to `usize`.

Fixes: 68735f4e86 ("treewide: use uint64_t / (u)intptr_t in image address calculations")
Signed-off-by: Karol Herbst <git@karolherbst.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23522>
This commit is contained in:
Karol Herbst 2023-06-08 14:42:00 +02:00 committed by Marge Bot
parent d57303ace7
commit 1bbc997bef
2 changed files with 7 additions and 11 deletions

View file

@ -132,7 +132,7 @@ impl Context {
if !user_ptr.is_null() {
let bx = desc.bx()?;
let stride = desc.row_pitch()?;
let layer_stride = desc.slice_pitch()?;
let layer_stride = desc.slice_pitch();
res.iter()
.filter(|(_, r)| copy || !r.is_user)

View file

@ -127,7 +127,7 @@ pub trait CLImageDescInfo {
fn pixels(&self) -> usize;
fn bx(&self) -> CLResult<pipe_box>;
fn row_pitch(&self) -> CLResult<u32>;
fn slice_pitch(&self) -> CLResult<usize>;
fn slice_pitch(&self) -> usize;
fn width(&self) -> CLResult<u32>;
fn height(&self) -> CLResult<u32>;
fn size(&self) -> CLVec<usize>;
@ -204,10 +204,8 @@ impl CLImageDescInfo for cl_image_desc {
.map_err(|_| CL_OUT_OF_HOST_MEMORY)
}
fn slice_pitch(&self) -> CLResult<usize> {
fn slice_pitch(&self) -> usize {
self.image_slice_pitch
.try_into()
.map_err(|_| CL_OUT_OF_HOST_MEMORY)
}
fn width(&self) -> CLResult<u32> {
@ -679,7 +677,7 @@ impl Mem {
src_pitch[0] = bpp;
if self.is_image_from_buffer() {
src_pitch[1] = self.image_desc.row_pitch()? as usize;
src_pitch[2] = self.image_desc.slice_pitch()? as usize;
src_pitch[2] = self.image_desc.slice_pitch();
} else {
src_pitch[1] = region[0] * bpp;
src_pitch[2] = region[0] * region[1] * bpp;
@ -707,7 +705,7 @@ impl Mem {
dst_pitch[0] = bpp;
if dst_base.is_image_from_buffer() {
dst_pitch[1] = dst_base.image_desc.row_pitch()? as usize;
dst_pitch[2] = dst_base.image_desc.slice_pitch()? as usize;
dst_pitch[2] = dst_base.image_desc.slice_pitch();
} else {
dst_pitch[1] = region[0] * bpp;
dst_pitch[2] = region[0] * region[1] * bpp;
@ -820,7 +818,7 @@ impl Mem {
if self.is_parent_buffer() {
let strides = (
self.image_desc.row_pitch()? as usize,
self.image_desc.slice_pitch()? as usize,
self.image_desc.slice_pitch(),
);
ctx.clear_image_buffer(res, &new_pattern, origin, region, strides, pixel_size);
} else {
@ -888,9 +886,7 @@ impl Mem {
src_row_pitch
.try_into()
.map_err(|_| CL_OUT_OF_HOST_MEMORY)?,
src_slice_pitch
.try_into()
.map_err(|_| CL_OUT_OF_HOST_MEMORY)?,
src_slice_pitch,
);
}
Ok(())