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

Commit b9d9e30b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ignore VK_KHR_incremental_present hint for MAILBOX."

parents 832b6b94 ffedb65c
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -176,9 +176,12 @@ enum { MAX_TIMING_INFOS = 10 };
enum { MIN_NUM_FRAMES_AGO = 5 };
enum { MIN_NUM_FRAMES_AGO = 5 };


struct Swapchain {
struct Swapchain {
    Swapchain(Surface& surface_, uint32_t num_images_)
    Swapchain(Surface& surface_,
              uint32_t num_images_,
              VkPresentModeKHR present_mode)
        : surface(surface_),
        : surface(surface_),
          num_images(num_images_),
          num_images(num_images_),
          mailbox_mode(present_mode == VK_PRESENT_MODE_MAILBOX_KHR),
          frame_timestamps_enabled(false) {
          frame_timestamps_enabled(false) {
        ANativeWindow* window = surface.window.get();
        ANativeWindow* window = surface.window.get();
        int64_t rdur;
        int64_t rdur;
@@ -190,6 +193,7 @@ struct Swapchain {


    Surface& surface;
    Surface& surface;
    uint32_t num_images;
    uint32_t num_images;
    bool mailbox_mode;
    bool frame_timestamps_enabled;
    bool frame_timestamps_enabled;
    uint64_t refresh_duration;
    uint64_t refresh_duration;


@@ -858,7 +862,8 @@ VkResult CreateSwapchainKHR(VkDevice device,
                                         VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
                                         VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (!mem)
    if (!mem)
        return VK_ERROR_OUT_OF_HOST_MEMORY;
        return VK_ERROR_OUT_OF_HOST_MEMORY;
    Swapchain* swapchain = new (mem) Swapchain(surface, num_images);
    Swapchain* swapchain =
        new (mem) Swapchain(surface, num_images, create_info->presentMode);


    // -- Dequeue all buffers and create a VkImage for each --
    // -- Dequeue all buffers and create a VkImage for each --
    // Any failures during or after this must cancel the dequeued buffers.
    // Any failures during or after this must cancel the dequeued buffers.
@@ -1160,7 +1165,8 @@ VkResult QueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* present_info) {
            *SwapchainFromHandle(present_info->pSwapchains[sc]);
            *SwapchainFromHandle(present_info->pSwapchains[sc]);
        uint32_t image_idx = present_info->pImageIndices[sc];
        uint32_t image_idx = present_info->pImageIndices[sc];
        Swapchain::Image& img = swapchain.images[image_idx];
        Swapchain::Image& img = swapchain.images[image_idx];
        const VkPresentRegionKHR* region = (regions) ? &regions[sc] : nullptr;
        const VkPresentRegionKHR* region =
            (regions && !swapchain.mailbox_mode) ? &regions[sc] : nullptr;
        const VkPresentTimeGOOGLE* time = (times) ? &times[sc] : nullptr;
        const VkPresentTimeGOOGLE* time = (times) ? &times[sc] : nullptr;
        VkResult swapchain_result = VK_SUCCESS;
        VkResult swapchain_result = VK_SUCCESS;
        VkResult result;
        VkResult result;