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