From 6abe48d835aa0493aaac25b150e8a11a4c8a684d Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Thu, 4 Jun 2026 14:58:35 +0200 Subject: [PATCH] rusticl/program: set __OPENCL_C_VERSION__ ourselves Reviewed-by: @LingMan Part-of: --- src/gallium/frontends/rusticl/core/program.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gallium/frontends/rusticl/core/program.rs b/src/gallium/frontends/rusticl/core/program.rs index 175081e8d84..fbbac4b6f69 100644 --- a/src/gallium/frontends/rusticl/core/program.rs +++ b/src/gallium/frontends/rusticl/core/program.rs @@ -400,6 +400,14 @@ impl CompileOptions { ver => args.push(c"-cl-std=CL".concat(ver.api_cstr())), } + // We set this define ourselves, so that we don't rely on clang to set it properly as 3.1 + // is still quite new and we can't rely on users having a clang that supports this. + if clc_ver >= CLVersion::Cl3_1 { + args.push(c"-U__OPENCL_C_VERSION__".to_owned()); + args.push(c"-D__OPENCL_C_VERSION__=".concat(clc_ver.clc_str())); + args.push(c"-DCL_VERSION_3_1=310".to_owned()); + } + args } }