Flutter Engine
The Flutter Engine
vulkan_application.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_VULKAN_VULKAN_APPLICATION_H_
6#define FLUTTER_VULKAN_VULKAN_APPLICATION_H_
7
8#include <memory>
9#include <string>
10#include <vector>
11
12#include "flutter/fml/macros.h"
13#include "flutter/vulkan/procs/vulkan_handle.h"
14#include "vulkan_debug_report.h"
15
16namespace vulkan {
17
18static const size_t kGrCacheMaxByteSize = 512 * (1 << 20);
19
20class VulkanDevice;
21class VulkanProcTable;
22
23/// Applications using Vulkan acquire a VulkanApplication that attempts to
24/// create a VkInstance (with debug reporting optionally enabled).
26 public:
28 const std::string& application_name,
29 std::vector<std::string> enabled_extensions,
30 uint32_t application_version = VK_MAKE_VERSION(1, 0, 0),
31 uint32_t api_version = VK_MAKE_VERSION(1, 0, 0),
32 bool enable_validation_layers = false);
33
35
36 bool IsValid() const;
37
38 uint32_t GetAPIVersion() const;
39
41
43
44 std::unique_ptr<VulkanDevice> AcquireFirstCompatibleLogicalDevice() const;
45
46 private:
47 VulkanProcTable& vk_;
49 uint32_t api_version_;
50 std::unique_ptr<VulkanDebugReport> debug_report_;
51 bool valid_;
52 bool enable_validation_layers_;
53
54 std::vector<VkPhysicalDevice> GetPhysicalDevices() const;
55 std::vector<VkExtensionProperties> GetSupportedInstanceExtensions(
56 const VulkanProcTable& vk) const;
57 bool ExtensionSupported(
58 const std::vector<VkExtensionProperties>& supported_extensions,
59 const std::string& extension_name);
60
61 FML_DISALLOW_COPY_AND_ASSIGN(VulkanApplication);
62};
63
64} // namespace vulkan
65
66#endif // FLUTTER_VULKAN_VULKAN_APPLICATION_H_
const VulkanHandle< VkInstance > & GetInstance() const
std::unique_ptr< VulkanDevice > AcquireFirstCompatibleLogicalDevice() const
VulkanApplication(VulkanProcTable &vk, const std::string &application_name, std::vector< std::string > enabled_extensions, uint32_t application_version=VK_MAKE_VERSION(1, 0, 0), uint32_t api_version=VK_MAKE_VERSION(1, 0, 0), bool enable_validation_layers=false)
vk
Definition: malisc.py:42
static const size_t kGrCacheMaxByteSize
#define VK_MAKE_VERSION(major, minor, patch)
Definition: vulkan_core.h:78