diff --git a/src/dawn_native/vulkan/VulkanError.cpp b/src/dawn_native/vulkan/VulkanError.cpp index 76f4a9a977..af235f1f27 100644 --- a/src/dawn_native/vulkan/VulkanError.cpp +++ b/src/dawn_native/vulkan/VulkanError.cpp @@ -18,8 +18,12 @@ namespace dawn_native { namespace vulkan { - const char* VkResultAsString(VkResult result) { - switch (result) { + const char* VkResultAsString(::VkResult result) { + // Convert to a uint32_t to silence and MSVC warning that the fake errors don't appear in + // the original VkResult enum. + uint32_t code = static_cast(result); + + switch (code) { case VK_SUCCESS: return "VK_SUCCESS"; case VK_NOT_READY: diff --git a/src/dawn_native/vulkan/VulkanError.h b/src/dawn_native/vulkan/VulkanError.h index c4ae5e7acf..7748f56cd3 100644 --- a/src/dawn_native/vulkan/VulkanError.h +++ b/src/dawn_native/vulkan/VulkanError.h @@ -24,7 +24,7 @@ constexpr VkResult VK_FAKE_DEVICE_OOM_FOR_TESTING = static_cast(VK_RES namespace dawn_native { namespace vulkan { // Returns a string version of the result. - const char* VkResultAsString(VkResult result); + const char* VkResultAsString(::VkResult result); MaybeError CheckVkSuccessImpl(VkResult result, const char* context); MaybeError CheckVkOOMThenSuccessImpl(VkResult result, const char* context); diff --git a/src/dawn_native/vulkan/external_memory/MemoryServiceDmaBuf.cpp b/src/dawn_native/vulkan/external_memory/MemoryServiceDmaBuf.cpp index e9944f8a4a..440852d538 100644 --- a/src/dawn_native/vulkan/external_memory/MemoryServiceDmaBuf.cpp +++ b/src/dawn_native/vulkan/external_memory/MemoryServiceDmaBuf.cpp @@ -141,8 +141,9 @@ namespace dawn_native { namespace vulkan { namespace external_memory { imageFormatProps.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2; imageFormatProps.pNext = &externalImageFormatProps; - VkResult result = mDevice->fn.GetPhysicalDeviceImageFormatProperties2KHR( - physicalDevice, &imageFormatInfo, &imageFormatProps); + VkResult result = + WkResult::WrapUnsafe(mDevice->fn.GetPhysicalDeviceImageFormatProperties2KHR( + physicalDevice, &imageFormatInfo, &imageFormatProps)); if (result != VK_SUCCESS) { return false; }