From 87c6018de163e27fd1970e8cc08e10d8280a6094 Mon Sep 17 00:00:00 2001 From: Mars Date: Tue, 1 Oct 2024 14:15:39 -0400 Subject: [PATCH] fix es --- src/main.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 8b001d3..3f155cc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -95,9 +95,12 @@ class VulkanApp { std::vector 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(queueCreateInfos.size()), .pQueueCreateInfos = queueCreateInfos.data(), .enabledExtensionCount = 1, - .ppEnabledExtensionNames = { vk::KHRPortabilitySubsetExtensionName }, + .ppEnabledExtensionNames = &vk::KHRPortabilitySubsetExtensionName, .pEnabledFeatures = &deviceFeatures }; #else vk::DeviceCreateInfo createInfo { .queueCreateInfoCount = static_cast(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; }