diff --git a/src/vulkan/vulkan_loader.h b/src/vulkan/vulkan_loader.h index ce74c51b..e2a9f7e0 100644 --- a/src/vulkan/vulkan_loader.h +++ b/src/vulkan/vulkan_loader.h @@ -3,7 +3,11 @@ #include "../util/rc/util_rc.h" #include "../util/rc/util_rc_ptr.h" -#include "vulkan_loader_fn.h" +#define VK_USE_PLATFORM_WIN32_KHR 1 +#include + +#define VULKAN_FN(name) \ + ::PFN_ ## name name = reinterpret_cast<::PFN_ ## name>(sym(#name)) namespace dxvk::vk { diff --git a/src/vulkan/vulkan_loader_fn.h b/src/vulkan/vulkan_loader_fn.h deleted file mode 100644 index ecdd82a3..00000000 --- a/src/vulkan/vulkan_loader_fn.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -/* - * In 32-bit winelib build, alignment of Vulkan structures may be different than what - * native C++ compiler expects. Wine exposes an extension, intended for winelib - * applications, that exposes native Vulkan APIs with win32 additions, but using - * native ABI. - */ -#ifdef __WINE__ -#pragma push_macro("_WIN32") -#undef _WIN32 -#endif - -#define VK_USE_PLATFORM_WIN32_KHR 1 -#include - -#ifdef __WINE__ -#pragma pop_macro("_WIN32") -#endif - -#define VULKAN_FN(name) \ - VulkanFn<::PFN_ ## name> name = sym(#name) - -namespace dxvk::vk { - - template - class VulkanFn; - - /** - * \brief Vulkan function - * - * Wraps an Vulkan function pointer and provides - * a call operator using the correct types. - */ - template - class VulkanFn { - using Fn = Ret (VKAPI_PTR*)(Args...); - public: - - VulkanFn() { } - VulkanFn(Fn ptr) - : m_fn(ptr) { } - - VulkanFn(PFN_vkVoidFunction ptr) - : m_fn(reinterpret_cast(ptr)) { } - - /** - * \brief Invokes Vulkan function - * - * \param [in] args Arguments - * \returns Function return value - */ - Ret operator () (Args... args) const { - return (*m_fn)(args...); - } - - private: - - Fn m_fn = nullptr; - - }; - -} diff --git a/src/vulkan/vulkan_names.h b/src/vulkan/vulkan_names.h index 3f54e304..6752a12c 100644 --- a/src/vulkan/vulkan_names.h +++ b/src/vulkan/vulkan_names.h @@ -4,7 +4,7 @@ #include "../util/util_enum.h" -#include "vulkan_loader_fn.h" +#include "vulkan_loader.h" std::ostream& operator << (std::ostream& os, VkPipelineCacheHeaderVersion e); std::ostream& operator << (std::ostream& os, VkResult e); diff --git a/src/vulkan/vulkan_util.h b/src/vulkan/vulkan_util.h index b78da00e..97108ea6 100644 --- a/src/vulkan/vulkan_util.h +++ b/src/vulkan/vulkan_util.h @@ -1,6 +1,6 @@ #pragma once -#include "vulkan_loader_fn.h" +#include "vulkan_loader.h" namespace dxvk::vk {