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

View file

@ -95,9 +95,12 @@ class VulkanApp {
std::vector<const char*> extensions = getRequiredExtensions(); std::vector<const char*> extensions = getRequiredExtensions();
// Enable the portability extension and set flags // Enable the portability extension and set flags
extensions.push_back(vk::KHRPortabilityEnumerationExtensionName); extensions.emplace_back(vk::KHRPortabilityEnumerationExtensionName);
#if VK_HEADER_VERSION < 110 #ifdef __APPLE__
extensions.push_back(vk::KHRGetPhysicalDeviceProperties2ExtensionName); // 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 #endif
vk::InstanceCreateInfo createInfo { vk::InstanceCreateInfo createInfo {
@ -181,7 +184,7 @@ class VulkanApp {
.queueCount = 1, .queueCount = 1,
.pQueuePriorities = &queuePriority }; .pQueuePriorities = &queuePriority };
queueCreateInfos.push_back(queueCreateInfo); queueCreateInfos.emplace_back(queueCreateInfo);
} }
vk::PhysicalDeviceFeatures deviceFeatures; vk::PhysicalDeviceFeatures deviceFeatures;
@ -190,7 +193,7 @@ class VulkanApp {
vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast<u32>(queueCreateInfos.size()), vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast<u32>(queueCreateInfos.size()),
.pQueueCreateInfos = queueCreateInfos.data(), .pQueueCreateInfos = queueCreateInfos.data(),
.enabledExtensionCount = 1, .enabledExtensionCount = 1,
.ppEnabledExtensionNames = { vk::KHRPortabilitySubsetExtensionName }, .ppEnabledExtensionNames = &vk::KHRPortabilitySubsetExtensionName,
.pEnabledFeatures = &deviceFeatures }; .pEnabledFeatures = &deviceFeatures };
#else #else
vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast<u32>(queueCreateInfos.size()), vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast<u32>(queueCreateInfos.size()),
@ -239,7 +242,7 @@ class VulkanApp {
std::vector extensions(extensionsSpan.begin(), extensionsSpan.end()); std::vector extensions(extensionsSpan.begin(), extensionsSpan.end());
if (enableValidationLayers) if (enableValidationLayers)
extensions.push_back(vk::EXTDebugUtilsExtensionName); extensions.emplace_back(vk::EXTDebugUtilsExtensionName);
return extensions; return extensions;
} }