Skip to content

Commit 02acf73

Browse files
vkconfig: Load all Vulkan drivers from a path
1 parent 796d193 commit 02acf73

7 files changed

Lines changed: 34 additions & 16 deletions

File tree

vkconfig_core/configurator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,8 +1160,8 @@ bool Configurator::Load() {
11601160
}
11611161
}
11621162

1163-
if (json_object.value("last_driver_path") != QJsonValue::Undefined) {
1164-
this->last_driver_path = json_object.value("last_driver_path").toString().toStdString();
1163+
if (json_object.value("last_driver_dir") != QJsonValue::Undefined) {
1164+
this->last_driver_dir = json_object.value("last_driver_dir").toString().toStdString();
11651165
}
11661166
if (json_object.value("driver_paths") != QJsonValue::Undefined) {
11671167
const QJsonObject& json_object_paths = json_object.value("driver_paths").toObject();
@@ -1349,7 +1349,7 @@ bool Configurator::Save() const {
13491349
}
13501350
json_object.insert("driver_override_list", json_driver_override_list_array);
13511351

1352-
json_object.insert("last_driver_path", this->last_driver_path.RelativePath().c_str());
1352+
json_object.insert("last_driver_dir", this->last_driver_dir.RelativePath().c_str());
13531353
QJsonObject json_object_paths;
13541354
for (auto it = this->driver_paths.begin(); it != this->driver_paths.end(); ++it) {
13551355
QJsonObject json_object_path;

vkconfig_core/configurator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class Configurator {
169169
TabType active_tab = TAB_CONFIGURATIONS;
170170
bool advanced = true;
171171
Path last_path_status = Path(Path::HOME).AbsolutePath() + "/diagnostics";
172-
Path last_driver_path = Path(Path::HOME).AbsolutePath() + "/*.json";
172+
Path last_driver_dir = Path(Path::HOME).AbsolutePath();
173173
Path last_path_launch_log = Path(Path::HOME).AbsolutePath() + "/application_log.txt";
174174
Version online_sdk_version = Version::NONE;
175175
Version latest_sdk_version = Version::NONE;

vkconfig_core/registry.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ std::vector<LayersPathInfo> LoadRegistrySoftwareLayers(const char *path, LayerTy
214214
info.type = type;
215215
info.path = path.IsFile() ? path.AbsoluteDir() : path.AbsolutePath();
216216

217+
if (!path.Exists()) {
218+
continue;
219+
}
220+
217221
if (::Found(result, info.path)) {
218222
continue;
219223
}

vkconfig_gui/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- Add preferences settings to show "Vulkan Executables Scope"
1515
- Add `vkconfig.json` backup when doing a "Reset To Default" #2570
1616
- Add "Discard Ordering and Enabling Layers" default configuration #2596
17+
- Improve Vulkan drivers loading, add all drivers in a part at once
1718

1819
### Fixes:
1920
- Fix command line whitespace decoding #2625

vkconfig_gui/tab_drivers.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void TabDrivers::UpdateUI(UpdateUIMode ui_update_mode) {
135135
this->ui->driver_group_box_paths->blockSignals(false);
136136

137137
this->ui->driver_paths_list->clear();
138-
this->ui->driver_path_lineedit->setText(configurator.last_driver_path.RelativePath().c_str());
138+
this->ui->driver_path_lineedit->setText(configurator.last_driver_dir.RelativePath().c_str());
139139
this->ui->driver_paths_list->blockSignals(true);
140140

141141
for (auto it = configurator.driver_paths.begin(); it != configurator.driver_paths.end(); ++it) {
@@ -252,8 +252,8 @@ void TabDrivers::on_driver_append_pressed() {
252252

253253
if (!selected_path.Exists()) {
254254
QMessageBox alert;
255-
alert.setWindowTitle("Vulkan Driver Manifest file not found");
256-
alert.setText("The path");
255+
alert.setWindowTitle("Vulkan Driver Manifest directory not found");
256+
alert.setText("The directory:");
257257
alert.setInformativeText(selected_path.AbsolutePath().c_str());
258258
alert.setStandardButtons(QMessageBox::Ok);
259259
alert.setDefaultButton(QMessageBox::Ok);
@@ -262,8 +262,12 @@ void TabDrivers::on_driver_append_pressed() {
262262
return;
263263
}
264264

265-
configurator.driver_paths.insert(std::pair(selected_path, true));
266-
configurator.last_driver_path = selected_path;
265+
configurator.last_driver_dir = selected_path;
266+
267+
const std::vector<Path> drivers_paths = ::CollectFilePaths(selected_path);
268+
for (std::size_t i = 0, n = drivers_paths.size(); i < n; ++i) {
269+
configurator.driver_paths.insert(std::pair(drivers_paths[i], true));
270+
}
267271

268272
configurator.UpdateVulkanSystemInfo();
269273

@@ -273,9 +277,10 @@ void TabDrivers::on_driver_append_pressed() {
273277
void TabDrivers::on_driver_browse_pressed() {
274278
Configurator &configurator = Configurator::Get();
275279

276-
const Path &selected_path = QFileDialog::getOpenFileName(this->ui->driver_browse_button, "Adding a Driver Manifests File...",
277-
configurator.last_driver_path.AbsolutePath().c_str(), "*.json")
278-
.toStdString();
280+
const Path &selected_path =
281+
QFileDialog::getExistingDirectory(this->ui->driver_browse_button, "Adding Driver Manifests Directory...",
282+
configurator.last_driver_dir.AbsolutePath().c_str())
283+
.toStdString();
279284

280285
if (selected_path.Empty()) {
281286
return;

vkconfig_gui/tab_layers.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ void TabLayers::UpdateUI_LayersPaths(UpdateUIMode ui_update_mode) {
6464

6565
std::vector<LayersPathInfo> &paths_group = configurator.layers.paths[group_path];
6666
for (std::size_t i = 0, n = paths_group.size(); i < n; ++i) {
67+
const std::string &layer_path = paths_group[i].path.AbsolutePath();
68+
const std::vector<Path> &manifest_paths = CollectFilePaths(layer_path);
69+
/*
70+
if (group_path != LAYERS_PATHS_GUI) {
71+
if (manifest_paths.empty()) {
72+
continue;
73+
}
74+
}
75+
*/
6776
QTreeWidgetItem *item_state = new QTreeWidgetItem;
6877
item_state->setFlags(item_state->flags() | Qt::ItemIsSelectable);
6978
item_state->setSizeHint(0, QSize(0, ITEM_HEIGHT));
@@ -75,9 +84,6 @@ void TabLayers::UpdateUI_LayersPaths(UpdateUIMode ui_update_mode) {
7584
ui->layers_paths_tree->addTopLevelItem(item_state);
7685
ui->layers_paths_tree->setItemWidget(item_state, 0, layer_path_widget);
7786

78-
const std::string &layer_path = paths_group[i].path.AbsolutePath();
79-
const std::vector<Path> &manifest_paths = CollectFilePaths(layer_path);
80-
8187
for (std::size_t manifest_index = 0, manifest_count = manifest_paths.size(); manifest_index < manifest_count;
8288
++manifest_index) {
8389
const Layer *layer = configurator.layers.FindFromManifest(manifest_paths[manifest_index], true);
@@ -97,6 +103,8 @@ void TabLayers::UpdateUI_LayersPaths(UpdateUIMode ui_update_mode) {
97103
label += format(" (%s)", GetToken(layer->status));
98104
}
99105

106+
// label += " - " + layer->manifest_path.AbsolutePath();
107+
100108
QTreeWidgetItem *item = new QTreeWidgetItem;
101109
item->setText(0, label.c_str());
102110
item->setToolTip(0, layer->manifest_path.AbsolutePath().c_str());

vkconfig_gui/tab_preferences.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void TabPreferences::on_theme_mode_changed(int index) {
170170
this->ui->configurations_settings_reset->setIcon(::Get(new_theme_mode, ::ICON_RELOAD));
171171

172172
// Drivers
173-
this->ui->driver_browse_button->setIcon(::Get(new_theme_mode, ::ICON_FILE_SEARCH));
173+
this->ui->driver_browse_button->setIcon(::Get(new_theme_mode, ::ICON_FOLDER_SEARCH));
174174

175175
// Layers
176176
this->ui->layers_browse_button->setIcon(::Get(new_theme_mode, ::ICON_FOLDER_SEARCH));

0 commit comments

Comments
 (0)