rusticl/memory: do not verify pitch for IMAGE1D_BUFFER
authorKarol Herbst <git@karolherbst.de>
Fri, 1 Sep 2023 10:49:59 +0000 (12:49 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 1 Sep 2023 20:06:30 +0000 (20:06 +0000)
Devices might report an image_pitch_alignment of 0 leading to a division
by 0 trap.

Fixes: 06daa03c5cd ("rusticl: Implement spec for cl_khr_image2d_from_buffer")
Signed-off-by: Karol Herbst <git@karolherbst.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24993>

src/gallium/frontends/rusticl/api/memory.rs

index 0f867c4..0de2a39 100644 (file)
@@ -511,7 +511,7 @@ fn validate_image_desc(
             desc.image_slice_pitch = desc.image_row_pitch * desc.image_height;
         }
 
-        if has_buf_parent {
+        if has_buf_parent && desc.image_type != CL_MEM_OBJECT_IMAGE1D_BUFFER {
             let pitch_alignment = devs
                 .iter()
                 .map(|d| d.image_pitch_alignment())