From 5958c36b315fe2d96a73a4eb259c0694261dd079 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Fri, 27 May 2022 16:35:16 +0000 Subject: [PATCH] Vulkan: Remove deprecated VK_MAKE_VERSION This patch replaces VK_MAKE_VERSION with VK_API_VERSION_1_x as VK_MAKE_VERSION has been deprecated in vulkan_core.h. Bug: tint:1497 Change-Id: I9e9d1d39a139aad687d1f2c7671b562b46e83768 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91800 Reviewed-by: Austin Eng Commit-Queue: Austin Eng --- src/dawn/native/vulkan/BackendVk.cpp | 2 +- src/dawn/native/vulkan/VulkanExtensions.cpp | 6 +++--- src/dawn/native/vulkan/VulkanExtensions.h | 4 ++-- src/dawn/native/vulkan/VulkanFunctions.cpp | 6 +++--- src/dawn/native/vulkan/VulkanInfo.cpp | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/dawn/native/vulkan/BackendVk.cpp b/src/dawn/native/vulkan/BackendVk.cpp index fc3e0e9944..ca4a5ddd06 100644 --- a/src/dawn/native/vulkan/BackendVk.cpp +++ b/src/dawn/native/vulkan/BackendVk.cpp @@ -329,7 +329,7 @@ ResultOrError VulkanInstance::CreateVkInstance(const Instance appInfo.applicationVersion = 0; appInfo.pEngineName = nullptr; appInfo.engineVersion = 0; - appInfo.apiVersion = std::min(mGlobalInfo.apiVersion, VK_MAKE_VERSION(1, 3, 0)); + appInfo.apiVersion = std::min(mGlobalInfo.apiVersion, VK_API_VERSION_1_3); VkInstanceCreateInfo createInfo; createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; diff --git a/src/dawn/native/vulkan/VulkanExtensions.cpp b/src/dawn/native/vulkan/VulkanExtensions.cpp index b9e176ae66..439e95d129 100644 --- a/src/dawn/native/vulkan/VulkanExtensions.cpp +++ b/src/dawn/native/vulkan/VulkanExtensions.cpp @@ -22,9 +22,9 @@ namespace dawn::native::vulkan { -static constexpr uint32_t VulkanVersion_1_1 = VK_MAKE_VERSION(1, 1, 0); -static constexpr uint32_t VulkanVersion_1_2 = VK_MAKE_VERSION(1, 2, 0); -static constexpr uint32_t VulkanVersion_1_3 = VK_MAKE_VERSION(1, 3, 0); +static constexpr uint32_t VulkanVersion_1_1 = VK_API_VERSION_1_1; +static constexpr uint32_t VulkanVersion_1_2 = VK_API_VERSION_1_2; +static constexpr uint32_t VulkanVersion_1_3 = VK_API_VERSION_1_3; static constexpr uint32_t NeverPromoted = std::numeric_limits::max(); // A static array for InstanceExtInfo that can be indexed with InstanceExts. diff --git a/src/dawn/native/vulkan/VulkanExtensions.h b/src/dawn/native/vulkan/VulkanExtensions.h index c7c361a7b5..6912528404 100644 --- a/src/dawn/native/vulkan/VulkanExtensions.h +++ b/src/dawn/native/vulkan/VulkanExtensions.h @@ -54,7 +54,7 @@ using InstanceExtSet = ityp::bitset(InstanceE struct InstanceExtInfo { InstanceExt index; const char* name; - // The version in which this extension was promoted as built with VK_MAKE_VERSION, + // The version in which this extension was promoted as built with VK_API_VERSION_1_x, // or NeverPromoted if it was never promoted. uint32_t versionPromoted; }; @@ -117,7 +117,7 @@ using DeviceExtSet = ityp::bitset(DeviceExt::En struct DeviceExtInfo { DeviceExt index; const char* name; - // The version in which this extension was promoted as built with VK_MAKE_VERSION, + // The version in which this extension was promoted as built with VK_API_VERSION_1_x, // or NeverPromoted if it was never promoted. uint32_t versionPromoted; }; diff --git a/src/dawn/native/vulkan/VulkanFunctions.cpp b/src/dawn/native/vulkan/VulkanFunctions.cpp index a173403855..3734daceae 100644 --- a/src/dawn/native/vulkan/VulkanFunctions.cpp +++ b/src/dawn/native/vulkan/VulkanFunctions.cpp @@ -138,19 +138,19 @@ MaybeError VulkanFunctions::LoadInstanceProcs(VkInstance instance, // Vulkan 1.1 is not required to report promoted extensions from 1.0 and is not required to // support the vendor entrypoint in GetProcAddress. - if (globalInfo.apiVersion >= VK_MAKE_VERSION(1, 1, 0)) { + if (globalInfo.apiVersion >= VK_API_VERSION_1_1) { GET_INSTANCE_PROC(GetPhysicalDeviceExternalBufferProperties); } else if (globalInfo.HasExt(InstanceExt::ExternalMemoryCapabilities)) { GET_INSTANCE_PROC_VENDOR(GetPhysicalDeviceExternalBufferProperties, KHR); } - if (globalInfo.apiVersion >= VK_MAKE_VERSION(1, 1, 0)) { + if (globalInfo.apiVersion >= VK_API_VERSION_1_1) { GET_INSTANCE_PROC(GetPhysicalDeviceExternalSemaphoreProperties); } else if (globalInfo.HasExt(InstanceExt::ExternalSemaphoreCapabilities)) { GET_INSTANCE_PROC_VENDOR(GetPhysicalDeviceExternalSemaphoreProperties, KHR); } - if (globalInfo.apiVersion >= VK_MAKE_VERSION(1, 1, 0)) { + if (globalInfo.apiVersion >= VK_API_VERSION_1_1) { GET_INSTANCE_PROC(GetPhysicalDeviceFeatures2); GET_INSTANCE_PROC(GetPhysicalDeviceProperties2); GET_INSTANCE_PROC(GetPhysicalDeviceFormatProperties2); diff --git a/src/dawn/native/vulkan/VulkanInfo.cpp b/src/dawn/native/vulkan/VulkanInfo.cpp index 4d5ddeeb56..116fd7222d 100644 --- a/src/dawn/native/vulkan/VulkanInfo.cpp +++ b/src/dawn/native/vulkan/VulkanInfo.cpp @@ -68,7 +68,7 @@ ResultOrError GatherGlobalInfo(const VulkanFunctions& vkFuncti VulkanGlobalInfo info = {}; // Gather info on available API version { - info.apiVersion = VK_MAKE_VERSION(1, 0, 0); + info.apiVersion = VK_API_VERSION_1_0; if (vkFunctions.EnumerateInstanceVersion != nullptr) { DAWN_TRY(CheckVkSuccess(vkFunctions.EnumerateInstanceVersion(&info.apiVersion), "vkEnumerateInstanceVersion"));