add missing initialization of dynamic dispatcher
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user