forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vulkan_application.h
59 lines (42 loc) · 1.65 KB
/
vulkan_application.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_VULKAN_VULKAN_APPLICATION_H_
#define FLUTTER_VULKAN_VULKAN_APPLICATION_H_
#include <memory>
#include <string>
#include <vector>
#include "flutter/vulkan/vulkan_debug_report.h"
#include "flutter/vulkan/vulkan_handle.h"
#include "lib/fxl/macros.h"
namespace vulkan {
static const int kGrCacheMaxCount = 8192;
static const size_t kGrCacheMaxByteSize = 512 * (1 << 20);
class VulkanDevice;
class VulkanProcTable;
/// Applications using Vulkan acquire a VulkanApplication that attempts to
/// create a VkInstance (with debug reporting optionally enabled).
class VulkanApplication {
public:
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));
~VulkanApplication();
bool IsValid() const;
uint32_t GetAPIVersion() const;
const VulkanHandle<VkInstance>& GetInstance() const;
void ReleaseInstanceOwnership();
std::unique_ptr<VulkanDevice> AcquireFirstCompatibleLogicalDevice() const;
private:
VulkanProcTable& vk;
VulkanHandle<VkInstance> instance_;
uint32_t api_version_;
std::unique_ptr<VulkanDebugReport> debug_report_;
bool valid_;
std::vector<VkPhysicalDevice> GetPhysicalDevices() const;
FXL_DISALLOW_COPY_AND_ASSIGN(VulkanApplication);
};
} // namespace vulkan
#endif // FLUTTER_VULKAN_VULKAN_APPLICATION_H_