radv: Support shader compilation without LLVM dependencies
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Thu, 6 Aug 2020 12:16:35 +0000 (14:16 +0200)
committerTony Wasserka <tony.wasserka@gmx.de>
Fri, 1 Oct 2021 08:40:18 +0000 (10:40 +0200)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11319>

src/amd/vulkan/radv_shader.c

index 427df7f..f981541 100644 (file)
 #include "util/mesa-sha1.h"
 #include "util/u_atomic.h"
 #include "radv_debug.h"
-#include "radv_llvm_helper.h"
 #include "radv_private.h"
 #include "radv_shader_args.h"
 
 #include "util/debug.h"
 #include "ac_binary.h"
 #include "ac_exp_param.h"
-#include "ac_llvm_util.h"
 #include "ac_nir.h"
 #include "ac_rtld.h"
 #include "aco_interface.h"
 #include "sid.h"
 #include "vk_format.h"
 
+#ifdef LLVM_AVAILABLE
+#include "ac_llvm_util.h"
+#endif
+
 void
 radv_get_nir_options(struct radv_physical_device *device)
 {
@@ -1587,11 +1589,15 @@ shader_variant_compile(struct radv_device *device, struct vk_shader_module *modu
       shader_count >= 2,
       shader_count >= 2 ? shaders[shader_count - 2]->info.stage : MESA_SHADER_VERTEX);
 
+#ifdef LLVM_AVAILABLE
    if (radv_use_llvm_for_stage(device, stage) || options->dump_shader || options->record_ir)
       ac_init_llvm_once();
 
    if (radv_use_llvm_for_stage(device, stage)) {
       llvm_compile_shader(device, shader_count, shaders, &binary, &args);
+#else
+   if (false) {
+#endif
    } else {
       aco_compile_shader(shader_count, shaders, &binary, &args);
    }