clover/llvm: undefine __IMAGE_SUPPORT__ for devices without image support

libclang seems to define this on its own for SPIR targets, but the CTS
requires it to be not set if the device doesn't support images.

The SPIRV-LLVM-Translator also requires the spir triple to be set so we
can't really do anything else except to undefine.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstran.net>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6433>
This commit is contained in:
Karol Herbst 2020-08-21 21:10:32 +02:00 committed by Marge Bot
parent 7dc39838ed
commit 036f1c29fc
1 changed files with 4 additions and 0 deletions

View File

@ -300,6 +300,10 @@ namespace {
compat::add_link_bitcode_file(c.getCodeGenOpts(),
LIBCLC_LIBEXECDIR + dev.ir_target() + ".bc");
// undefine __IMAGE_SUPPORT__ for device without image support
if (!dev.image_support())
c.getPreprocessorOpts().addMacroUndef("__IMAGE_SUPPORT__");
// Compile the code
clang::EmitLLVMOnlyAction act(&ctx);
if (!c.ExecuteAction(act))