flutter_flutter/shell/common/shell_test_platform_view_vulkan.cc
George Wright d2aab27b4f
Enable shell_unittests on Fuchsia with Vulkan dependencies. (#16376)
This also adds a dependency on SwiftShader's Vulkan frontend.
2020-02-06 15:07:01 -08:00

50 lines
1.6 KiB
C++

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/shell/common/shell_test_platform_view_vulkan.h"
#include "flutter/shell/gpu/gpu_surface_vulkan.h"
namespace flutter {
namespace testing {
ShellTestPlatformViewVulkan::ShellTestPlatformViewVulkan(
PlatformView::Delegate& delegate,
TaskRunners task_runners,
std::shared_ptr<ShellTestVsyncClock> vsync_clock,
CreateVsyncWaiter create_vsync_waiter)
: ShellTestPlatformView(delegate, std::move(task_runners)),
create_vsync_waiter_(std::move(create_vsync_waiter)),
vsync_clock_(vsync_clock),
proc_table_(fml::MakeRefCounted<vulkan::VulkanProcTable>()) {}
ShellTestPlatformViewVulkan::~ShellTestPlatformViewVulkan() = default;
std::unique_ptr<VsyncWaiter> ShellTestPlatformViewVulkan::CreateVSyncWaiter() {
return create_vsync_waiter_();
}
void ShellTestPlatformViewVulkan::SimulateVSync() {
vsync_clock_->SimulateVSync();
}
// |PlatformView|
std::unique_ptr<Surface> ShellTestPlatformViewVulkan::CreateRenderingSurface() {
return std::make_unique<GPUSurfaceVulkan>(this, nullptr, true);
}
// |PlatformView|
PointerDataDispatcherMaker ShellTestPlatformViewVulkan::GetDispatcherMaker() {
return [](DefaultPointerDataDispatcher::Delegate& delegate) {
return std::make_unique<SmoothPointerDataDispatcher>(delegate);
};
}
// |GPUSurfaceVulkanDelegate|
fml::RefPtr<vulkan::VulkanProcTable> ShellTestPlatformViewVulkan::vk() {
return proc_table_;
}
} // namespace testing
} // namespace flutter