Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bb4db75 authored by Anders Frostad Pedersen's avatar Anders Frostad Pedersen Committed by Yiwei Zhang
Browse files

Vulkan: Improve error translation in CreateSwapChainKHR

Set VK_ERROR_OUT_OF_DEVICE_MEMORY in case the cause of the failure from
dequeueBuffer is an actual ENOMEM situation. Otherwise set
VK_ERROR_SURFACE_LOST_KHR as catch-all.

Bug: 145331195
Test: dEQP-VK.wsi.android.swapchain.create.image_extent
Change-Id: I8e7b4af3133e2a851beeda3618e24ca86279d317
Merged-In: I8e7b4af3133e2a851beeda3618e24ca86279d317
parent 6cea68f9
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -1302,9 +1302,16 @@ VkResult CreateSwapchainKHR(VkDevice device,
            // TODO(jessehall): Improve error reporting. Can we enumerate
            // possible errors and translate them to valid Vulkan result codes?
            ALOGE("dequeueBuffer[%u] failed: %s (%d)", i, strerror(-err), err);
            switch (-err) {
                case ENOMEM:
                    result = VK_ERROR_OUT_OF_DEVICE_MEMORY;
                    break;
                default:
                    result = VK_ERROR_SURFACE_LOST_KHR;
                    break;
            }
            break;
        }
        img.buffer = buffer;
        img.dequeued = true;