Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 1 | From ac503f5d7bf36f021c576029a64ac1a3199f6b5a Mon Sep 17 00:00:00 2001 |
| 2 | From: Matt Turner <mattst88@gmail.com> |
| 3 | Date: Thu, 31 Aug 2023 13:16:29 -0400 |
| 4 | Subject: [PATCH] intel: Allow using intel_clc from the system |
| 5 | |
| 6 | With -Dintel-clc=system, the build system will search for an `intel_clc` |
| 7 | binary and use it instead of building `intel_clc` itself. |
| 8 | |
| 9 | This allows Intel Vulkan ray tracing support to be built when cross |
| 10 | compiling without terrible hacks (that would otherwise be necessary due |
| 11 | to `intel_clc`'s dependence on SPIRV-LLVM-Translator, libclc, clang, and |
| 12 | LLVM). |
| 13 | |
| 14 | Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24983> |
| 15 | |
| 16 | Upstream-Status: Backport [https://gitlab.freedesktop.org/mesa/mesa/-/commit/28c1053c07c177854520f6283fa665f17618adb5] |
| 17 | |
| 18 | --- |
| 19 | meson.build | 6 +++--- |
| 20 | meson_options.txt | 5 ++++- |
| 21 | src/intel/compiler/meson.build | 6 +++++- |
| 22 | src/intel/vulkan/grl/meson.build | 2 +- |
| 23 | 4 files changed, 13 insertions(+), 6 deletions(-) |
| 24 | |
| 25 | diff --git a/meson.build b/meson.build |
| 26 | index 16e86ec..00a6953 100644 |
| 27 | --- a/meson.build |
| 28 | +++ b/meson.build |
| 29 | @@ -259,12 +259,12 @@ endif |
| 30 | |
| 31 | with_microsoft_clc = get_option('microsoft-clc').enabled() |
| 32 | if ['x86_64'].contains(host_machine.cpu_family()) |
| 33 | - with_intel_clc = get_option('intel-clc').enabled() |
| 34 | - with_intel_vk_rt = with_intel_vk and with_intel_clc |
| 35 | + with_intel_clc = get_option('intel-clc') == 'enabled' |
| 36 | else |
| 37 | with_intel_clc = false |
| 38 | - with_intel_vk_rt = false |
| 39 | endif |
| 40 | +with_intel_vk_rt = with_intel_vk and get_option('intel-clc') != 'disabled' |
| 41 | + |
| 42 | with_clc = with_microsoft_clc or with_intel_clc |
| 43 | with_libclc = with_clc |
| 44 | with_spirv_to_dxil = get_option('spirv-to-dxil') |
| 45 | diff --git a/meson_options.txt b/meson_options.txt |
| 46 | index 379aea3..9800531 100644 |
| 47 | --- a/meson_options.txt |
| 48 | +++ b/meson_options.txt |
| 49 | @@ -607,9 +607,12 @@ option( |
| 50 | |
| 51 | option( |
| 52 | 'intel-clc', |
| 53 | - type : 'feature', |
| 54 | + type : 'combo', |
| 55 | deprecated: {'true': 'enabled', 'false': 'disabled'}, |
| 56 | value : 'disabled', |
| 57 | + choices : [ |
| 58 | + 'enabled', 'disabled', 'system', |
| 59 | + ], |
| 60 | description : 'Build the intel-clc compiler (enables Vulkan Intel ' + |
| 61 | 'Ray Tracing on supported hardware).' |
| 62 | ) |
| 63 | diff --git a/src/intel/compiler/meson.build b/src/intel/compiler/meson.build |
| 64 | index 9a03d37..774e955 100644 |
| 65 | --- a/src/intel/compiler/meson.build |
| 66 | +++ b/src/intel/compiler/meson.build |
| 67 | @@ -168,7 +168,10 @@ libintel_compiler = static_library( |
| 68 | ) |
| 69 | |
| 70 | # For now this tool is only going to be used by Anv |
| 71 | -if with_intel_clc |
| 72 | +if get_option('intel-clc') == 'system' |
| 73 | + prog_intel_clc = find_program('intel_clc', native : true) |
| 74 | + dep_prog_intel_clc = [] |
| 75 | +elif with_intel_clc |
| 76 | prog_intel_clc = executable( |
| 77 | 'intel_clc', |
| 78 | ['intel_clc.c'], |
| 79 | @@ -181,6 +184,7 @@ if with_intel_clc |
| 80 | dependencies : [idep_nir, idep_clc, idep_mesautil, idep_intel_dev], |
| 81 | native : true, |
| 82 | ) |
| 83 | + dep_prog_intel_clc = [prog_intel_clc] |
| 84 | endif |
| 85 | |
| 86 | if with_tests |
| 87 | diff --git a/src/intel/vulkan/grl/meson.build b/src/intel/vulkan/grl/meson.build |
| 88 | index c0056b3..02a72f5 100644 |
| 89 | --- a/src/intel/vulkan/grl/meson.build |
| 90 | +++ b/src/intel/vulkan/grl/meson.build |
| 91 | @@ -143,7 +143,7 @@ foreach t : [['125', 'gfx125', 'dg2']] |
| 92 | # if fixed there |
| 93 | ], |
| 94 | env: ['MESA_SHADER_CACHE_DISABLE=true'], |
| 95 | - depends : [prog_intel_clc] |
| 96 | + depends : dep_prog_intel_clc |
| 97 | ) |
| 98 | endforeach |
| 99 | |