forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell_test_platform_view_vulkan.h
92 lines (66 loc) · 2.92 KB
/
shell_test_platform_view_vulkan.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// 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.
#ifndef FLUTTER_SHELL_COMMON_SHELL_TEST_PLATFORM_VIEW_VULKAN_H_
#define FLUTTER_SHELL_COMMON_SHELL_TEST_PLATFORM_VIEW_VULKAN_H_
#include "flutter/shell/common/shell_test_external_view_embedder.h"
#include "flutter/shell/common/shell_test_platform_view.h"
#include "flutter/shell/gpu/gpu_surface_vulkan_delegate.h"
#include "flutter/vulkan/vulkan_application.h"
#include "flutter/vulkan/vulkan_device.h"
namespace flutter {
namespace testing {
class ShellTestPlatformViewVulkan : public ShellTestPlatformView {
public:
ShellTestPlatformViewVulkan(PlatformView::Delegate& delegate,
TaskRunners task_runners,
std::shared_ptr<ShellTestVsyncClock> vsync_clock,
CreateVsyncWaiter create_vsync_waiter,
std::shared_ptr<ShellTestExternalViewEmbedder>
shell_test_external_view_embedder);
~ShellTestPlatformViewVulkan() override;
void SimulateVSync() override;
private:
class OffScreenSurface : public flutter::Surface {
public:
OffScreenSurface(fml::RefPtr<vulkan::VulkanProcTable> vk,
std::shared_ptr<ShellTestExternalViewEmbedder>
shell_test_external_view_embedder);
~OffScreenSurface() override;
// |Surface|
bool IsValid() override;
// |Surface|
std::unique_ptr<SurfaceFrame> AcquireFrame(const SkISize& size) override;
SkMatrix GetRootTransformation() const override;
// |Surface|
GrDirectContext* GetContext() override;
private:
bool valid_;
fml::RefPtr<vulkan::VulkanProcTable> vk_;
std::shared_ptr<ShellTestExternalViewEmbedder>
shell_test_external_view_embedder_;
std::unique_ptr<vulkan::VulkanApplication> application_;
std::unique_ptr<vulkan::VulkanDevice> logical_device_;
sk_sp<GrDirectContext> context_;
bool CreateSkiaGrContext();
bool CreateSkiaBackendContext(GrVkBackendContext* context);
FML_DISALLOW_COPY_AND_ASSIGN(OffScreenSurface);
};
CreateVsyncWaiter create_vsync_waiter_;
std::shared_ptr<ShellTestVsyncClock> vsync_clock_;
fml::RefPtr<vulkan::VulkanProcTable> proc_table_;
std::shared_ptr<ShellTestExternalViewEmbedder>
shell_test_external_view_embedder_;
// |PlatformView|
std::unique_ptr<Surface> CreateRenderingSurface() override;
// |PlatformView|
std::shared_ptr<ExternalViewEmbedder> CreateExternalViewEmbedder() override;
// |PlatformView|
std::unique_ptr<VsyncWaiter> CreateVSyncWaiter() override;
// |PlatformView|
PointerDataDispatcherMaker GetDispatcherMaker() override;
FML_DISALLOW_COPY_AND_ASSIGN(ShellTestPlatformViewVulkan);
};
} // namespace testing
} // namespace flutter
#endif // FLUTTER_SHELL_COMMON_SHELL_TEST_PLATFORM_VIEW_VULKAN_H_