diff --git a/CMakeLists.txt b/CMakeLists.txt index bae181566..f461722dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -453,7 +453,6 @@ if (BUILD_THUNKS) CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" - "-DVULKAN_XML=${CMAKE_SOURCE_DIR}/External/Vulkan-Docs/xml/vk.xml" "-DGENERATOR_EXE=$" INSTALL_COMMAND "" BUILD_ALWAYS ON @@ -479,7 +478,6 @@ if (BUILD_THUNKS) "-DX86_CXX_COMPILER:STRING=${X86_CXX_COMPILER}" "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" "-DSTRUCT_VERIFIER=${CMAKE_SOURCE_DIR}/Scripts/StructPackVerifier.py" - "-DVULKAN_XML=${CMAKE_SOURCE_DIR}/External/Vulkan-Docs/xml/vk.xml" "-DGENERATOR_EXE=$" INSTALL_COMMAND "" BUILD_ALWAYS ON diff --git a/ThunkLibs/GuestLibs/CMakeLists.txt b/ThunkLibs/GuestLibs/CMakeLists.txt index 8d0ebc10a..fbf83be22 100644 --- a/ThunkLibs/GuestLibs/CMakeLists.txt +++ b/ThunkLibs/GuestLibs/CMakeLists.txt @@ -50,28 +50,36 @@ function(generate NAME) endif() endfunction() -# Syntax: generate(libxyz libxyz-interface.cpp generator-targets...) +# Syntax: generate(libxyz [LIBNAME libxyz-custom] libxyz-interface.cpp generator-targets...) # This defines two targets and a custom command: # - custom command: Main build step that runs the thunk generator on the given interface definition # - libxyz-interface: Target for IDE integration (making sure libxyz-interface.cpp shows up as a source file in the project tree) # - libxyz-deps: Interface target to read include directories from which are passed to libclang when parsing the interface definition function(generate_new NAME) + cmake_parse_arguments(PARSE_ARGV 1 ARGS "" "LIBNAME" "") + set(ARGN ${ARGS_UNPARSED_ARGUMENTS}) list(POP_FRONT ARGN SOURCE_FILE) + if (ARGS_LIBNAME) + set(LIBNAME ${ARGS_LIBNAME}) + else() + set(LIBNAME ${NAME}) + endif() + # Interface target for the user to add include directories - add_library(${NAME}-deps INTERFACE) - target_include_directories(${NAME}-deps INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/../include") + add_library(${LIBNAME}-deps INTERFACE) + target_include_directories(${LIBNAME}-deps INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/../include") # Shorthand for the include directories added after calling this function. # This is not evaluated directly, hence directories added after return are still picked up - set(prop "$") + set(prop "$") # Target for IDE integration - add_library(${NAME}-interface EXCLUDE_FROM_ALL ${SOURCE_FILE}) - target_link_libraries(${NAME}-interface PRIVATE ${NAME}-deps) + add_library(${LIBNAME}-interface EXCLUDE_FROM_ALL ${SOURCE_FILE}) + target_link_libraries(${LIBNAME}-interface PRIVATE ${LIBNAME}-deps) # Run thunk generator for each of the given output files foreach(WHAT IN LISTS ARGN) - set(OUTFOLDER "${CMAKE_CURRENT_BINARY_DIR}/gen/${NAME}") + set(OUTFOLDER "${CMAKE_CURRENT_BINARY_DIR}/gen/${LIBNAME}") set(OUTFILE "${OUTFOLDER}/${WHAT}.inl") add_custom_command(OUTPUT ${OUTFOLDER} @@ -82,7 +90,7 @@ function(generate_new NAME) DEPENDS "${GENERATOR_EXE}" DEPENDS "${OUTFOLDER}" DEPENDS "${SOURCE_FILE}" - COMMAND "${GENERATOR_EXE}" "${SOURCE_FILE}" "${NAME}" "-${WHAT}" "${OUTFILE}" -- -std=c++17 + COMMAND "${GENERATOR_EXE}" "${SOURCE_FILE}" "${LIBNAME}" "-${WHAT}" "${OUTFILE}" -- -std=c++17 # Expand include directories to space-separated list of -isystem parameters "$<$:;-isystem$>" VERBATIM @@ -91,7 +99,7 @@ function(generate_new NAME) list(APPEND OUTPUTS "${OUTFILE}") endforeach() - set(GEN_${NAME} ${OUTPUTS} PARENT_SCOPE) + set(GEN_${LIBNAME} ${OUTPUTS} PARENT_SCOPE) endfunction() add_custom_target(ThunkGuestsInstall) @@ -173,14 +181,8 @@ set (VULKAN_LIBS ) foreach (LIB IN LISTS VULKAN_LIBS) - set(WITH_ARGS "lib${LIB}" "${VULKAN_XML}" "--print-header") - generate_with_name(libvulkan_device lib${LIB} Header) - set(WITH_ARGS "") - - set(WITH_ARGS "lib${LIB}" "${VULKAN_XML}" "--print-thunks") - generate_with_name(libvulkan_device lib${LIB} thunks function_packs function_packs_public function_pack_pair) + generate_new(libvulkan_device LIBNAME lib${LIB} ${CMAKE_CURRENT_SOURCE_DIR}/../libvulkan_device/libvulkan_device_interface.cpp thunks function_packs function_packs_public symbol_list) add_guest_lib_with_name(vulkan_device ${LIB}) - set(WITH_ARGS "") endforeach() generate_new(libxcb ${CMAKE_CURRENT_SOURCE_DIR}/../libxcb/libxcb_interface.cpp thunks function_packs function_packs_public callback_structs callback_unpacks_header callback_unpacks_header_init callback_unpacks callback_typedefs) diff --git a/ThunkLibs/HostLibs/CMakeLists.txt b/ThunkLibs/HostLibs/CMakeLists.txt index b94cba5ff..1a264cd12 100644 --- a/ThunkLibs/HostLibs/CMakeLists.txt +++ b/ThunkLibs/HostLibs/CMakeLists.txt @@ -43,28 +43,36 @@ function(generate NAME) endif() endfunction() -# Syntax: generate(libxyz libxyz-interface.cpp generator-targets...) +# Syntax: generate(libxyz [LIBNAME libxyz-custom] libxyz-interface.cpp generator-targets...) # This defines two targets and a custom command: # - custom command: Main build step that runs the thunk generator on the given interface definition # - libxyz-interface: Target for IDE integration (making sure libxyz-interface.cpp shows up as a source file in the project tree) # - libxyz-deps: Interface target to read include directories from which are passed to libclang when parsing the interface definition function(generate_new NAME) + cmake_parse_arguments(PARSE_ARGV 1 ARGS "" "LIBNAME" "") + set(ARGN ${ARGS_UNPARSED_ARGUMENTS}) list(POP_FRONT ARGN SOURCE_FILE) + if (ARGS_LIBNAME) + set(LIBNAME ${ARGS_LIBNAME}) + else() + set(LIBNAME ${NAME}) + endif() + # Interface target for the user to add include directories - add_library(${NAME}-deps INTERFACE) - target_include_directories(${NAME}-deps INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/../include") + add_library(${LIBNAME}-deps INTERFACE) + target_include_directories(${LIBNAME}-deps INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/../include") # Shorthand for the include directories added after calling this function. # This is not evaluated directly, hence directories added after return are still picked up - set(prop "$") + set(prop "$") # Target for IDE integration - add_library(${NAME}-interface EXCLUDE_FROM_ALL ${SOURCE_FILE}) - target_link_libraries(${NAME}-interface PRIVATE ${NAME}-deps) + add_library(${LIBNAME}-interface EXCLUDE_FROM_ALL ${SOURCE_FILE}) + target_link_libraries(${LIBNAME}-interface PRIVATE ${LIBNAME}-deps) # Run thunk generator for each of the given output files foreach(WHAT IN LISTS ARGN) - set(OUTFOLDER "${CMAKE_CURRENT_BINARY_DIR}/gen/${NAME}") + set(OUTFOLDER "${CMAKE_CURRENT_BINARY_DIR}/gen/${LIBNAME}") set(OUTFILE "${OUTFOLDER}/${WHAT}.inl") add_custom_command(OUTPUT ${OUTFOLDER} @@ -75,7 +83,7 @@ function(generate_new NAME) DEPENDS "${GENERATOR_EXE}" DEPENDS "${OUTFOLDER}" DEPENDS "${SOURCE_FILE}" - COMMAND "${GENERATOR_EXE}" "${SOURCE_FILE}" "${NAME}" "-${WHAT}" "${OUTFILE}" -- -std=c++17 + COMMAND "${GENERATOR_EXE}" "${SOURCE_FILE}" "${LIBNAME}" "-${WHAT}" "${OUTFILE}" -- -std=c++17 # Expand include directories to space-separated list of -isystem parameters "$<$:;-isystem$>" VERBATIM @@ -84,7 +92,7 @@ function(generate_new NAME) list(APPEND OUTPUTS "${OUTFILE}") endforeach() - set(GEN_${NAME} ${OUTPUTS} PARENT_SCOPE) + set(GEN_${LIBNAME} ${OUTPUTS} PARENT_SCOPE) endfunction() function(add_host_lib_with_name NAME LIBNAME) @@ -166,14 +174,8 @@ set (VULKAN_LIBS ) foreach (LIB IN LISTS VULKAN_LIBS) - set(WITH_ARGS "lib${LIB}" "${VULKAN_XML}" "--print-header") - generate_with_name(libvulkan_device lib${LIB} Header) - set(WITH_ARGS "") - - set(WITH_ARGS "lib${LIB}" "${VULKAN_XML}" "--print-thunks") - generate_with_name(libvulkan_device lib${LIB} function_unpacks tab_function_unpacks ldr ldr_ptrs ldr_ptrs_pair) + generate_new(libvulkan_device LIBNAME lib${LIB} ${CMAKE_CURRENT_SOURCE_DIR}/../libvulkan_device/libvulkan_device_interface.cpp function_unpacks tab_function_unpacks ldr ldr_ptrs symbol_list) add_host_lib_with_name(vulkan_device ${LIB}) - set(WITH_ARGS "") endforeach() generate_new(libxcb ${CMAKE_CURRENT_SOURCE_DIR}/../libxcb/libxcb_interface.cpp function_unpacks tab_function_unpacks ldr ldr_ptrs callback_structs callback_unpacks_header callback_typedefs) diff --git a/ThunkLibs/libvulkan_device/Guest.cpp b/ThunkLibs/libvulkan_device/Guest.cpp index 5d2a5fc0c..f3f4b248d 100644 --- a/ThunkLibs/libvulkan_device/Guest.cpp +++ b/ThunkLibs/libvulkan_device/Guest.cpp @@ -1,56 +1,46 @@ -/* -$info$ -tags: thunklibs|vulkan -$end_info$ -*/ - -#include "Header.inl" - -#include -#include -#include -#include -#include -#include -#include +#define VK_USE_PLATFORM_XLIB_XRANDR_EXT +#define VK_USE_PLATFORM_XLIB_KHR +#define VK_USE_PLATFORM_XCB_KHR +#define VK_USE_PLATFORM_WAYLAND_KHR +#include #include "common/Guest.h" -#include + +#include +#include +#include +#include #include "thunks.inl" #include "function_packs.inl" #include "function_packs_public.inl" +#include "symbol_list.inl" extern "C" { static bool Setup{}; static std::unordered_map PtrsToLookUp{}; -static PFN_vkVoidFunction fexfn_pack_vkGetDeviceProcAddr(VkDevice a_0,const char* a_1); -static PFN_vkVoidFunction fexfn_pack_vkGetInstanceProcAddr(VkInstance a_0,const char* a_1); -static void fexfn_pack_vkCmdSetBlendConstants(VkCommandBuffer a_0,const float a_1[4]); - // Setup can't be done on shared library constructor // Needs to be deferred until post-constructor phase to remove the chance of crashing static void DoSetup() { // Initialize unordered_map from generated initializer-list PtrsToLookUp = { -#define PAIR(name, ptr) { #name, (PFN_vkVoidFunction*)ptr } -#include "function_pack_pair.inl" +#define PAIR(name, unused) { #name, (PFN_vkVoidFunction*)name }, +FOREACH_SYMBOL(PAIR) #undef PAIR }; Setup = true; } -static PFN_vkVoidFunction fexfn_pack_vkGetDeviceProcAddr(VkDevice a_0,const char* a_1){ + +PFN_vkVoidFunction vkGetDeviceProcAddr(VkDevice a_0,const char* a_1){ if (!Setup) { DoSetup(); } - struct {VkDevice a_0;const char* a_1;PFN_vkVoidFunction rv;} args; - args.a_0 = a_0;args.a_1 = a_1; - THUNKFUNC(vkGetDeviceProcAddr)(&args); + auto ret = fexfn_pack_vkGetDeviceProcAddr(a_0, a_1); - if (args.rv == nullptr) { + if (ret == nullptr) { // Early out if our instance doesn't have the pointer // Definitely means we don't support it return nullptr; @@ -66,17 +56,15 @@ static PFN_vkVoidFunction fexfn_pack_vkGetDeviceProcAddr(VkDevice a_0,const char return (PFN_vkVoidFunction)It->second; } -static PFN_vkVoidFunction fexfn_pack_vkGetInstanceProcAddr(VkInstance a_0,const char* a_1){ +PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance a_0,const char* a_1){ if (!Setup) { DoSetup(); } // Search our host install first to see if the pointer exists // This also populates a map on the host facing side - struct {VkInstance a_0;const char* a_1;PFN_vkVoidFunction rv;} args; - args.a_0 = a_0;args.a_1 = a_1; - THUNKFUNC(vkGetInstanceProcAddr)(&args); - if (args.rv == nullptr) { + auto ret = fexfn_pack_vkGetInstanceProcAddr(a_0, a_1); + if (ret == nullptr) { // Early out if our instance doesn't have the pointer // Definitely means we don't support it return nullptr; @@ -90,16 +78,6 @@ static PFN_vkVoidFunction fexfn_pack_vkGetInstanceProcAddr(VkInstance a_0,const return (PFN_vkVoidFunction)It->second; } -static void fexfn_pack_vkCmdSetBlendConstants(VkCommandBuffer a_0,const float a_1[4]){ - struct {VkCommandBuffer a_0; float a_1[4];} args; - args.a_0 = a_0; - memcpy(args.a_1, a_1, sizeof(float) * 4); - THUNKFUNC(vkCmdSetBlendConstants)(&args); -} - -PFN_vkVoidFunction vkGetDeviceProcAddr(VkDevice a_0,const char* a_1) __attribute__((alias("fexfn_pack_vkGetDeviceProcAddr"))); -PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance a_0,const char* a_1) __attribute__((alias("fexfn_pack_vkGetInstanceProcAddr"))); -void vkCmdSetBlendConstants(VkCommandBuffer a_0,const float a_1[4]) __attribute__((alias("fexfn_pack_vkCmdSetBlendConstants"))); } #define DOLOAD(name) LOAD_LIB(name) diff --git a/ThunkLibs/libvulkan_device/Host.cpp b/ThunkLibs/libvulkan_device/Host.cpp index f398896cf..9b9022b39 100644 --- a/ThunkLibs/libvulkan_device/Host.cpp +++ b/ThunkLibs/libvulkan_device/Host.cpp @@ -1,22 +1,19 @@ -/* -$info$ -tags: thunklibs|vulkan -$end_info$ -*/ - -#include "Header.inl" - -#include -#include -#include -#include -#include +#define VK_USE_PLATFORM_XLIB_XRANDR_EXT +#define VK_USE_PLATFORM_XLIB_KHR +#define VK_USE_PLATFORM_XCB_KHR +#define VK_USE_PLATFORM_WAYLAND_KHR +#include #include "common/Host.h" + +#include +#include + #include #include "ldr_ptrs.inl" -#include "function_unpacks.inl" + +#include "symbol_list.inl" static bool SetupDev{}; static bool SetupInstance{}; @@ -24,6 +21,11 @@ std::mutex SetupMutex{}; static std::unordered_map PtrsToLookUp{}; + +#define CONCAT(a, b, c) a##_##b##_##c +#define EVAL(a, b) CONCAT(fexldr_ptr, a, b) +#define LDR_PTR(fn) EVAL(LIBLIB_NAME, fn) + static void DoSetupWithDevice(VkDevice dev) { std::unique_lock lk {SetupMutex}; @@ -37,8 +39,8 @@ static void DoSetupWithDevice(VkDevice dev) { } }; -#define PAIR(name, ptr_unused) add_ptr(#name); -#include "ldr_ptrs_pair.inl" +#define PAIR(name, unused) add_ptr(#name); +FOREACH_SYMBOL(PAIR) #undef PAIR SetupDev = true; @@ -55,8 +57,8 @@ static void DoSetupWithInstance(VkInstance instance) { } }; -#define PAIR(name, ptr) add_ptr(#name); -#include "ldr_ptrs_pair.inl" +#define PAIR(name, unused) add_ptr(#name); +FOREACH_SYMBOL(PAIR); #undef PAIR // Only do this lookup once. @@ -66,105 +68,75 @@ static void DoSetupWithInstance(VkInstance instance) { } } -static void UNPACKFUNC(vkGetDeviceProcAddr)(void *argsv){ - struct arg_t {VkDevice a_0;const char* a_1;PFN_vkVoidFunction rv;}; - auto args = (arg_t*)argsv; +#define FEXFN_IMPL3(a, b, c) a##_##b##_##c +#define FEXFN_IMPL2(a, b) FEXFN_IMPL3(fexfn_impl, a, b) +#define FEXFN_IMPL(fn) FEXFN_IMPL2(LIBLIB_NAME, fn) +static PFN_vkVoidFunction FEXFN_IMPL(vkGetDeviceProcAddr)(VkDevice a_0, const char* a_1) { if (!SetupDev) { - DoSetupWithDevice(args->a_0); + DoSetupWithDevice(a_0); } // Just return the host facing function pointer // The guest will handle mapping if this exists - args->rv = - LDR_PTR(vkGetDeviceProcAddr) - (args->a_0,args->a_1); + auto ret = LDR_PTR(vkGetDeviceProcAddr)(a_0, a_1); + return ret; } -static void UNPACKFUNC(vkGetInstanceProcAddr)(void *argsv){ - struct arg_t {VkInstance a_0;const char* a_1;PFN_vkVoidFunction rv;}; - auto args = (arg_t*)argsv; - +static PFN_vkVoidFunction FEXFN_IMPL(vkGetInstanceProcAddr)(VkInstance a_0, const char* a_1) { if (!SetupInstance) { - DoSetupWithInstance(args->a_0); + DoSetupWithInstance(a_0); } // Just return the host facing function pointer // The guest will handle mapping if it exists - args->rv = - LDR_PTR(vkGetInstanceProcAddr) - (args->a_0,args->a_1); + auto ret = LDR_PTR(vkGetInstanceProcAddr)(a_0, a_1); + return ret; } -static void UNPACKFUNC(vkCreateShaderModule)(void *argsv){ - struct arg_t {VkDevice a_0;const VkShaderModuleCreateInfo* a_1;const VkAllocationCallbacks* a_2;VkShaderModule* a_3;VkResult rv;}; - auto args = (arg_t*)argsv; - args->rv = - LDR_PTR(vkCreateShaderModule) - (args->a_0,args->a_1, nullptr,args->a_3); - +static VkResult FEXFN_IMPL(vkCreateShaderModule)(VkDevice a_0, const VkShaderModuleCreateInfo* a_1, const VkAllocationCallbacks* a_2, VkShaderModule* a_3) { + return LDR_PTR(vkCreateShaderModule)(a_0, a_1, nullptr, a_3); } -static void UNPACKFUNC(vkCmdSetBlendConstants)(void *argsv){ - struct arg_t {VkCommandBuffer a_0;const float a_1[4];}; - auto args = (arg_t*)argsv; - LDR_PTR(vkCmdSetBlendConstants) - (args->a_0,args->a_1); +static VkResult FEXFN_IMPL(vkCreateInstance)(const VkInstanceCreateInfo* a_0, const VkAllocationCallbacks* a_1, VkInstance* a_2) { + return LDR_PTR(vkCreateInstance)(a_0, nullptr, a_2); } -static void UNPACKFUNC(vkCreateInstance)(void *argsv){ - struct arg_t {const VkInstanceCreateInfo* a_0;const VkAllocationCallbacks* a_1;VkInstance* a_2;VkResult rv;}; - auto args = (arg_t*)argsv; - args->rv = - LDR_PTR(vkCreateInstance) - (args->a_0, nullptr,args->a_2); +static VkResult FEXFN_IMPL(vkCreateDevice)(VkPhysicalDevice a_0, const VkDeviceCreateInfo* a_1, const VkAllocationCallbacks* a_2, VkDevice* a_3){ + return LDR_PTR(vkCreateDevice)(a_0, a_1, nullptr, a_3); } -static void UNPACKFUNC(vkCreateDevice)(void *argsv){ - struct arg_t {VkPhysicalDevice a_0;const VkDeviceCreateInfo* a_1;const VkAllocationCallbacks* a_2;VkDevice* a_3;VkResult rv;}; - auto args = (arg_t*)argsv; - args->rv = - LDR_PTR(vkCreateDevice) - (args->a_0,args->a_1, nullptr,args->a_3); +static VkResult FEXFN_IMPL(vkAllocateMemory)(VkDevice a_0, const VkMemoryAllocateInfo* a_1, const VkAllocationCallbacks* a_2, VkDeviceMemory* a_3){ + return LDR_PTR(vkAllocateMemory)(a_0, a_1, nullptr, a_3); } -static void UNPACKFUNC(vkAllocateMemory)(void *argsv){ - struct arg_t {VkDevice a_0;const VkMemoryAllocateInfo* a_1;const VkAllocationCallbacks* a_2;VkDeviceMemory* a_3;VkResult rv;}; - auto args = (arg_t*)argsv; - args->rv = - LDR_PTR(vkAllocateMemory) - (args->a_0,args->a_1,nullptr,args->a_3); -} -static void UNPACKFUNC(vkFreeMemory)(void *argsv){ - struct arg_t {VkDevice a_0;VkDeviceMemory a_1;const VkAllocationCallbacks* a_2;}; - auto args = (arg_t*)argsv; - LDR_PTR(vkFreeMemory) - (args->a_0,args->a_1,nullptr); +static void FEXFN_IMPL(vkFreeMemory)(VkDevice a_0, VkDeviceMemory a_1, const VkAllocationCallbacks* a_2) { + LDR_PTR(vkFreeMemory)(a_0, a_1, nullptr); } -static void UNPACKFUNC(vkGetPhysicalDeviceSurfaceSupportKHR)(void *argsv){ - struct arg_t {VkPhysicalDevice a_0;uint32_t a_1;VkSurfaceKHR a_2;VkBool32* a_3;VkResult rv;}; - auto args = (arg_t*)argsv; - args->rv = LDR_PTR(vkGetPhysicalDeviceSurfaceSupportKHR) - (args->a_0,args->a_1,args->a_2,args->a_3); -} + +#include "function_unpacks.inl" static ExportEntry exports[] = { #include "tab_function_unpacks.inl" { nullptr, nullptr } }; -#include "ldr.inl" - static void DoSetup() { // Initialize unordered_map from generated initializer-list +#define PAIR(name, unused) { #name, (PFN_vkVoidFunction*)&LDR_PTR(name) }, PtrsToLookUp = { -#define PAIR(name, ptr) { #name, (PFN_vkVoidFunction*)ptr }, -#include "ldr_ptrs_pair.inl" -#undef PAIR + FOREACH_SYMBOL(PAIR) }; +#undef PAIR } +#include "ldr.inl" + +#define LDR_HANDLE3(a) fexldr_ptr##_##a##_##so +#define LDR_HANDLE2(a) LDR_HANDLE3(a) +#define LDR_HANDLE LDR_HANDLE2(LIBLIB_NAME) + static void init_func() { // Initialize some initial pointers that we can get while loading (void*&)LDR_PTR(vkGetInstanceProcAddr) = dlsym(LDR_HANDLE, "vkGetInstanceProcAddr"); diff --git a/ThunkLibs/libvulkan_device/libvulkan_device_interface.cpp b/ThunkLibs/libvulkan_device/libvulkan_device_interface.cpp new file mode 100644 index 000000000..149cfb1bb --- /dev/null +++ b/ThunkLibs/libvulkan_device/libvulkan_device_interface.cpp @@ -0,0 +1,431 @@ +#include + +template +struct fex_gen_config; + +#define VK_USE_PLATFORM_XLIB_XRANDR_EXT +#define VK_USE_PLATFORM_XLIB_KHR +#define VK_USE_PLATFORM_XCB_KHR +#define VK_USE_PLATFORM_WAYLAND_KHR +#include + +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config : fexgen::custom_host_impl {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config : fexgen::custom_host_impl {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config : fexgen::custom_host_impl {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config : fexgen::custom_host_impl {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config : fexgen::custom_host_impl {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config : fexgen::custom_host_impl, fexgen::custom_guest_entrypoint, fexgen::returns_guest_pointer {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config : fexgen::custom_host_impl, fexgen::custom_guest_entrypoint, fexgen::returns_guest_pointer {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {}; +template<> struct fex_gen_config {};