| Flutter Impeller |

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
8 #include "impeller/playground/playground_impl.h"
9 #include "impeller/renderer/backend/vulkan/vk.h"
10
11 namespace impeller {
12
13 class PlaygroundImplVK final : public PlaygroundImpl {
14 public:
15 static bool IsVulkanDriverPresent();
16
17 explicit PlaygroundImplVK(PlaygroundSwitches switches);
18
19 ~PlaygroundImplVK();
20
21 fml::Status SetCapabilities(
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 VkInstance 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 // |PlaygroundImpl|
48 Playground::VKProcAddressResolver CreateVKProcAddressResolver()
49 const override;
50
51 PlaygroundImplVK(const PlaygroundImplVK&) = delete;
52
53 PlaygroundImplVK& operator=(const PlaygroundImplVK&) = delete;
54
55 static void InitGlobalVulkanInstance();
56 };
57
58 } // namespace impeller
59
60 #endif // FLUTTER_IMPELLER_PLAYGROUND_BACKEND_VULKAN_PLAYGROUND_IMPL_VK_H_
impeller::Playground::VKProcAddressResolver
std::function< void *(void *instance, const char *proc_name)> VKProcAddressResolver
Definition: playground.h:122
impeller::PlaygroundImpl
Definition: playground_impl.h:18
impeller::PlaygroundImpl::WindowHandle
void * WindowHandle
Definition: playground_impl.h:25
impeller::PlaygroundImplVK
Definition: playground_impl_vk.h:13
impeller::PlaygroundImplVK::SetCapabilities
fml::Status SetCapabilities(const std::shared_ptr< Capabilities > &capabilities) override
Definition: playground_impl_vk.cc:217
impeller::PlaygroundImplVK::~PlaygroundImplVK
~PlaygroundImplVK()
impeller::PlaygroundImplVK::IsVulkanDriverPresent
static bool IsVulkanDriverPresent()
Definition: playground_impl_vk.cc:224
impeller::PlaygroundImplVK::PlaygroundImplVK
PlaygroundImplVK(PlaygroundSwitches switches)
Definition: playground_impl_vk.cc:66
impeller
Definition: allocation.cc:12
playground_impl.h
impeller::PlaygroundSwitches
Definition: switches.h:16
impeller::TSize
Definition: size.h:25
vk.h