From 15fee0677dd1be359786c50307c27966208bf5e4 Mon Sep 17 00:00:00 2001 From: tibequadorian Date: Fri, 25 Nov 2022 00:00:08 +0100 Subject: [PATCH 1/6] SPIRV-Headers: update to 1.3.231.1. --- srcpkgs/SPIRV-Headers/template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/srcpkgs/SPIRV-Headers/template b/srcpkgs/SPIRV-Headers/template index b3d14e16dfe8..8bb7d5f8b1ae 100644 --- a/srcpkgs/SPIRV-Headers/template +++ b/srcpkgs/SPIRV-Headers/template @@ -1,7 +1,7 @@ # Template file for 'SPIRV-Headers' pkgname=SPIRV-Headers reverts="1.5.4.raytracing.fixed_1 1.5.3_2 1.5.3_1 1.5.1_1 1.4.1_1" -version=1.3.224.1 +version=1.3.231.1 revision=1 build_style=cmake short_desc="Machine-readable files for the SPIR-V Registry" @@ -9,7 +9,7 @@ maintainer="tibequadorian " license="MIT" homepage="https://github.com/KhronosGroup/SPIRV-Headers" distfiles="https://github.com/KhronosGroup/SPIRV-Headers/archive/sdk-${version}.tar.gz" -checksum=c85714bfe62f84007286bd3b3c0471af0a7e06ab66bc2ca4623043011b28737f +checksum=fc340700b005e9a2adc98475b5afbbabd1bc931f789a2afd02d54ebc22522af3 post_install() { vlicense LICENSE From a1fbd8e91eb016a8a60c5318182a267e1b8e869e Mon Sep 17 00:00:00 2001 From: tibequadorian Date: Fri, 25 Nov 2022 00:01:34 +0100 Subject: [PATCH 2/6] SPIRV-Tools: update to 2022.4. --- srcpkgs/SPIRV-Tools/template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/srcpkgs/SPIRV-Tools/template b/srcpkgs/SPIRV-Tools/template index e12fac380ba8..6a280baa0c28 100644 --- a/srcpkgs/SPIRV-Tools/template +++ b/srcpkgs/SPIRV-Tools/template @@ -1,6 +1,6 @@ # Template file for 'SPIRV-Tools' pkgname=SPIRV-Tools -version=2022.3 +version=2022.4 revision=1 build_style=cmake configure_args="-DSPIRV_SKIP_TESTS=ON -DSPIRV_WERROR=OFF @@ -13,7 +13,7 @@ license="Apache-2.0" homepage="https://github.com/KhronosGroup/SPIRV-Tools" changelog="https://raw.githubusercontent.com/KhronosGroup/SPIRV-Tools/master/CHANGES" distfiles="https://github.com/KhronosGroup/SPIRV-Tools/archive/v${version}.tar.gz" -checksum=df6dc5ed5351f99aaaa6acc78111342d3400b27b99f18148d3be408570144a70 +checksum=a156215a2d7c6c5b267933ed691877a9a66f07d75970da33ce9ad627a71389d7 LDFLAGS="-Wl,--no-undefined" SPIRV-Tools-devel_package() { From 1d6accd4ba3f726ac196b8dfac55de8e964b3234 Mon Sep 17 00:00:00 2001 From: tibequadorian Date: Sat, 7 May 2022 23:27:13 +0200 Subject: [PATCH 3/6] Vulkan-Headers: update to 1.3.231.1. --- srcpkgs/Vulkan-Headers/template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/srcpkgs/Vulkan-Headers/template b/srcpkgs/Vulkan-Headers/template index e20d6e72c98e..071675e44522 100644 --- a/srcpkgs/Vulkan-Headers/template +++ b/srcpkgs/Vulkan-Headers/template @@ -1,6 +1,6 @@ # Template file for 'Vulkan-Headers' pkgname=Vulkan-Headers -version=1.3.204.1 +version=1.3.231.1 revision=1 build_style=cmake short_desc="Vulkan header files" @@ -8,4 +8,4 @@ maintainer="tibequadorian " license="Apache-2.0" homepage="https://www.khronos.org/vulkan/" distfiles="https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-${version}.tar.gz" -checksum=9c4d33f71467c915749fbf48c0c3a8ee7833f15babf398e3463cd88791fb592e +checksum=6e16051ccb28821b907a08025eedb82cc73e1056924b32f75880ecae2499f7f6 From 4b84dc373b87be79effaf63624c14e9c61e7fffd Mon Sep 17 00:00:00 2001 From: tibequadorian Date: Sat, 7 May 2022 23:27:54 +0200 Subject: [PATCH 4/6] Vulkan-Tools: update to 1.3.231.1. Enable cross-builds for vkcube, thanks @JamiKettunen --- .../patches/vkcube-cross-build.patch | 127 ++++++++++++++++++ srcpkgs/Vulkan-Tools/template | 18 +-- 2 files changed, 133 insertions(+), 12 deletions(-) create mode 100644 srcpkgs/Vulkan-Tools/patches/vkcube-cross-build.patch diff --git a/srcpkgs/Vulkan-Tools/patches/vkcube-cross-build.patch b/srcpkgs/Vulkan-Tools/patches/vkcube-cross-build.patch new file mode 100644 index 000000000000..13ea2747498c --- /dev/null +++ b/srcpkgs/Vulkan-Tools/patches/vkcube-cross-build.patch @@ -0,0 +1,127 @@ +From e8234991418c5b0536e342bc849d5f8ed9eb6d6f Mon Sep 17 00:00:00 2001 +From: Simon McVittie +Date: Wed, 9 Nov 2022 15:32:39 +0000 +Subject: [PATCH] build: Compile vkcube and other demos, even when + cross-compiling + +When building software for a non-x86 processor on an x86 build machine, +or building 32-bit software on a 64-bit build machine, it's still useful +to compile demo programs that can be copied into the target environment +and run there, even if they won't necessarily be runnable on the build +machine. + +This also addresses a build failure when cross-compiling and attempting +to leave the demos enabled: + + CMake Error at cube/CMakeLists.txt:274 (install): + install TARGETS given target "vkcube" which does not exist. + +(and similar for the other demos) + +Resolves: https://github.com/KhronosGroup/Vulkan-Tools/issues/592 +Signed-off-by: Simon McVittie +--- + cube/CMakeLists.txt | 76 +++++++++++++++++++++------------------------ + 1 file changed, 35 insertions(+), 41 deletions(-) + +diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt +index 72e0ae92b..48805b3ee 100644 +--- a/cube/CMakeLists.txt ++++ b/cube/CMakeLists.txt +@@ -228,21 +228,19 @@ include_directories(${CUBE_INCLUDE_DIRS}) + if(APPLE) + include(macOS/cube/cube.cmake) + elseif(NOT WIN32) +- if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}) +- add_executable(vkcube +- cube.c +- ${PROJECT_SOURCE_DIR}/cube/cube.vert +- ${PROJECT_SOURCE_DIR}/cube/cube.frag +- cube.vert.inc +- cube.frag.inc +- ${OPTIONAL_WAYLAND_DATA_FILES}) +- target_link_libraries(vkcube Vulkan::Vulkan) +- target_compile_definitions(vkcube PUBLIC ${CUBE_PLATFORM}) +- include(CheckLibraryExists) +- CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT) +- if (NEED_RT) +- target_link_libraries(vkcube rt) +- endif() ++ add_executable(vkcube ++ cube.c ++ ${PROJECT_SOURCE_DIR}/cube/cube.vert ++ ${PROJECT_SOURCE_DIR}/cube/cube.frag ++ cube.vert.inc ++ cube.frag.inc ++ ${OPTIONAL_WAYLAND_DATA_FILES}) ++ target_link_libraries(vkcube Vulkan::Vulkan) ++ target_compile_definitions(vkcube PUBLIC ${CUBE_PLATFORM}) ++ include(CheckLibraryExists) ++ CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT) ++ if (NEED_RT) ++ target_link_libraries(vkcube rt) + endif() + else() + if(CMAKE_CL_64) +@@ -280,17 +278,15 @@ endif() + if(APPLE) + include(macOS/cubepp/cubepp.cmake) + elseif(NOT WIN32) +- if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}) +- add_executable(vkcubepp +- cube.cpp +- ${PROJECT_SOURCE_DIR}/cube/cube.vert +- ${PROJECT_SOURCE_DIR}/cube/cube.frag +- cube.vert.inc +- cube.frag.inc +- ${OPTIONAL_WAYLAND_DATA_FILES}) +- target_link_libraries(vkcubepp Vulkan::Vulkan) +- target_compile_definitions(vkcubepp PUBLIC ${CUBE_PLATFORM}) +- endif() ++ add_executable(vkcubepp ++ cube.cpp ++ ${PROJECT_SOURCE_DIR}/cube/cube.vert ++ ${PROJECT_SOURCE_DIR}/cube/cube.frag ++ cube.vert.inc ++ cube.frag.inc ++ ${OPTIONAL_WAYLAND_DATA_FILES}) ++ target_link_libraries(vkcubepp Vulkan::Vulkan) ++ target_compile_definitions(vkcubepp PUBLIC ${CUBE_PLATFORM}) + else() + if(CMAKE_CL_64) + set(LIB_DIR "Win64") +@@ -334,21 +330,19 @@ if(UNIX AND NOT APPLE) # i.e. Linux + ${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-code.c + ${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-client-header.h) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) +- if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}) +- add_executable(vkcube-wayland +- cube.c +- ${PROJECT_SOURCE_DIR}/cube/cube.vert +- ${PROJECT_SOURCE_DIR}/cube/cube.frag +- cube.vert.inc +- cube.frag.inc +- ${OPTIONAL_WAYLAND_DATA_FILES}) +- target_link_libraries(vkcube-wayland Vulkan::Vulkan) +- target_compile_definitions(vkcube-wayland PUBLIC VK_USE_PLATFORM_WAYLAND_KHR) +- include(CheckLibraryExists) +- CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT) +- if (NEED_RT) +- target_link_libraries(vkcube-wayland rt) +- endif() ++ add_executable(vkcube-wayland ++ cube.c ++ ${PROJECT_SOURCE_DIR}/cube/cube.vert ++ ${PROJECT_SOURCE_DIR}/cube/cube.frag ++ cube.vert.inc ++ cube.frag.inc ++ ${OPTIONAL_WAYLAND_DATA_FILES}) ++ target_link_libraries(vkcube-wayland Vulkan::Vulkan) ++ target_compile_definitions(vkcube-wayland PUBLIC VK_USE_PLATFORM_WAYLAND_KHR) ++ include(CheckLibraryExists) ++ CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT) ++ if (NEED_RT) ++ target_link_libraries(vkcube-wayland rt) + endif() + install(TARGETS vkcube-wayland RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + endif() diff --git a/srcpkgs/Vulkan-Tools/template b/srcpkgs/Vulkan-Tools/template index 71eb16dbb16c..88f31cc15f74 100644 --- a/srcpkgs/Vulkan-Tools/template +++ b/srcpkgs/Vulkan-Tools/template @@ -1,11 +1,12 @@ # Template file for 'Vulkan-Tools' pkgname=Vulkan-Tools -version=1.3.204.1 +version=1.3.231.1 revision=1 build_style=cmake -configure_args="-DGLSLANG_INSTALL_DIR=/usr -DBUILD_CUBE=$(vopt_if cube ON OFF) - -DVULKAN_HEADERS_INSTALL_DIR=${XBPS_CROSS_BASE}/usr -Wno-dev" -hostmakedepends="python3 pkg-config $(vopt_if cube glslang)" +configure_args="-DGLSLANG_INSTALL_DIR=/usr + -DVULKAN_HEADERS_INSTALL_DIR=${XBPS_CROSS_BASE}/usr -Wno-dev + -DWAYLAND_SCANNER_EXECUTABLE=/usr/bin/wayland-scanner" +hostmakedepends="python3 pkg-config glslang wayland-devel" makedepends="Vulkan-Headers vulkan-loader libxcb-devel libxkbcommon-devel wayland-devel wayland-protocols libXrandr-devel" short_desc="Official Vulkan tools and utilities" @@ -13,11 +14,4 @@ maintainer="tibequadorian " license="Apache-2.0" homepage="https://www.khronos.org/vulkan/" distfiles="https://github.com/KhronosGroup/Vulkan-Tools/archive/sdk-${version}.tar.gz" -checksum=3242f9ad158d02af9cc44186cbd415982387356a2dd8c0492af2fdace8c22f49 - -build_options="cube" -desc_option_cube="Build cube vulkan demo" - -if [ -z "$CROSS_BUILD" ]; then - build_options_default="cube" -fi +checksum=0388207fdc0986ed8e03092a16d76913c7189d87a0d71eff4a914942b16b552a From 08eef8b7947a1c8b5cc26e1346a28ea90b71f5be Mon Sep 17 00:00:00 2001 From: tibequadorian Date: Fri, 25 Nov 2022 00:03:03 +0100 Subject: [PATCH 5/6] Vulkan-ValidationLayers: update to 1.3.231.1. Add workaround for https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/4701 --- srcpkgs/Vulkan-ValidationLayers/template | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/srcpkgs/Vulkan-ValidationLayers/template b/srcpkgs/Vulkan-ValidationLayers/template index b67602beac61..8854a202a877 100644 --- a/srcpkgs/Vulkan-ValidationLayers/template +++ b/srcpkgs/Vulkan-ValidationLayers/template @@ -1,9 +1,11 @@ # Template file for 'Vulkan-ValidationLayers' pkgname=Vulkan-ValidationLayers -version=1.3.204.1 -revision=2 +version=1.3.231.1 +revision=1 build_style=cmake -configure_args="-Wno-dev -DBUILD_LAYER_SUPPORT_FILES=ON" +configure_args="-Wno-dev -DBUILD_LAYER_SUPPORT_FILES=ON + -DVULKAN_HEADERS_INSTALL_DIR=${XBPS_CROSS_BASE}/usr + -DSPIRV_HEADERS_INSTALL_DIR=${XBPS_CROSS_BASE}/usr" hostmakedepends="pkg-config" makedepends="Vulkan-Headers libXrandr-devel wayland-devel glslang-devel SPIRV-Tools-devel SPIRV-Headers robin-hood-hashing" @@ -12,4 +14,4 @@ maintainer="tibequadorian " license="Apache-2.0" homepage="https://www.khronos.org/vulkan/" distfiles="https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/sdk-${version}.tar.gz" -checksum=a5e658a4c1f504ae38488acdbe2ab2799e2ae4b626104d76776f1c24b079f341 +checksum=ea40af0f499e7e97a86ee54410c5c78e7f7bac40f65ae09a1549773b6501bf4d From 20c8af39f0ccd67613f966183212d0e6820f4eec Mon Sep 17 00:00:00 2001 From: tibequadorian Date: Sat, 7 May 2022 23:29:07 +0200 Subject: [PATCH 6/6] vulkan-loader: update to 1.3.231.2. --- .../patches/fix-gen_defines-cross.patch | 316 ++++++++++++++++++ srcpkgs/vulkan-loader/template | 4 +- 2 files changed, 318 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/vulkan-loader/patches/fix-gen_defines-cross.patch diff --git a/srcpkgs/vulkan-loader/patches/fix-gen_defines-cross.patch b/srcpkgs/vulkan-loader/patches/fix-gen_defines-cross.patch new file mode 100644 index 000000000000..3910009db2d9 --- /dev/null +++ b/srcpkgs/vulkan-loader/patches/fix-gen_defines-cross.patch @@ -0,0 +1,316 @@ +From d12ff7d48181236b47f808173e044a11423c0f26 Mon Sep 17 00:00:00 2001 +From: Charles Giessen +Date: Fri, 9 Sep 2022 17:50:14 -0600 +Subject: [PATCH] Write gen_defines.asm using a python script + +This allows cross compilation to enable unkonwn function handling as +gen_defines.asm will be generated without needing to run code meant for the +target platform. Previously, asm_offset.c wrote the gen_defines.asm file +by being run. Now, compilers emit their intermediate assembly output that the +parse_asm_values.py script knows how to find the relevant information from. + +Additionally set the test framework `framework_config` build option to always +copy, instead of copy_if_different. This is needed since cmake wouldn't update +this file when changing from/to debug & release mode. +--- + loader/CMakeLists.txt | 36 +++++++++++-- + loader/asm_offset.c | 99 ++++++++++++---------------------- + scripts/parse_asm_values.py | 97 +++++++++++++++++++++++++++++++++ + tests/framework/CMakeLists.txt | 2 +- + 4 files changed, 162 insertions(+), 72 deletions(-) + create mode 100644 scripts/parse_asm_values.py + +diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt +index bf4308702..0be1c5df4 100644 +--- a/loader/CMakeLists.txt ++++ b/loader/CMakeLists.txt +@@ -157,13 +157,25 @@ if(WIN32) + endif() + + add_executable(asm_offset asm_offset.c) +- target_link_libraries(asm_offset loader_specific_options) +- add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset MASM) ++ target_link_libraries(asm_offset PRIVATE loader_specific_options) ++ # Forces compiler to write the intermediate asm file, needed so that we can get sizeof/offset of info out of it. ++ target_compile_options(asm_offset PRIVATE "/Fa$/asm_offset.asm" /FA) ++ # Force off optimization so that the output assembly includes all the necessary info - optimizer would get rid of it otherwise. ++ target_compile_options(asm_offset PRIVATE /Od) ++ ++ find_package(PythonInterp REQUIRED) ++ # Run parse_asm_values.py on asm_offset's assembly file to generate the gen_defines.asm, which the asm code depends on ++ add_custom_command(TARGET asm_offset POST_BUILD ++ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/parse_asm_values.py "${CMAKE_CURRENT_BINARY_DIR}/gen_defines.asm" ++ "$/asm_offset.asm" "MASM" "${CMAKE_CXX_COMPILER_ID}" "${CMAKE_SYSTEM_PROCESSOR}" ++ BYPRODUCTS gen_defines.asm ++ ) + add_custom_target(loader_asm_gen_files DEPENDS gen_defines.asm) + set_target_properties(loader_asm_gen_files PROPERTIES FOLDER ${LOADER_HELPER_FOLDER}) ++ + add_library(loader-unknown-chain OBJECT unknown_ext_chain_masm.asm) + target_link_libraries(loader-unknown-chain Vulkan::Headers) +- target_include_directories(loader-unknown-chain PUBLIC $) ++ target_include_directories(loader-unknown-chain PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) + add_dependencies(loader-unknown-chain loader_asm_gen_files) + else() + message(WARNING "Could not find working MASM assembler\n${ASM_FAILURE_MSG}") +@@ -204,9 +216,23 @@ else() # i.e.: Linux + endif() + + if(ASSEMBLER_WORKS) +- add_executable(asm_offset asm_offset.c) ++ add_library(asm_offset STATIC asm_offset.c) + target_link_libraries(asm_offset loader_specific_options) +- add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset GAS) ++ # Forces compiler to write the intermediate asm file, needed so that we can get sizeof/offset of info out of it. ++ target_compile_options(asm_offset PRIVATE -save-temps=obj) ++ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") ++ set(ASM_OFFSET_INTERMEDIATE_LOCATION "$/CMakeFiles/asm_offset.dir/asm_offset.c.s") ++ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") ++ set(ASM_OFFSET_INTERMEDIATE_LOCATION "$/CMakeFiles/asm_offset.dir/asm_offset.s") ++ endif() ++ ++ find_package(PythonInterp REQUIRED) ++ # Run parse_asm_values.py on asm_offset's assembly file to generate the gen_defines.asm, which the asm code depends on ++ add_custom_command(TARGET asm_offset POST_BUILD ++ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/parse_asm_values.py "$/gen_defines.asm" ++ "${ASM_OFFSET_INTERMEDIATE_LOCATION}" "GAS" "${CMAKE_CXX_COMPILER_ID}" "${CMAKE_SYSTEM_PROCESSOR}" ++ BYPRODUCTS gen_defines.asm ++ ) + add_custom_target(loader_asm_gen_files DEPENDS gen_defines.asm) + else() + if(USE_GAS) +diff --git a/loader/asm_offset.c b/loader/asm_offset.c +index 80b71065c..82230b7d5 100644 +--- a/loader/asm_offset.c ++++ b/loader/asm_offset.c +@@ -26,6 +26,36 @@ + #include "loader_common.h" + #include "log.h" + ++#if defined(__GNUC__) || defined(__clang__) ++void produce_asm_define() { ++ // GCC and clang make it easy to print easy to regex for values ++ __asm__("# VULKAN_LOADER_ERROR_BIT = %c0" : : "i"(VULKAN_LOADER_ERROR_BIT)); ++ __asm__("# PTR_SIZE = %c0" : : "i"(sizeof(void *))); ++ __asm__("# CHAR_PTR_SIZE = %c0" : : "i"(sizeof(char *))); ++ __asm__("# FUNCTION_OFFSET_INSTANCE = %c0" : : "i"(offsetof(struct loader_instance, phys_dev_ext_disp_functions))); ++ __asm__("# PHYS_DEV_OFFSET_INST_DISPATCH = %c0" : : "i"(offsetof(struct loader_instance_dispatch_table, phys_dev_ext))); ++ __asm__("# PHYS_DEV_OFFSET_PHYS_DEV_TRAMP = %c0" : : "i"(offsetof(struct loader_physical_device_tramp, phys_dev))); ++ __asm__("# ICD_TERM_OFFSET_PHYS_DEV_TERM = %c0" : : "i"(offsetof(struct loader_physical_device_term, this_icd_term))); ++ __asm__("# PHYS_DEV_OFFSET_PHYS_DEV_TERM = %c0" : : "i"(offsetof(struct loader_physical_device_term, phys_dev))); ++ __asm__("# INSTANCE_OFFSET_ICD_TERM = %c0" : : "i"(offsetof(struct loader_icd_term, this_instance))); ++ __asm__("# DISPATCH_OFFSET_ICD_TERM = %c0" : : "i"(offsetof(struct loader_icd_term, phys_dev_ext))); ++ __asm__("# EXT_OFFSET_DEVICE_DISPATCH = %c0" : : "i"(offsetof(struct loader_dev_dispatch_table, ext_dispatch))); ++} ++#elif defined(_WIN32) ++// MSVC will print the name of the value and the value in hex ++// Must disable optimization for this translation unit, otherwise the compiler strips out the variables ++static const uint32_t PTR_SIZE = sizeof(void *); ++static const uint32_t CHAR_PTR_SIZE = sizeof(char *); ++static const uint32_t FUNCTION_OFFSET_INSTANCE = offsetof(struct loader_instance, phys_dev_ext_disp_functions); ++static const uint32_t PHYS_DEV_OFFSET_INST_DISPATCH = offsetof(struct loader_instance_dispatch_table, phys_dev_ext); ++static const uint32_t PHYS_DEV_OFFSET_PHYS_DEV_TRAMP = offsetof(struct loader_physical_device_tramp, phys_dev); ++static const uint32_t ICD_TERM_OFFSET_PHYS_DEV_TERM = offsetof(struct loader_physical_device_term, this_icd_term); ++static const uint32_t PHYS_DEV_OFFSET_PHYS_DEV_TERM = offsetof(struct loader_physical_device_term, phys_dev); ++static const uint32_t INSTANCE_OFFSET_ICD_TERM = offsetof(struct loader_icd_term, this_instance); ++static const uint32_t DISPATCH_OFFSET_ICD_TERM = offsetof(struct loader_icd_term, phys_dev_ext); ++static const uint32_t EXT_OFFSET_DEVICE_DISPATCH = offsetof(struct loader_dev_dispatch_table, ext_dispatch); ++#endif ++ + #if !defined(_MSC_VER) || (_MSC_VER >= 1900) + #define SIZE_T_FMT "%-8zu" + #else +@@ -38,69 +68,6 @@ struct ValueInfo { + const char *comment; + }; + +-int main(int argc, char **argv) { +- const char *assembler = NULL; +- for (int i = 0; i < argc; ++i) { +- if (!strcmp(argv[i], "MASM")) { +- assembler = "MASM"; +- } else if (!strcmp(argv[i], "GAS")) { +- assembler = "GAS"; +- } +- } +- if (assembler == NULL) { +- return 1; +- } +- +- struct ValueInfo values[] = { +- // clang-format off +- { .name = "VULKAN_LOADER_ERROR_BIT", .value = (size_t) VULKAN_LOADER_ERROR_BIT, +- .comment = "The numerical value of the enum value 'VULKAN_LOADER_ERROR_BIT'" }, +- { .name = "PTR_SIZE", .value = sizeof(void*), +- .comment = "The size of a pointer" }, +- { .name = "CHAR_PTR_SIZE", .value = sizeof(char *), +- .comment = "The size of a 'const char *' struct" }, +- { .name = "FUNCTION_OFFSET_INSTANCE", .value = offsetof(struct loader_instance, phys_dev_ext_disp_functions), +- .comment = "The offset of 'phys_dev_ext_disp_functions' within a 'loader_instance' struct" }, +- { .name = "PHYS_DEV_OFFSET_INST_DISPATCH", .value = offsetof(struct loader_instance_dispatch_table, phys_dev_ext), +- .comment = "The offset of 'phys_dev_ext' within in 'loader_instance_dispatch_table' struct" }, +- { .name = "PHYS_DEV_OFFSET_PHYS_DEV_TRAMP", .value = offsetof(struct loader_physical_device_tramp, phys_dev), +- .comment = "The offset of 'phys_dev' within a 'loader_physical_device_tramp' struct" }, +- { .name = "ICD_TERM_OFFSET_PHYS_DEV_TERM", .value = offsetof(struct loader_physical_device_term, this_icd_term), +- .comment = "The offset of 'this_icd_term' within a 'loader_physical_device_term' struct" }, +- { .name = "PHYS_DEV_OFFSET_PHYS_DEV_TERM", .value = offsetof(struct loader_physical_device_term, phys_dev), +- .comment = "The offset of 'phys_dev' within a 'loader_physical_device_term' struct" }, +- { .name = "INSTANCE_OFFSET_ICD_TERM", .value = offsetof(struct loader_icd_term, this_instance), +- .comment = "The offset of 'this_instance' within a 'loader_icd_term' struct" }, +- { .name = "DISPATCH_OFFSET_ICD_TERM", .value = offsetof(struct loader_icd_term, phys_dev_ext), +- .comment = "The offset of 'phys_dev_ext' within a 'loader_icd_term' struct" }, +- { .name = "EXT_OFFSET_DEVICE_DISPATCH", .value = offsetof(struct loader_dev_dispatch_table, ext_dispatch), +- .comment = "The offset of 'ext_dispatch' within a 'loader_dev_dispatch_table' struct" }, +- // clang-format on +- }; +- +- FILE *file = fopen("gen_defines.asm", "w"); +- fprintf(file, "\n"); +- if (!strcmp(assembler, "MASM")) { +- for (size_t i = 0; i < sizeof(values) / sizeof(values[0]); ++i) { +- fprintf(file, "%-32s equ " SIZE_T_FMT "; %s\n", values[i].name, values[i].value, values[i].comment); +- } +- } else if (!strcmp(assembler, "GAS")) { +-#if defined(__x86_64__) || defined(__i386__) +- const char *comment_delimiter = "#"; +-#if defined(__x86_64__) +- fprintf(file, ".set X86_64, 1\n"); +-#endif // defined(__x86_64__) +-#elif defined(__aarch64__) +- const char *comment_delimiter = "//"; +- fprintf(file, ".set AARCH_64, 1\n"); +-#else +- // Default comment delimiter +- const char *comment_delimiter = "#"; +-#endif +- for (size_t i = 0; i < sizeof(values) / sizeof(values[0]); ++i) { +- fprintf(file, ".set %-32s, " SIZE_T_FMT "%s %s\n", values[i].name, values[i].value, comment_delimiter, +- values[i].comment); +- } +- } +- return fclose(file); +-} ++// This file is not intended to be executed, as the generated asm contains all the relevant data which ++// the parse_asm_values.py script needs to write gen_defines.asm ++int main(int argc, char **argv) { return 0; } +diff --git a/scripts/parse_asm_values.py b/scripts/parse_asm_values.py +new file mode 100644 +index 000000000..bff263d2a +--- /dev/null ++++ b/scripts/parse_asm_values.py +@@ -0,0 +1,97 @@ ++#!/usr/bin/python3 -i ++# ++# Copyright (c) 2022 The Khronos Group Inc. ++# Copyright (c) 2022 LunarG, Inc. ++ ++# Licensed under the Apache License, Version 2.0 (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the License. ++# ++# Author: Charles Giessen ++ ++# This script reads in the 'intermediate output' of a compiler to look for sizeof/offsetof information ++# necessary for the assembler portions of the loader. This is achieved by forcing the compiler to output ++# the intermediate assembly output and looking for specific patterns which contain the relevant information ++ ++import sys ++import os.path ++from os.path import exists ++import re ++ ++ ++# Where to write the "gen_defines.asm" file ++destination_file = sys.argv[1] ++# The location the build system puts the intermediate asm file which depends on the compiler ++source_asm_file = sys.argv[2] ++# Whether we are using "MASM" or "GAS" for the assembler ++assembler_type = sys.argv[3] ++# Whether we are using gcc, clang, or msvc ++compiler = sys.argv[4] ++# taken from CMAKE_SYSTEM_PROCESSOR - x86_64 or aarch64 ++arch = sys.argv[5] ++ ++if destination_file is None or source_asm_file is None or assembler_type is None or compiler is None or arch is None: ++ print("Required command line arguments were not provided") ++ sys.exit(1) ++ ++defines = ["VULKAN_LOADER_ERROR_BIT", ++ "PTR_SIZE", ++ "CHAR_PTR_SIZE", ++ "FUNCTION_OFFSET_INSTANCE", ++ "PHYS_DEV_OFFSET_INST_DISPATCH", ++ "PHYS_DEV_OFFSET_PHYS_DEV_TRAMP", ++ "ICD_TERM_OFFSET_PHYS_DEV_TERM", ++ "PHYS_DEV_OFFSET_PHYS_DEV_TERM", ++ "INSTANCE_OFFSET_ICD_TERM", ++ "DISPATCH_OFFSET_ICD_TERM", ++ "EXT_OFFSET_DEVICE_DISPATCH" ] ++ ++try: ++ with open(source_asm_file, 'r') as f: ++ asm_intermediate_file = f.read() ++except IOError: ++ print("Could not open assembler file:", source_asm_file) ++ sys.exit(1) ++ ++with open(destination_file, "w", encoding="utf-8") as dest: ++ if assembler_type == "MASM": ++ # special case vulkan error bit due to it not appearing in the asm - its defined in the header as 8 so it shouldn't change ++ dest.write("VULKAN_LOADER_ERROR_BIT equ 8;\n") ++ elif assembler_type == "GAS": ++ # let the assembler know which platform to use ++ if arch == "x86_64": ++ dest.write(".set X86_64, 1\n") ++ elif arch == "aarch64": ++ dest.write(".set AARCH_64, 1\n") ++ ++ for d in defines: ++ match = None ++ if compiler == "MSVC": ++ if d == "VULKAN_LOADER_ERROR_BIT": ++ continue # skip due to special case ++ match = re.search(d + " DD [ ]*([0-9a-f]+)H", asm_intermediate_file) ++ elif compiler == "Clang" or compiler == "GNU": ++ match = re.search(d + " = ([0-9]+)", asm_intermediate_file) ++ ++ if match: ++ if compiler == "MSVC": ++ value = str(int(match.group(1), 16)) ++ elif compiler == "Clang" or compiler == "GNU": ++ value = match.group(1) ++ if assembler_type == "MASM": ++ # MASM uses hex values, decode them here ++ dest.write(d + " equ " + value +";\n") ++ elif assembler_type == "GAS": ++ dest.write(".set " + d + ", " + value + "\n") ++ else: ++ print("Couldn't find ", d) ++ sys.exit(1) ++ +diff --git a/tests/framework/CMakeLists.txt b/tests/framework/CMakeLists.txt +index 1ecc82cfd..3aedff55a 100644 +--- a/tests/framework/CMakeLists.txt ++++ b/tests/framework/CMakeLists.txt +@@ -85,12 +85,12 @@ add_custom_command( + PRE_BUILD + COMMAND ${CMAKE_COMMAND} "-E" "copy_if_different" "${CMAKE_CURRENT_BINARY_DIR}/framework_config_$.h" "${CMAKE_CURRENT_BINARY_DIR}/framework_config.h" + VERBATIM +- PRE_BUILD + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/framework_config_$.h" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/framework_config.h" + COMMENT "creating framework_config.h file ({event: PRE_BUILD}, {filename: framework_config.h })" + ) + add_custom_target (generate_framework_config DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/framework_config.h") ++add_dependencies (generate_framework_config vulkan) + add_dependencies (testing_framework_util generate_framework_config) + + add_library(testing_dependencies STATIC test_environment.cpp test_environment.h) diff --git a/srcpkgs/vulkan-loader/template b/srcpkgs/vulkan-loader/template index efcf10cd32b3..b93c4b9dc636 100644 --- a/srcpkgs/vulkan-loader/template +++ b/srcpkgs/vulkan-loader/template @@ -1,6 +1,6 @@ # Template file for 'vulkan-loader' pkgname=vulkan-loader -version=1.3.204.1 +version=1.3.231.2 revision=1 build_style=cmake configure_args="-Wno-dev -DVULKAN_HEADERS_INSTALL_DIR=${XBPS_CROSS_BASE}/usr @@ -13,4 +13,4 @@ maintainer="tibequadorian " license="Apache-2.0" homepage="https://www.khronos.org/vulkan/" distfiles="https://github.com/KhronosGroup/Vulkan-Loader/archive/sdk-${version}.tar.gz" -checksum=5dcd42b564804f4c01891ddd429a4a5028113c4cf39b44256689e8f543773134 +checksum=d9d103a6481a19ab9c9b880c1264e3026931741d3184b9930157551453bd4f92