This commit is contained in:
Mars 2024-10-01 14:15:39 -04:00
parent aadf46f066
commit 87c6018de1
Signed by: pupbrained
GPG key ID: 874E22DF2F9DFCB5

View file

@ -95,9 +95,12 @@ class VulkanApp {
std::vector<const char*> extensions = getRequiredExtensions();
// Enable the portability extension and set flags
extensions.push_back(vk::KHRPortabilityEnumerationExtensionName);
#if VK_HEADER_VERSION < 110
extensions.push_back(vk::KHRGetPhysicalDeviceProperties2ExtensionName);
extensions.emplace_back(vk::KHRPortabilityEnumerationExtensionName);
#ifdef __APPLE__
// Technically deprecated but vulkan complains if I don't include it for macOS
// So instead of using the vk::KHRPortabilitySubsetExtensionName, I just use
// the direct string.
extensions.emplace_back("VK_KHR_get_physical_device_properties2");
#endif
vk::InstanceCreateInfo createInfo {
@ -181,7 +184,7 @@ class VulkanApp {
.queueCount = 1,
.pQueuePriorities = &queuePriority };
queueCreateInfos.push_back(queueCreateInfo);
queueCreateInfos.emplace_back(queueCreateInfo);
}
vk::PhysicalDeviceFeatures deviceFeatures;
@ -190,7 +193,7 @@ class VulkanApp {
vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast<u32>(queueCreateInfos.size()),
.pQueueCreateInfos = queueCreateInfos.data(),
.enabledExtensionCount = 1,
.ppEnabledExtensionNames = { vk::KHRPortabilitySubsetExtensionName },
.ppEnabledExtensionNames = &vk::KHRPortabilitySubsetExtensionName,
.pEnabledFeatures = &deviceFeatures };
#else
vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast<u32>(queueCreateInfos.size()),
@ -239,7 +242,7 @@ class VulkanApp {
std::vector extensions(extensionsSpan.begin(), extensionsSpan.end());
if (enableValidationLayers)
extensions.push_back(vk::EXTDebugUtilsExtensionName);
extensions.emplace_back(vk::EXTDebugUtilsExtensionName);
return extensions;
}