mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-11 10:24:10 +01:00
[vulkan] Remove VulkanFn wrapper
Not really necessary, and apparently this is causing trouble on GCC 10.1. Fixes #1620.
This commit is contained in:
parent
3a6c0cf605
commit
e7455b6460
@ -3,7 +3,11 @@
|
|||||||
#include "../util/rc/util_rc.h"
|
#include "../util/rc/util_rc.h"
|
||||||
#include "../util/rc/util_rc_ptr.h"
|
#include "../util/rc/util_rc_ptr.h"
|
||||||
|
|
||||||
#include "vulkan_loader_fn.h"
|
#define VK_USE_PLATFORM_WIN32_KHR 1
|
||||||
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
|
#define VULKAN_FN(name) \
|
||||||
|
::PFN_ ## name name = reinterpret_cast<::PFN_ ## name>(sym(#name))
|
||||||
|
|
||||||
namespace dxvk::vk {
|
namespace dxvk::vk {
|
||||||
|
|
||||||
|
@ -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 <vulkan/vulkan.h>
|
|
||||||
|
|
||||||
#ifdef __WINE__
|
|
||||||
#pragma pop_macro("_WIN32")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define VULKAN_FN(name) \
|
|
||||||
VulkanFn<::PFN_ ## name> name = sym(#name)
|
|
||||||
|
|
||||||
namespace dxvk::vk {
|
|
||||||
|
|
||||||
template<typename Fn>
|
|
||||||
class VulkanFn;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Vulkan function
|
|
||||||
*
|
|
||||||
* Wraps an Vulkan function pointer and provides
|
|
||||||
* a call operator using the correct types.
|
|
||||||
*/
|
|
||||||
template<typename Ret, typename... Args>
|
|
||||||
class VulkanFn<Ret (VKAPI_PTR*)(Args...)> {
|
|
||||||
using Fn = Ret (VKAPI_PTR*)(Args...);
|
|
||||||
public:
|
|
||||||
|
|
||||||
VulkanFn() { }
|
|
||||||
VulkanFn(Fn ptr)
|
|
||||||
: m_fn(ptr) { }
|
|
||||||
|
|
||||||
VulkanFn(PFN_vkVoidFunction ptr)
|
|
||||||
: m_fn(reinterpret_cast<Fn>(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;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "../util/util_enum.h"
|
#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, VkPipelineCacheHeaderVersion e);
|
||||||
std::ostream& operator << (std::ostream& os, VkResult e);
|
std::ostream& operator << (std::ostream& os, VkResult e);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "vulkan_loader_fn.h"
|
#include "vulkan_loader.h"
|
||||||
|
|
||||||
namespace dxvk::vk {
|
namespace dxvk::vk {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user