mirror of
https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
synced 2025-05-14 08:48:39 +00:00
Use vku prefix for vk_dispatch_table.h interface
This commit is contained in:
parent
b78ed1a5f0
commit
1c6d92cccf
4 changed files with 20 additions and 20 deletions
|
@ -15,7 +15,7 @@
|
|||
typedef PFN_vkVoidFunction(VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char *pName);
|
||||
|
||||
// Instance function pointer dispatch table
|
||||
typedef struct VulInstanceDispatchTable_ {
|
||||
typedef struct VkuInstanceDispatchTable_ {
|
||||
PFN_GetPhysicalDeviceProcAddr GetPhysicalDeviceProcAddr;
|
||||
|
||||
PFN_vkCreateInstance CreateInstance;
|
||||
|
@ -176,10 +176,10 @@ typedef struct VulInstanceDispatchTable_ {
|
|||
PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX GetPhysicalDeviceScreenPresentationSupportQNX;
|
||||
#endif // VK_USE_PLATFORM_SCREEN_QNX
|
||||
PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV GetPhysicalDeviceOpticalFlowImageFormatsNV;
|
||||
} VulInstanceDispatchTable;
|
||||
} VkuInstanceDispatchTable;
|
||||
|
||||
// Device function pointer dispatch table
|
||||
typedef struct VulDeviceDispatchTable_ {
|
||||
typedef struct VkuDeviceDispatchTable_ {
|
||||
PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
|
||||
PFN_vkDestroyDevice DestroyDevice;
|
||||
PFN_vkGetDeviceQueue GetDeviceQueue;
|
||||
|
@ -794,9 +794,9 @@ typedef struct VulDeviceDispatchTable_ {
|
|||
PFN_vkCmdDrawMeshTasksEXT CmdDrawMeshTasksEXT;
|
||||
PFN_vkCmdDrawMeshTasksIndirectEXT CmdDrawMeshTasksIndirectEXT;
|
||||
PFN_vkCmdDrawMeshTasksIndirectCountEXT CmdDrawMeshTasksIndirectCountEXT;
|
||||
} VulDeviceDispatchTable;
|
||||
} VkuDeviceDispatchTable;
|
||||
|
||||
static inline void vulInitDeviceDispatchTable(VkDevice device, VulDeviceDispatchTable *table, PFN_vkGetDeviceProcAddr gdpa) {
|
||||
static inline void vkuInitDeviceDispatchTable(VkDevice device, VkuDeviceDispatchTable *table, PFN_vkGetDeviceProcAddr gdpa) {
|
||||
memset(table, 0, sizeof(*table));
|
||||
// Device function pointers
|
||||
table->GetDeviceProcAddr = gdpa;
|
||||
|
@ -1415,7 +1415,7 @@ static inline void vulInitDeviceDispatchTable(VkDevice device, VulDeviceDispatch
|
|||
table->CmdDrawMeshTasksIndirectCountEXT = (PFN_vkCmdDrawMeshTasksIndirectCountEXT)gdpa(device, "vkCmdDrawMeshTasksIndirectCountEXT");
|
||||
}
|
||||
|
||||
static inline void vulInitInstanceDispatchTable(VkInstance instance, VulInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gipa) {
|
||||
static inline void vkuInitInstanceDispatchTable(VkInstance instance, VkuInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gipa) {
|
||||
memset(table, 0, sizeof(*table));
|
||||
// Instance function pointers
|
||||
table->GetInstanceProcAddr = gipa;
|
||||
|
|
|
@ -35,7 +35,7 @@ typedef PFN_vkVoidFunction(VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance
|
|||
''')
|
||||
out.append('''
|
||||
// Instance function pointer dispatch table
|
||||
typedef struct VulInstanceDispatchTable_ {
|
||||
typedef struct VkuInstanceDispatchTable_ {
|
||||
PFN_GetPhysicalDeviceProcAddr GetPhysicalDeviceProcAddr;
|
||||
|
||||
''')
|
||||
|
@ -43,20 +43,20 @@ typedef struct VulInstanceDispatchTable_ {
|
|||
out.extend([f'#ifdef {command.protect}\n'] if command.protect else [])
|
||||
out.append(f' PFN_{command.name} {command.name[2:]};\n')
|
||||
out.extend([f'#endif // {command.protect}\n'] if command.protect else [])
|
||||
out.append('} VulInstanceDispatchTable;\n')
|
||||
out.append('} VkuInstanceDispatchTable;\n')
|
||||
|
||||
out.append('''
|
||||
// Device function pointer dispatch table
|
||||
typedef struct VulDeviceDispatchTable_ {
|
||||
typedef struct VkuDeviceDispatchTable_ {
|
||||
''')
|
||||
for command in [x for x in self.vk.commands.values() if x.device]:
|
||||
out.extend([f'#ifdef {command.protect}\n'] if command.protect else [])
|
||||
out.append(f' PFN_{command.name} {command.name[2:]};\n')
|
||||
out.extend([f'#endif // {command.protect}\n'] if command.protect else [])
|
||||
out.append('} VulDeviceDispatchTable;\n')
|
||||
out.append('} VkuDeviceDispatchTable;\n')
|
||||
|
||||
out.append('''
|
||||
static inline void vulInitDeviceDispatchTable(VkDevice device, VulDeviceDispatchTable *table, PFN_vkGetDeviceProcAddr gdpa) {
|
||||
static inline void vkuInitDeviceDispatchTable(VkDevice device, VkuDeviceDispatchTable *table, PFN_vkGetDeviceProcAddr gdpa) {
|
||||
memset(table, 0, sizeof(*table));
|
||||
// Device function pointers
|
||||
table->GetDeviceProcAddr = gdpa;
|
||||
|
@ -69,7 +69,7 @@ static inline void vulInitDeviceDispatchTable(VkDevice device, VulDeviceDispatch
|
|||
out.append('}\n')
|
||||
|
||||
out.append('''
|
||||
static inline void vulInitInstanceDispatchTable(VkInstance instance, VulInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gipa) {
|
||||
static inline void vkuInitInstanceDispatchTable(VkInstance instance, VkuInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gipa) {
|
||||
memset(table, 0, sizeof(*table));
|
||||
// Instance function pointers
|
||||
table->GetInstanceProcAddr = gipa;
|
||||
|
|
|
@ -18,14 +18,14 @@ PFN_vkVoidFunction VKAPI_PTR local_vkGetDeviceProcAddr(VkDevice device, const ch
|
|||
}
|
||||
|
||||
void vk_dispatch_table() {
|
||||
VulDeviceDispatchTable device_dispatch_table;
|
||||
VulInstanceDispatchTable instance_dispatch_table;
|
||||
VkuDeviceDispatchTable device_dispatch_table;
|
||||
VkuInstanceDispatchTable instance_dispatch_table;
|
||||
|
||||
VkInstance instance = VK_NULL_HANDLE;
|
||||
|
||||
vulInitInstanceDispatchTable(instance, &instance_dispatch_table, local_vkGetInstanceProcAddr);
|
||||
vkuInitInstanceDispatchTable(instance, &instance_dispatch_table, local_vkGetInstanceProcAddr);
|
||||
|
||||
VkDevice device = VK_NULL_HANDLE;
|
||||
|
||||
vulInitDeviceDispatchTable(device, &device_dispatch_table, local_vkGetDeviceProcAddr);
|
||||
vkuInitDeviceDispatchTable(device, &device_dispatch_table, local_vkGetDeviceProcAddr);
|
||||
}
|
||||
|
|
|
@ -28,18 +28,18 @@ inline PFN_vkVoidFunction local_vkGetDeviceProcAddr(VkDevice device, const char
|
|||
}
|
||||
|
||||
TEST(test_vk_dispatch_table, cpp_interface) {
|
||||
VulDeviceDispatchTable device_dispatch_table{};
|
||||
VulInstanceDispatchTable instance_dispatch_table{};
|
||||
VkuDeviceDispatchTable device_dispatch_table{};
|
||||
VkuInstanceDispatchTable instance_dispatch_table{};
|
||||
|
||||
VkInstance instance{};
|
||||
|
||||
vulInitInstanceDispatchTable(instance, &instance_dispatch_table, local_vkGetInstanceProcAddr);
|
||||
vkuInitInstanceDispatchTable(instance, &instance_dispatch_table, local_vkGetInstanceProcAddr);
|
||||
|
||||
ASSERT_EQ(instance_dispatch_table.GetInstanceProcAddr, local_vkGetInstanceProcAddr);
|
||||
|
||||
VkDevice device{};
|
||||
|
||||
vulInitDeviceDispatchTable(device, &device_dispatch_table, local_vkGetDeviceProcAddr);
|
||||
vkuInitDeviceDispatchTable(device, &device_dispatch_table, local_vkGetDeviceProcAddr);
|
||||
|
||||
ASSERT_EQ(device_dispatch_table.GetDeviceProcAddr, local_vkGetDeviceProcAddr);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue