-
Notifications
You must be signed in to change notification settings - Fork 17
/
primus_vk_dispatch_table.h
101 lines (85 loc) · 2.8 KB
/
primus_vk_dispatch_table.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include <stdexcept>
#define DECLARE(func) PFN_vk##func func = (PFN_vk##func)GetInstanceProcAddr(*pInstance, "vk" #func);
//#define FORWARD(func) dispatchTable.func = (PFN_vk##func)gpa(*pInstance, "vk" #func);
struct PvkInstanceDispatchTable {
VkInstance *pInstance;
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
PvkInstanceDispatchTable(VkInstance *pInstance, PFN_vkGetInstanceProcAddr gpa):
pInstance(pInstance), GetInstanceProcAddr(gpa) {
}
PvkInstanceDispatchTable() {
throw std::logic_error("Accessing un-fetched instance dispatch table");
}
DECLARE(EnumeratePhysicalDevices);
DECLARE(DestroyInstance);
DECLARE(EnumerateDeviceExtensionProperties);
DECLARE(GetPhysicalDeviceProperties);
DECLARE(GetPhysicalDeviceMemoryProperties);
DECLARE(GetPhysicalDeviceQueueFamilyProperties);
#ifdef VK_USE_PLATFORM_XCB_KHR
DECLARE(GetPhysicalDeviceXcbPresentationSupportKHR);
#endif
#ifdef VK_USE_PLATFORM_XLIB_KHR
DECLARE(GetPhysicalDeviceXlibPresentationSupportKHR);
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
DECLARE(GetPhysicalDeviceWaylandPresentationSupportKHR);
#endif
DECLARE(GetPhysicalDeviceSurfaceSupportKHR);
#define FORWARD(func) DECLARE(func)
#include "primus_vk_forwarding.h"
#undef FORWARD
};
#undef DECLARE
#define DECLARE(func) PFN_vk##func func = (PFN_vk##func)GetDeviceProcAddr(*pDevice, "vk" #func);
struct PvkDispatchTable {
VkDevice *pDevice;
PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
PvkDispatchTable(VkDevice *pDevice, PFN_vkGetDeviceProcAddr gdpa):
pDevice(pDevice), GetDeviceProcAddr(gdpa){
}
PvkDispatchTable() {
throw std::logic_error("Accessing un-fetched dispatch table");
}
DECLARE(DestroyDevice);
DECLARE(CreateSwapchainKHR);
DECLARE(DestroySwapchainKHR);
DECLARE(GetSwapchainImagesKHR);
DECLARE(AcquireNextImageKHR);
DECLARE(GetSwapchainStatusKHR);
DECLARE(QueuePresentKHR);
DECLARE(CreateImage);
DECLARE(GetImageMemoryRequirements);
DECLARE(AllocateMemory);
DECLARE(BindImageMemory);
DECLARE(GetImageSubresourceLayout);
DECLARE(FreeMemory);
DECLARE(DestroyImage);
DECLARE(MapMemory);
DECLARE(UnmapMemory);
DECLARE(AllocateCommandBuffers);
DECLARE(BeginCommandBuffer);
DECLARE(CmdDraw);
DECLARE(CmdDrawIndexed);
DECLARE(CmdCopyImage);
DECLARE(CmdPipelineBarrier);
DECLARE(CreateCommandPool);
//DECLARE(CreateDevice);
DECLARE(EndCommandBuffer);
//DECLARE(EnumeratePhysicalDevices);
DECLARE(FreeCommandBuffers);
DECLARE(DestroyCommandPool);
//DECLARE(GetPhysicalDeviceMemoryProperties);
DECLARE(QueueSubmit);
DECLARE(DeviceWaitIdle);
DECLARE(QueueWaitIdle);
DECLARE(GetDeviceQueue);
DECLARE(CreateFence);
DECLARE(WaitForFences);
DECLARE(ResetFences);
DECLARE(DestroyFence);
DECLARE(CreateSemaphore);
DECLARE(DestroySemaphore);
DECLARE(InvalidateMappedMemoryRanges);
};
#undef DECLARE