mirror of
https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
synced 2025-05-15 09:18:49 +00:00
Ensure all header files shipped have the vk_ prefix
CI will fail now if we ship a .h / .hpp file that doesn't use the correct prefix. I also documented the precedent for this prefix and the existing integration testing.
This commit is contained in:
parent
a3235b3e7f
commit
6710b67cde
16 changed files with 124 additions and 56 deletions
|
@ -1,45 +0,0 @@
|
|||
// Copyright 2023 The Khronos Group Inc.
|
||||
// Copyright 2023 Valve Corporation
|
||||
// Copyright 2023 LunarG, Inc.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <vulkan/utility/vul_dispatch_table.h>
|
||||
|
||||
// Only exists so that local_vkGetDeviceProcAddr can return a 'real' function pointer
|
||||
inline void empty_func() {}
|
||||
|
||||
inline PFN_vkVoidFunction local_vkGetInstanceProcAddr(VkInstance instance, const char *pName) {
|
||||
if (instance == VK_NULL_HANDLE) return NULL;
|
||||
|
||||
if (strcmp(pName, "vkGetInstanceProcAddr")) return reinterpret_cast<PFN_vkVoidFunction>(&local_vkGetInstanceProcAddr);
|
||||
|
||||
return reinterpret_cast<PFN_vkVoidFunction>(&empty_func);
|
||||
}
|
||||
|
||||
inline PFN_vkVoidFunction local_vkGetDeviceProcAddr(VkDevice device, const char *pName) {
|
||||
if (device == VK_NULL_HANDLE) return NULL;
|
||||
|
||||
if (strcmp(pName, "vkGetDeviceProcAddr")) return reinterpret_cast<PFN_vkVoidFunction>(&local_vkGetDeviceProcAddr);
|
||||
return reinterpret_cast<PFN_vkVoidFunction>(&empty_func);
|
||||
}
|
||||
|
||||
TEST(test_vul_dispatch_table, cpp_interface) {
|
||||
VulDeviceDispatchTable device_dispatch_table{};
|
||||
VulInstanceDispatchTable instance_dispatch_table{};
|
||||
|
||||
VkInstance instance{};
|
||||
|
||||
vulInitInstanceDispatchTable(instance, &instance_dispatch_table, local_vkGetInstanceProcAddr);
|
||||
|
||||
ASSERT_EQ(instance_dispatch_table.GetInstanceProcAddr, local_vkGetInstanceProcAddr);
|
||||
|
||||
VkDevice device{};
|
||||
|
||||
vulInitDeviceDispatchTable(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