From bbbbf6b751598b4067d8b6d838e5214379402fa6 Mon Sep 17 00:00:00 2001 From: tomilov Date: Thu, 30 Jan 2020 14:46:20 +0500 Subject: [PATCH] add missing initialization of dynamic dispatcher --- tests/NoExceptions/CMakeLists.txt | 2 +- tests/NoExceptions/NoExceptions.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/NoExceptions/CMakeLists.txt b/tests/NoExceptions/CMakeLists.txt index 6feb80e..7b9f12c 100644 --- a/tests/NoExceptions/CMakeLists.txt +++ b/tests/NoExceptions/CMakeLists.txt @@ -32,7 +32,7 @@ add_executable(NoExceptions ) if (UNIX) - target_link_libraries(NoExceptions "-ldl") + target_link_libraries(NoExceptions ${CMAKE_DL_LIBS}) endif() set_target_properties(NoExceptions PROPERTIES FOLDER "Tests") diff --git a/tests/NoExceptions/NoExceptions.cpp b/tests/NoExceptions/NoExceptions.cpp index f9e5fa0..e3d35be 100644 --- a/tests/NoExceptions/NoExceptions.cpp +++ b/tests/NoExceptions/NoExceptions.cpp @@ -22,15 +22,21 @@ #include "vulkan/vulkan.hpp" #include -static char const* AppName = "DeviceFunctions"; +static char const* AppName = "NoExceptions"; static char const* EngineName = "Vulkan.hpp"; VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE; int main(int /*argc*/, char ** /*argv*/) { + vk::DynamicLoader dl; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress("vkGetInstanceProcAddr"); + VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr); + vk::ApplicationInfo appInfo(AppName, 1, EngineName, 1, VK_API_VERSION_1_1); vk::UniqueInstance instance = vk::createInstanceUnique(vk::InstanceCreateInfo({}, &appInfo)).value; + VULKAN_HPP_DEFAULT_DISPATCHER.init(*instance); + std::vector physicalDevices = instance->enumeratePhysicalDevices().value; assert(!physicalDevices.empty()); @@ -48,6 +54,7 @@ int main(int /*argc*/, char ** /*argv*/) float queuePriority = 0.0f; vk::DeviceQueueCreateInfo deviceQueueCreateInfo(vk::DeviceQueueCreateFlags(), static_cast(graphicsQueueFamilyIndex), 1, &queuePriority); vk::UniqueDevice device = physicalDevices[0].createDeviceUnique(vk::DeviceCreateInfo(vk::DeviceCreateFlags(), 1, &deviceQueueCreateInfo)).value; + VULKAN_HPP_DEFAULT_DISPATCHER.init(*device); // create a UniqueCommandPool to allocate a CommandBuffer from vk::UniqueCommandPool commandPool = device->createCommandPoolUnique(vk::CommandPoolCreateInfo(vk::CommandPoolCreateFlags(), deviceQueueCreateInfo.queueFamilyIndex)).value;