From 183e705a15b79e723666476817d144dbb74707f6 Mon Sep 17 00:00:00 2001 From: James Park Date: Wed, 20 Oct 2021 14:42:32 -0700 Subject: [PATCH] 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 Part-of: --- 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 0c90a83..7bb76bf 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.@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 d5401e8..36b3fc1 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, }, } -- 2.7.4