mirror of
https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
synced 2025-06-02 18:07:59 +00:00
parent
881049b977
commit
d7418625d9
4 changed files with 29 additions and 10 deletions
|
@ -37,4 +37,8 @@ target_link_libraries(vul_tests PRIVATE
|
|||
Vulkan::CompilerConfiguration
|
||||
)
|
||||
|
||||
if (CMAKE_CROSSCOMPILING)
|
||||
return()
|
||||
endif()
|
||||
|
||||
gtest_discover_tests(vul_tests DISCOVERY_TIMEOUT 100)
|
||||
|
|
|
@ -90,6 +90,8 @@ TEST(struct_helper, struct_defaults_correct) {
|
|||
ASSERT_EQ(s.t4.sType, VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO);
|
||||
}
|
||||
|
||||
#if VK_USE_64_BIT_PTR_DEFINES == 1
|
||||
|
||||
TEST(struct_helper, get_object_type) {
|
||||
ASSERT_EQ(vku::GetObjectType<VkInstance>(), VK_OBJECT_TYPE_INSTANCE);
|
||||
ASSERT_EQ(vku::GetObjectType<VkPerformanceConfigurationINTEL>(), VK_OBJECT_TYPE_PERFORMANCE_CONFIGURATION_INTEL);
|
||||
|
@ -97,3 +99,5 @@ TEST(struct_helper, get_object_type) {
|
|||
ASSERT_EQ(vku::GetObjectType<VkAccelerationStructureKHR>(), VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR);
|
||||
ASSERT_EQ(vku::GetObjectType<VkAccelerationStructureNV>(), VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV);
|
||||
}
|
||||
|
||||
#endif // VK_USE_64_BIT_PTR_DEFINES == 1
|
||||
|
|
|
@ -10,20 +10,29 @@
|
|||
#include <vulkan/utility/vk_dispatch_table.h>
|
||||
|
||||
// Only exists so that local_vkGetDeviceProcAddr can return a 'real' function pointer
|
||||
inline void empty_func() {}
|
||||
inline VKAPI_ATTR void empty_func() {}
|
||||
|
||||
inline PFN_vkVoidFunction local_vkGetInstanceProcAddr(VkInstance instance, const char *pName) {
|
||||
if (instance == VK_NULL_HANDLE) return NULL;
|
||||
inline VKAPI_ATTR 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);
|
||||
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;
|
||||
inline VKAPI_ATTR 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);
|
||||
}
|
||||
|
||||
if (strcmp(pName, "vkGetDeviceProcAddr")) return reinterpret_cast<PFN_vkVoidFunction>(&local_vkGetDeviceProcAddr);
|
||||
return reinterpret_cast<PFN_vkVoidFunction>(&empty_func);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue