rusticl/device: fix panic when disabling 3D image write support

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12985
Reviewed-by: @LingMan
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34649>
(cherry picked from commit 6f080ac532)
This commit is contained in:
Karol Herbst 2025-04-22 13:42:57 +02:00 committed by Eric Engestrom
parent 42bd3b7907
commit 80ce5dcae8
2 changed files with 9 additions and 6 deletions

View file

@ -154,7 +154,7 @@
"description": "rusticl/device: fix panic when disabling 3D image write support",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -366,11 +366,14 @@ impl Device {
// if we can't advertize 3d image write ext, we have to disable them all
if !self.caps.has_3d_image_writes {
for f in &mut self.formats.values_mut() {
*f.get_mut(&CL_MEM_OBJECT_IMAGE3D).unwrap() &= !cl_mem_flags::from(
CL_MEM_WRITE_ONLY | CL_MEM_READ_WRITE | CL_MEM_KERNEL_READ_AND_WRITE,
);
}
self.formats
.values_mut()
.filter_map(|f| f.get_mut(&CL_MEM_OBJECT_IMAGE3D))
.for_each(|flags| {
*flags &= !cl_mem_flags::from(
CL_MEM_WRITE_ONLY | CL_MEM_READ_WRITE | CL_MEM_KERNEL_READ_AND_WRITE,
)
});
}
// we require formatted loads