89 vk::ApplicationInfo appInfo;
91 appInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0);
92 appInfo.pEngineName =
"No Engine";
93 appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
94 appInfo.apiVersion = VK_API_VERSION_1_2;
96 vk::InstanceCreateInfo createInfo;
97 createInfo.pApplicationInfo = &appInfo;
99 std::vector<const char*> extensions;
104 std::vector<vk::ExtensionProperties> availableExtensions(vk::enumerateInstanceExtensionProperties());
111 return std::string(p.extensionName);
116 extensions.reserve(extensions.size() + windowRequiredExtensions.size());
117 extensions.insert(extensions.end(), windowRequiredExtensions.begin(), windowRequiredExtensions.end());
120 createInfo.enabledExtensionCount =
static_cast<uint32_t
>(extensions.size());
121 createInfo.ppEnabledExtensionNames = extensions.data();
123 catch (
const std::exception& e) {
131 std::vector<const char*> layers;
136 std::vector<vk::LayerProperties> availableLayers(vk::enumerateInstanceLayerProperties());
139 layers = getExtensions<vk::LayerProperties>(availableLayers, requiredValidationLayers,
140 requestedValidationLayers, [](
const vk::LayerProperties& p) {
143 return std::string(p.layerName);
147 createInfo.enabledLayerCount =
static_cast<uint32_t
>(layers.size());
148 createInfo.ppEnabledLayerNames = layers.data();
150 catch (
const std::exception&) {
152 createInfo.enabledLayerCount = 0;
157 createInfo.enabledLayerCount = 0;
161 instance = vk::createInstanceUnique(createInfo);