Mesa (main): vulkan, radv: Support backslash in ICD paths

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 10 10:10:16 UTC 2021


Module: Mesa
Branch: main
Commit: 183e705a15b79e723666476817d144dbb74707f6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=183e705a15b79e723666476817d144dbb74707f6

Author: James Park <jpark37 at lagfreegames.com>
Date:   Wed Oct 20 14:42:32 2021 -0700

vulkan, radv: Support backslash in ICD paths

Vulkan loader wants backslash for paths on Windows. Need to jump through
hoops because Meson does not support backslashes in commands.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13461>

---

 src/amd/vulkan/meson.build    | 17 +++++++++++------
 src/vulkan/util/vk_icd_gen.py |  8 +++++++-
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build
index 0c90a83491c..7bb76bf73bf 100644
--- a/src/amd/vulkan/meson.build
+++ b/src/amd/vulkan/meson.build
@@ -190,16 +190,21 @@ if with_platform_windows
   icd_file_name = 'vulkan_radeon.dll'
 endif
 
+icd_command = [
+  prog_python, '@INPUT0@',
+  '--api-version', '1.2', '--xml', '@INPUT1@',
+  '--lib-path', join_paths(icd_lib_path, icd_file_name),
+  '--out', '@OUTPUT@',
+]
+if with_platform_windows
+  icd_command += '--use-backslash'
+endif
+
 radeon_icd = custom_target(
   'radeon_icd',
   input : [vk_icd_gen, vk_api_xml],
   output : 'radeon_icd. at 0@.json'.format(host_machine.cpu()),
-  command : [
-    prog_python, '@INPUT0@',
-    '--api-version', '1.2', '--xml', '@INPUT1@',
-    '--lib-path', join_paths(icd_lib_path, icd_file_name),
-    '--out', '@OUTPUT@',
-  ],
+  command : icd_command,
   build_by_default : true,
   install_dir : with_vulkan_icd_dir,
   install : true,
diff --git a/src/vulkan/util/vk_icd_gen.py b/src/vulkan/util/vk_icd_gen.py
index d5401e80156..36b3fc18c39 100644
--- a/src/vulkan/util/vk_icd_gen.py
+++ b/src/vulkan/util/vk_icd_gen.py
@@ -48,6 +48,8 @@ if __name__ == '__main__':
                         help='Path to installed library')
     parser.add_argument('--out', required=False,
                         help='Output json file.')
+    parser.add_argument('--use-backslash', action='store_true',
+                        help='Use backslash (Windows).')
     args = parser.parse_args()
 
     version = args.api_version
@@ -57,10 +59,14 @@ if __name__ == '__main__':
     else:
         re.match(r'\d+\.\d+\.\d+', version)
 
+    lib_path = args.lib_path
+    if args.use_backslash:
+        lib_path = lib_path.replace('/', '\\')
+
     json_data = {
         'file_format_version': '1.0.0',
         'ICD': {
-            'library_path': args.lib_path,
+            'library_path': lib_path,
             'api_version': version,
         },
     }



More information about the mesa-commit mailing list