Flutter Engine
The Flutter Engine
playground_impl_vk.h
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#ifndef FLUTTER_IMPELLER_PLAYGROUND_BACKEND_VULKAN_PLAYGROUND_IMPL_VK_H_
6#define FLUTTER_IMPELLER_PLAYGROUND_BACKEND_VULKAN_PLAYGROUND_IMPL_VK_H_
7
10
11namespace impeller {
12
13class PlaygroundImplVK final : public PlaygroundImpl {
14 public:
15 static bool IsVulkanDriverPresent();
16
17 explicit PlaygroundImplVK(PlaygroundSwitches switches);
18
20
22 const std::shared_ptr<Capabilities>& capabilities) override;
23
24 private:
25 std::shared_ptr<Context> context_;
26
27 // Windows management.
28 static void DestroyWindowHandle(WindowHandle handle);
29 using UniqueHandle = std::unique_ptr<void, decltype(&DestroyWindowHandle)>;
30 UniqueHandle handle_;
31 ISize size_ = {1, 1};
32
33 // A global Vulkan instance which ensures that the Vulkan library will remain
34 // loaded throughout the lifetime of the process.
35 static vk::UniqueInstance global_instance_;
36
37 // |PlaygroundImpl|
38 std::shared_ptr<Context> GetContext() const override;
39
40 // |PlaygroundImpl|
41 WindowHandle GetWindowHandle() const override;
42
43 // |PlaygroundImpl|
44 std::unique_ptr<Surface> AcquireSurfaceFrame(
45 std::shared_ptr<Context> context) override;
46
47 PlaygroundImplVK(const PlaygroundImplVK&) = delete;
48
49 PlaygroundImplVK& operator=(const PlaygroundImplVK&) = delete;
50
51 static void InitGlobalVulkanInstance();
52};
53
54} // namespace impeller
55
56#endif // FLUTTER_IMPELLER_PLAYGROUND_BACKEND_VULKAN_PLAYGROUND_IMPL_VK_H_
fml::Status SetCapabilities(const std::shared_ptr< Capabilities > &capabilities) override
PlaygroundImplVK(PlaygroundSwitches switches)