Fix compilation of VkResult changes on MSVC and ChromeOS

Bug: dawn:295
Change-Id: I8156af4789fca155163e8beed57805eefe6ec686
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14640
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2019-12-17 17:39:31 +00:00 committed by Commit Bot service account
parent 1586b4d73e
commit c073adaa76
3 changed files with 10 additions and 5 deletions

View File

@ -18,8 +18,12 @@
namespace dawn_native { namespace vulkan { namespace dawn_native { namespace vulkan {
const char* VkResultAsString(VkResult result) { const char* VkResultAsString(::VkResult result) {
switch (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<uint32_t>(result);
switch (code) {
case VK_SUCCESS: case VK_SUCCESS:
return "VK_SUCCESS"; return "VK_SUCCESS";
case VK_NOT_READY: case VK_NOT_READY:

View File

@ -24,7 +24,7 @@ constexpr VkResult VK_FAKE_DEVICE_OOM_FOR_TESTING = static_cast<VkResult>(VK_RES
namespace dawn_native { namespace vulkan { namespace dawn_native { namespace vulkan {
// Returns a string version of the result. // 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 CheckVkSuccessImpl(VkResult result, const char* context);
MaybeError CheckVkOOMThenSuccessImpl(VkResult result, const char* context); MaybeError CheckVkOOMThenSuccessImpl(VkResult result, const char* context);

View File

@ -141,8 +141,9 @@ namespace dawn_native { namespace vulkan { namespace external_memory {
imageFormatProps.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2; imageFormatProps.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2;
imageFormatProps.pNext = &externalImageFormatProps; imageFormatProps.pNext = &externalImageFormatProps;
VkResult result = mDevice->fn.GetPhysicalDeviceImageFormatProperties2KHR( VkResult result =
physicalDevice, &imageFormatInfo, &imageFormatProps); WkResult::WrapUnsafe(mDevice->fn.GetPhysicalDeviceImageFormatProperties2KHR(
physicalDevice, &imageFormatInfo, &imageFormatProps));
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
return false; return false;
} }