From 50ce777edd357bae1ae95a692d1de0e56dc8942a Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Sun, 4 Aug 2024 23:41:29 +0200 Subject: [PATCH] rusticl/device: Make supported 1Dbuffer formats a strict subset of 1D This works around a bug in the OpenCL CTS, which a few drivers here run into. Fixes a couple of tests with agx. Reviewed-by: @LingMan Part-of: --- src/gallium/frontends/rusticl/core/device.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs index 48983cd9f3c..2763508cabc 100644 --- a/src/gallium/frontends/rusticl/core/device.rs +++ b/src/gallium/frontends/rusticl/core/device.rs @@ -293,6 +293,14 @@ impl Device { fs.insert(t, flags as cl_mem_flags); } + + // Restrict supported formats with 1DBuffer images. This is an OpenCL CTS workaround. + // See https://github.com/KhronosGroup/OpenCL-CTS/issues/1889 + let image1d_mask = fs[&CL_MEM_OBJECT_IMAGE1D]; + if let Some(entry) = fs.get_mut(&CL_MEM_OBJECT_IMAGE1D_BUFFER) { + *entry &= image1d_mask; + } + self.formats.insert(f.cl_image_format, fs); }