-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvulkancapsviewer.h
159 lines (149 loc) · 5.53 KB
/
vulkancapsviewer.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*
*
* Vulkan hardware capability viewer
*
* Copyright (C) 2016-2021 by Sascha Willems (www.saschawillems.de)
*
* This code is free software, you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 3 as published by the Free Software Foundation.
*
* Please review the following information to ensure the GNU Lesser
* General Public License version 3 requirements will be met:
* http://opensource.org/licenses/lgpl-3.0.html
*
* The code is distributed WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU LGPL 3.0 for more details.
*
*/
#ifndef VULKANCAPSVIEWER_H
#define VULKANCAPSVIEWER_H
#include <QtWidgets/QMainWindow>
#include <QStandardItemModel>
#include <QStandardItem>
#include <QMessageBox>
#include <QKeyEvent>
#include <QWindow>
#include <treeproxyfilter.h>
#include "ui_vulkancapsviewer.h"
#include <settings.h>
#include <vector>
#include "vulkanDeviceInfo.h"
#include "vulkanLayerInfo.hpp"
#include "vulkansurfaceinfo.hpp"
#include "vulkandatabase.h"
#include "vulkanandroid.h"
#include "vulkan/vulkan.h"
#if defined(VK_USE_PLATFORM_IOS_MVK)
// This sets the working folder on iOS to the designated shared
// area. Safe to read/write from here.
extern "C" void setWorkingFolderForiOS(void);
#endif
#if defined(VK_USE_PLATFORM_IOS_MVK) || defined(VK_USE_PLATFORM_MACOS_MVK)
// An unseen window for macOS and iOS that has a Metal surface
// attached.
class QVukanSurrogate: public QWindow
{
public:
QVukanSurrogate() {
QWindow((QWindow*)nullptr);
setSurfaceType(QSurface::MetalSurface);
}
};
#endif
enum ReportState { unknown, not_present, is_present, is_updatable };
class VulkanCapsViewer : public QMainWindow
{
Q_OBJECT
public:
static const QString version;
static const QString reportVersion;
ReportState reportState = ReportState::unknown;
std::vector<VulkanDeviceInfo> vulkanGPUs;
std::vector<VulkanLayerInfo> instanceLayers;
std::vector<VkExtensionProperties> instanceExtensions;
bool deviceProperties2Available = false;
VulkanDatabase database;
void checkReportDatabaseState();
VulkanCapsViewer(QWidget *parent = 0);
~VulkanCapsViewer();
void reportToJson(QString submitter, QString comment, QJsonObject& jsonObject);
bool saveReport(QString fileName, QString submitter, QString comment);
int uploadReportNonVisual(int deviceIndex, QString submitter, QString comment);
private:
uint32_t instanceApiVersion;
int selectedDeviceIndex = 0;
VkInstance instance = VK_NULL_HANDLE;
VkSurfaceKHR surface;
#if defined(VK_USE_PLATFORM_IOS_MVK) || defined(VK_USE_PLATFORM_MACOS_MVK)
QVukanSurrogate *pMetalSurrogate = nullptr;
#endif
std::string surfaceExtension;
Ui::vulkanCapsViewerClass ui;
struct {
TreeProxyFilter propertiesCore10;
TreeProxyFilter propertiesCore11;
TreeProxyFilter propertiesCore12;
TreeProxyFilter propertiesExtensions;
TreeProxyFilter featuresCore10;
TreeProxyFilter featuresCore11;
TreeProxyFilter featuresCore12;
TreeProxyFilter featuresExtensions;
TreeProxyFilter formats;
TreeProxyFilter extensions;
} filterProxies;
struct {
QStandardItemModel propertiesCore10;
QStandardItemModel propertiesCore11;
QStandardItemModel propertiesCore12;
QStandardItemModel propertiesExtensions;
QStandardItemModel featuresCore10;
QStandardItemModel featuresCore11;
QStandardItemModel featuresCore12;
QStandardItemModel featuresExtensions;
QStandardItemModel formats;
QStandardItemModel extensions;
} models;
QFont boldFont;
#ifdef ANDROID
ANativeWindow* nativeWindow = nullptr;
#endif
bool initVulkan();
void getGPUinfo(VulkanDeviceInfo *GPU, uint32_t id, VkPhysicalDevice device);
void getGPUs();
void connectFilterAndModel(QStandardItemModel& model, TreeProxyFilter& filter);
void displayDevice(int index);
void displayDeviceProperties(VulkanDeviceInfo *device);
void displayDeviceMemoryProperties(VulkanDeviceInfo *device);
void displayDeviceFeatures(VulkanDeviceInfo *device);
void displayDeviceFormats(VulkanDeviceInfo *device);
void displayDeviceExtensions(VulkanDeviceInfo *device);
void displayDeviceQueues(VulkanDeviceInfo *device);
void displayDeviceSurfaceInfo(VulkanDeviceInfo &device);
void displayOSInfo(VulkanDeviceInfo& device);
void displayInstanceLayers();
void displayInstanceExtensions();
void setReportState(ReportState state);
private Q_SLOTS:
void slotClose();
void slotBrowseDatabase();
void slotDisplayOnlineReport();
void slotAbout();
void slotComboBoxGPUIndexChanged(int index);
void slotSaveReport();
void slotUploadReport();
void slotSettings();
void slotFilterPropertiesCore10(QString text);
void slotFilterPropertiesCore11(QString text);
void slotFilterPropertiesCore12(QString text);
void slotFilterPropertiesExtensions(QString text);
void slotFilterFeatures(QString text);
void slotFilterFeaturesCore11(QString text);
void slotFilterFeaturesCore12(QString text);
void slotFilterFeaturesExtensions(QString text);
void slotFilterExtensions(QString text);
void slotFilterFormats(QString text);
void slotComboTabChanged(int index);
};
#endif // VULKANCAPSVIEWER_H