mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-24 02:05:46 +01:00
vulkan_wrapper: Add interop functions
This commit is contained in:
parent
9735c34f5d
commit
16f97ded21
@ -173,6 +173,10 @@ void Load(VkDevice device, DeviceDispatch& dld) noexcept {
|
|||||||
X(vkGetEventStatus);
|
X(vkGetEventStatus);
|
||||||
X(vkGetFenceStatus);
|
X(vkGetFenceStatus);
|
||||||
X(vkGetImageMemoryRequirements);
|
X(vkGetImageMemoryRequirements);
|
||||||
|
X(vkGetMemoryFdKHR);
|
||||||
|
#ifdef _WIN32
|
||||||
|
X(vkGetMemoryWin32HandleKHR);
|
||||||
|
#endif
|
||||||
X(vkGetQueryPoolResults);
|
X(vkGetQueryPoolResults);
|
||||||
X(vkGetSemaphoreCounterValueKHR);
|
X(vkGetSemaphoreCounterValueKHR);
|
||||||
X(vkMapMemory);
|
X(vkMapMemory);
|
||||||
@ -505,6 +509,32 @@ void ImageView::SetObjectNameEXT(const char* name) const {
|
|||||||
SetObjectName(dld, owner, handle, VK_OBJECT_TYPE_IMAGE_VIEW, name);
|
SetObjectName(dld, owner, handle, VK_OBJECT_TYPE_IMAGE_VIEW, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DeviceMemory::GetMemoryFdKHR() const {
|
||||||
|
const VkMemoryGetFdInfoKHR get_fd_info{
|
||||||
|
.sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR,
|
||||||
|
.pNext = nullptr,
|
||||||
|
.memory = handle,
|
||||||
|
.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR,
|
||||||
|
};
|
||||||
|
int fd;
|
||||||
|
Check(dld->vkGetMemoryFdKHR(owner, &get_fd_info, &fd));
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
HANDLE DeviceMemory::GetMemoryWin32HandleKHR() const {
|
||||||
|
const VkMemoryGetWin32HandleInfoKHR get_win32_handle_info{
|
||||||
|
.sType = VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR,
|
||||||
|
.pNext = nullptr,
|
||||||
|
.memory = handle,
|
||||||
|
.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR,
|
||||||
|
};
|
||||||
|
HANDLE win32_handle;
|
||||||
|
Check(dld->vkGetMemoryWin32HandleKHR(owner, &get_win32_handle_info, &win32_handle));
|
||||||
|
return win32_handle;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void DeviceMemory::SetObjectNameEXT(const char* name) const {
|
void DeviceMemory::SetObjectNameEXT(const char* name) const {
|
||||||
SetObjectName(dld, owner, handle, VK_OBJECT_TYPE_DEVICE_MEMORY, name);
|
SetObjectName(dld, owner, handle, VK_OBJECT_TYPE_DEVICE_MEMORY, name);
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ struct InstanceDispatch {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Table holding Vulkan device function pointers.
|
/// Table holding Vulkan device function pointers.
|
||||||
struct DeviceDispatch : public InstanceDispatch {
|
struct DeviceDispatch : InstanceDispatch {
|
||||||
PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR{};
|
PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR{};
|
||||||
PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers{};
|
PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers{};
|
||||||
PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets{};
|
PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets{};
|
||||||
@ -288,6 +288,10 @@ struct DeviceDispatch : public InstanceDispatch {
|
|||||||
PFN_vkGetEventStatus vkGetEventStatus{};
|
PFN_vkGetEventStatus vkGetEventStatus{};
|
||||||
PFN_vkGetFenceStatus vkGetFenceStatus{};
|
PFN_vkGetFenceStatus vkGetFenceStatus{};
|
||||||
PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements{};
|
PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements{};
|
||||||
|
PFN_vkGetMemoryFdKHR vkGetMemoryFdKHR{};
|
||||||
|
#ifdef _WIN32
|
||||||
|
PFN_vkGetMemoryWin32HandleKHR vkGetMemoryWin32HandleKHR{};
|
||||||
|
#endif
|
||||||
PFN_vkGetQueryPoolResults vkGetQueryPoolResults{};
|
PFN_vkGetQueryPoolResults vkGetQueryPoolResults{};
|
||||||
PFN_vkGetSemaphoreCounterValueKHR vkGetSemaphoreCounterValueKHR{};
|
PFN_vkGetSemaphoreCounterValueKHR vkGetSemaphoreCounterValueKHR{};
|
||||||
PFN_vkMapMemory vkMapMemory{};
|
PFN_vkMapMemory vkMapMemory{};
|
||||||
@ -673,6 +677,12 @@ class DeviceMemory : public Handle<VkDeviceMemory, VkDevice, DeviceDispatch> {
|
|||||||
using Handle<VkDeviceMemory, VkDevice, DeviceDispatch>::Handle;
|
using Handle<VkDeviceMemory, VkDevice, DeviceDispatch>::Handle;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
int GetMemoryFdKHR() const;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
HANDLE GetMemoryWin32HandleKHR() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Set object name.
|
/// Set object name.
|
||||||
void SetObjectNameEXT(const char* name) const;
|
void SetObjectNameEXT(const char* name) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user