mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
add missing initialization of dynamic dispatcher
This commit is contained in:
parent
7efe3d096b
commit
bbbbf6b751
@ -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")
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user