vulkan, radv: Support backslash in ICD paths
authorJames Park <jpark37@lagfreegames.com>
Wed, 20 Oct 2021 21:42:32 +0000 (14:42 -0700)
committerMarge Bot <emma+marge@anholt.net>
Wed, 10 Nov 2021 09:48:41 +0000 (09:48 +0000)
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@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13461>

src/amd/vulkan/meson.build
src/vulkan/util/vk_icd_gen.py

index 0c90a83..7bb76bf 100644 (file)
@@ -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.@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,
index d5401e8..36b3fc1 100644 (file)
@@ -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,
         },
     }