Merge pull request #499 from tomilov/master

Add missing initialization of dynamic dispatcher in NoExceptions test
This commit is contained in:
Andreas Süßenbach 2020-02-03 10:20:13 +01:00 committed by GitHub
commit d0e3b3a5e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -31,8 +31,6 @@ add_executable(NoExceptions
${SOURCES}
)
if (UNIX)
target_link_libraries(NoExceptions "-ldl")
endif()
target_link_libraries(NoExceptions ${CMAKE_DL_LIBS})
set_target_properties(NoExceptions PROPERTIES FOLDER "Tests")

View File

@ -22,15 +22,21 @@
#include "vulkan/vulkan.hpp"
#include <iostream>
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<PFN_vkGetInstanceProcAddr>("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<vk::PhysicalDevice> 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<uint32_t>(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;