forked from ppy/osu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvulkan_bridge.h
More file actions
70 lines (59 loc) · 2.25 KB
/
Copy pathvulkan_bridge.h
File metadata and controls
70 lines (59 loc) · 2.25 KB
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
60
61
62
63
64
65
66
67
68
69
70
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#pragma once
#include <vulkan/vulkan.h>
#include <cstdint>
#include <string>
typedef uint8_t byte;
/// Lightweight Vulkan capability probe for Android.
/// Requires Vulkan 1.3 as minimum for full feature detection (dynamic rendering,
/// synchronization2). Falls back gracefully on older devices.
class VulkanProbe {
public:
struct DeviceInfo {
std::string deviceName;
uint32_t apiVersion = 0;
uint32_t driverVersion = 0;
uint32_t vendorId = 0;
bool supportsSwapchain = false;
uint32_t deviceLocalMemoryMB = 0;
uint32_t queueFamilyCount = 0;
bool hasDedicatedComputeQueue = false;
bool hasDedicatedTransferQueue = false;
bool supportsMailboxPresentMode = false;
bool meetsVulkan13 = false;
bool supportsDynamicRendering = false;
bool supportsSynchronization2 = false;
// Modern High-Performance Extensions
bool supportsPresentId = false;
bool supportsPresentWait = false;
bool supportsGraphicsPipelineLibrary = false;
bool supportsShaderObject = false;
bool supportsGlobalPriority = false;
bool supportsMemoryBudget = false;
bool supportsSurfaceMaintenance1 = false;
// Vulkan 1.4+ / Android 16+ features
bool meetsVulkan14 = false;
bool supportsHostImageCopy = false;
bool supportsPushDescriptors = false;
// Quirks / Blacklist flags
bool disablePresentId = false;
bool disablePresentWait = false;
bool disableGraphicsPipelineLibrary = false;
};
VulkanProbe();
~VulkanProbe();
bool isAvailable() const { return available_; }
const DeviceInfo& getDeviceInfo() const { return deviceInfo_; }
private:
bool available_ = false;
DeviceInfo deviceInfo_{};
VkInstance instance_ = VK_NULL_HANDLE;
bool createInstance();
bool queryDevice();
void queryMemory(VkPhysicalDevice device);
void queryQueueFamilies(VkPhysicalDevice device);
void queryVulkan13Features(VkPhysicalDevice device);
void queryModernExtensions(VkPhysicalDevice device);
void cleanup();
};