Module: Mesa Branch: main Commit: f8afd416677d3c7abb527eb71299fda841bef73d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f8afd416677d3c7abb527eb71299fda841bef73d
Author: Karol Herbst <[email protected]> Date: Sun Dec 17 23:26:28 2023 +0100 clc: add workaround for clang always defining __IMAGE_SUPPORT_ and __opencl_c_int64 Signed-off-by: Karol Herbst <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26764> --- src/compiler/clc/clc_helpers.cpp | 6 ++++++ src/gallium/frontends/rusticl/core/program.rs | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/compiler/clc/clc_helpers.cpp b/src/compiler/clc/clc_helpers.cpp index 722aef614ff..6f856d1efc4 100644 --- a/src/compiler/clc/clc_helpers.cpp +++ b/src/compiler/clc/clc_helpers.cpp @@ -893,6 +893,12 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx, c->getPreprocessorOpts().addMacroUndef("__SPIR__"); c->getPreprocessorOpts().addMacroUndef("__SPIRV__"); + // clang defines those unconditionally, we need to fix that. + if (!args->features.int64) + c->getPreprocessorOpts().addMacroUndef("__opencl_c_int64"); + if (!args->features.images) + c->getPreprocessorOpts().addMacroUndef("__IMAGE_SUPPORT__"); + #if LLVM_VERSION_MAJOR >= 14 c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("-all"); c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_khr_byte_addressable_store"); diff --git a/src/gallium/frontends/rusticl/core/program.rs b/src/gallium/frontends/rusticl/core/program.rs index 0a3703ce6b2..eb6d2230309 100644 --- a/src/gallium/frontends/rusticl/core/program.rs +++ b/src/gallium/frontends/rusticl/core/program.rs @@ -276,9 +276,6 @@ fn prepare_options(options: &str, dev: &Device) -> Vec<CString> { options.push_str(" -cl-std=CL"); options.push_str(dev.clc_version.api_str()); } - if !dev.image_supported() { - options.push_str(" -U__IMAGE_SUPPORT__"); - } options.push_str(" -D__OPENCL_VERSION__="); options.push_str(dev.cl_version.clc_str());
