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 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_
impeller::PlaygroundImplVK::IsVulkanDriverPresent
static bool IsVulkanDriverPresent()
Definition: playground_impl_vk.cc:216
impeller::PlaygroundImpl
Definition: playground_impl.h:18
vk.h
impeller::PlaygroundImplVK
Definition: playground_impl_vk.h:13
impeller::TSize< int64_t >
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:209
impeller::PlaygroundSwitches
Definition: switches.h:16
impeller::PlaygroundImplVK::~PlaygroundImplVK
~PlaygroundImplVK()
playground_impl.h
impeller
Definition: aiks_blur_unittests.cc:20
impeller::PlaygroundImpl::WindowHandle
void * WindowHandle
Definition: playground_impl.h:25