Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
ahb_swapchain_vk_unittests.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "gtest/gtest.h"
6
10
12
14
15const std::vector<std::string> kAndroidDeviceExtensions = {
16 "VK_KHR_swapchain",
17 "VK_ANDROID_external_memory_android_hardware_buffer",
18 "VK_KHR_sampler_ycbcr_conversion",
19 "VK_KHR_external_memory",
20 "VK_EXT_queue_family_foreign",
21 "VK_KHR_dedicated_allocation",
22};
23
25 public:
26 bool IsValid() const override { return true; }
27
28 ASurfaceControl* GetHandle() const override { return nullptr; }
29
30 bool RemoveFromParent() const override { return true; }
31};
32
33TEST(AndroidAHBSwapchainTest,
34 AHBSwapchainNoFenceWaitAfterAcquireNextImageFailure) {
35 bool wait_for_fences_called = false;
36 auto const context =
40 [](VkDevice, VkSwapchainKHR, uint64_t, VkSemaphore, VkFence,
41 uint32_t*) -> VkResult { return VK_ERROR_SURFACE_LOST_KHR; })
42 .SetWaitForFencesCallback([&](VkDevice, uint32_t, const VkFence*,
43 VkBool32, uint64_t) -> VkResult {
44 wait_for_fences_called = true;
45 return VK_SUCCESS;
46 })
47 .Build();
48
49 auto ahb_swapchain = std::shared_ptr<AHBSwapchainVK>(new AHBSwapchainVK(
50 context, std::make_shared<FakeSurfaceControl>(), {}, {100, 100}, false));
51
52 auto image = ahb_swapchain->AcquireNextDrawable();
53 EXPECT_FALSE(image);
54
55 ahb_swapchain->AcquireNextDrawable();
56 EXPECT_FALSE(wait_for_fences_called);
57}
58
59} // namespace impeller::android::testing
The implementation of a swapchain that uses hardware buffers presented to a given surface control on ...
A wrapper for ASurfaceControl. https://developer.android.com/ndk/reference/group/native-activity#asur...
bool RemoveFromParent() const override
Remove the surface control from the hierarchy of nodes presented by the system compositor.
MockVulkanContextBuilder & SetDeviceExtensions(const std::vector< std::string > &device_extensions)
Definition mock_vulkan.h:92
MockVulkanContextBuilder SetAcquireNextImageCallback(std::function< std::remove_pointer_t< PFN_vkAcquireNextImageKHR > > acquire_next_image_callback)
FlutterVulkanImage * image
TEST(AndroidAHBSwapchainTest, AHBSwapchainNoFenceWaitAfterAcquireNextImageFailure)
const std::vector< std::string > kAndroidDeviceExtensions