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 
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_
std::function< void *(void *instance, const char *proc_name)> VKProcAddressResolver
Definition: playground.h:122
fml::Status SetCapabilities(const std::shared_ptr< Capabilities > &capabilities) override
PlaygroundImplVK(PlaygroundSwitches switches)