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