Skip to content

Commit

Permalink
vkconfig3: Clean up for BETA SDK build
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe-lunarg committed Nov 19, 2024
1 parent 5c17d5f commit 9065544
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 38 deletions.
109 changes: 103 additions & 6 deletions vkconfig_core/configurator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,14 @@ bool Configurator::WriteLayersSettings(OverrideArea override_area, const Path& l
std::vector<LayersSettings> layers_settings_array;

switch (this->executable_scope) {
case EXECUTABLE_ALL:
case EXECUTABLE_ANY: {
LayersSettings settings;
settings.configuration_name = this->selected_global_configuration;
settings.settings_path = layers_settings_path;
layers_settings_array.push_back(settings);
break;
}
case EXECUTABLE_ALL:
case EXECUTABLE_PER: {
const std::vector<Executable>& executables = this->executables.GetExecutables();

Expand All @@ -296,7 +296,7 @@ bool Configurator::WriteLayersSettings(OverrideArea override_area, const Path& l
LayersSettings settings;
settings.executable_path = executables[i].path;
settings.configuration_name = configuration_name;
settings.settings_path = executables[i].GetActiveOptions()->working_folder + "/vk_layer_settings.txt";
settings.settings_path = executables[i].GetLocalLayersSettingsPath();
layers_settings_array.push_back(settings);
}
break;
Expand Down Expand Up @@ -466,7 +466,7 @@ bool Configurator::Surrender(OverrideArea override_area) {
bool result_layers_settings = true;
if (override_area & OVERRIDE_AREA_LAYERS_SETTINGS_BIT) {
bool global_removed = layers_settings_path.Remove();
if (this->executable_scope == EXECUTABLE_ALL) {
if (this->executable_scope == EXECUTABLE_ALL || this->executable_scope == EXECUTABLE_ANY) {
result_layers_settings = global_removed;
}

Expand Down Expand Up @@ -556,6 +556,41 @@ void Configurator::Reset() {
this->selected_global_configuration = "Validation";
}

std::string Configurator::LogConfiguration(const std::string& configuration_key) const {
const Configuration* configuration = this->configurations.FindConfiguration(configuration_key);
assert(configuration != nullptr);

std::string log = format("'%s' Loader Configuration:\n", configuration->key.c_str());

if (configuration->override_layers) {
log += " - Vulkan Layers Selection and Execution Order:\n";
for (std::size_t i = 0, n = configuration->parameters.size(); i < n; ++i) {
const Parameter& parameter = configuration->parameters[i];

if (parameter.builtin == LAYER_BUILTIN_UNORDERED) {
log += format(" * %s: %s\n", parameter.key.c_str(), ::GetToken(parameter.control));
} else {
log += format(" * %s - %s: %s\n", parameter.key.c_str(), parameter.api_version.str().c_str(),
::GetToken(parameter.control));
log += format(" Layer manifest path: %s\n", parameter.manifest.AbsolutePath().c_str());
log += format(" Layer settings export: %s\n", parameter.override_settings ? "enabled" : "disabled");
}
}
} else {
log += " - Vulkan Layers Selection and Execution Order: disabled\n";
}

if (configuration->override_loader) {
log += format(" - Vulkan Loader Messages: %s\n", GetLogString(configuration->loader_log_messages_flags).c_str());
} else {
log += " - Vulkan Loader Messages: disabled\n";
}

log += "\n";

return log;
}

std::string Configurator::Log() const {
std::string log;

Expand All @@ -572,13 +607,75 @@ std::string Configurator::Log() const {
log += "\n";

log += format("%s Settings:\n", VKCONFIG_NAME);
log += format(" - Vulkan Loader configuration scope: %s\n", ::GetLabel(this->GetExecutableScope()));
log += format(" * Vulkan Loader settings file: %s\n", ::Get(Path::LOADER_SETTINGS).AbsolutePath().c_str());

if (this->GetExecutableScope() == EXECUTABLE_ANY || this->GetExecutableScope() == EXECUTABLE_ALL) {
log += format(" * Vulkan Layers settings file: %s\n", ::Get(Path::LAYERS_SETTINGS).AbsolutePath().c_str());
}

if (this->GetExecutableScope() == EXECUTABLE_ANY || this->GetExecutableScope() == EXECUTABLE_ALL) {
const Configuration* configuration = this->GetActiveConfiguration();
if (configuration != nullptr) {
log += format(" - Active Vulkan Loader Configuration: '%s'\n", configuration->key.c_str());
} else {
log += " - No Active Vulkan Loader Configuration\n";
}
}
if (this->GetExecutableScope() == EXECUTABLE_ALL) {
log += " - Listed Executables:\n";
const std::vector<Executable>& executables = this->executables.GetExecutables();
for (std::size_t i = 0, n = executables.size(); i < n; ++i) {
log += format(" * %s: %s\n", executables[i].path.AbsolutePath().c_str(),
executables[i].enabled ? "enabled" : "disabled");
}
}

if (this->GetExecutableScope() == EXECUTABLE_PER) {
log += " - Listed Executables:\n";
const std::vector<Executable>& executables = this->executables.GetExecutables();
for (std::size_t i = 0, n = executables.size(); i < n; ++i) {
const Configuration* configuration = this->configurations.FindConfiguration(executables[i].configuration);

log += format(" * %s: '%s'\n", executables[i].path.AbsolutePath().c_str(),
executables[i].enabled && configuration != nullptr ? executables[i].configuration.c_str() : "None");
if (!executables[i].enabled) {
continue;
}

log += format(" Vulkan Loader settings file: %s\n",
executables[i].GetLocalLayersSettingsPath().AbsolutePath().c_str());
}
}

log += format(" - Use system tray: %s\n", this->use_system_tray ? "true" : "false");
log += format(" - ${VK_HOME}: %s\n", this->home_sdk_path.AbsolutePath().c_str());
log += format(" - Vulkan Loader and Layers system files:\n");
log += format(" * %s\n", ::Get(Path::LOADER_SETTINGS).AbsolutePath().c_str());
log += format(" * %s\n", ::Get(Path::LAYERS_SETTINGS).AbsolutePath().c_str());
log += "\n";

if (this->GetExecutableScope() == EXECUTABLE_ANY || this->GetExecutableScope() == EXECUTABLE_ALL) {
const Configuration* configuration = this->GetActiveConfiguration();

if (configuration != nullptr) {
log += LogConfiguration(configuration->key.c_str());
}
} else if (this->GetExecutableScope() == EXECUTABLE_PER) {
const std::vector<Executable>& executables = this->executables.GetExecutables();

for (std::size_t i = 0, n = executables.size(); i < n; ++i) {
if (!executables[i].enabled) {
continue;
}
if (executables[i].configuration.empty()) {
continue;
}
const Configuration* configuration = this->configurations.FindConfiguration(executables[i].configuration);
if (configuration == nullptr) {
continue;
}
log += LogConfiguration(configuration->key.c_str());
}
}

log += "Vulkan Physical Devices:\n";
for (std::size_t i = 0, n = this->vulkan_system_info.physicalDevices.size(); i < n; ++i) {
const VulkanPhysicalDeviceInfo& info = this->vulkan_system_info.physicalDevices[i];
Expand Down
1 change: 1 addition & 0 deletions vkconfig_core/configurator.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class Configurator : public Serialize {
bool Save(QJsonObject& json_root_object) const override;
void Reset() override;
std::string Log() const override;
std::string LogConfiguration(const std::string& configuration_key) const;

bool Surrender(OverrideArea override_area);
bool Override(OverrideArea override_area);
Expand Down
5 changes: 5 additions & 0 deletions vkconfig_core/executable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ bool Executable::HasActiveOptions() const {
return this->GetActiveOptions() != nullptr;
}

Path Executable::GetLocalLayersSettingsPath() const {
assert(this->GetActiveOptions() != nullptr);
return this->GetActiveOptions()->working_folder + "/vk_layer_settings.txt";
}

void Executable::AddOptions(const ExecutableOptions& options) {
this->options_list.push_back(options);
this->SortOptions();
Expand Down
1 change: 1 addition & 0 deletions vkconfig_core/executable.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct Executable {
ExecutableOptions* GetActiveOptions();
const ExecutableOptions* GetActiveOptions() const;
bool HasActiveOptions() const;
Path GetLocalLayersSettingsPath() const;

void AddOptions(const ExecutableOptions& options);
const std::vector<ExecutableOptions>& GetOptions() const;
Expand Down
8 changes: 4 additions & 4 deletions vkconfig_core/type_executable_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

const char* GetLabel(ExecutableScope scope) {
static const char* TABLE[]{
"No Vulkan Executable", // EXECUTABLE_NONE
"Any Running Vulkan Executable", // EXECUTABLE_ANY
"All Enabled Vulkan Executable", // EXECUTABLE_ALL
"Per Enabled Vulkan Executable", // EXECUTABLE_PER
"No Vulkan Executable", // EXECUTABLE_NONE
"Any Running Vulkan Executable", // EXECUTABLE_ANY
"All Enabled Vulkan Executables", // EXECUTABLE_ALL
"Per Enabled Vulkan Executable", // EXECUTABLE_PER
};

static_assert(std::size(TABLE) == EXECUTABLE_SCOPE_COUNT,
Expand Down
8 changes: 7 additions & 1 deletion vkconfig_core/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ Version::Version(const char *version) : Version(GetVersionData(version)) {}

Version::Version(const std::string &version) : Version(version.c_str()) {}

std::string Version::str() const { return format("%d.%d.%d", _major, _minor, _patch); }
std::string Version::str() const {
if (*this == LATEST) {
return "Latest";
} else {
return format("%d.%d.%d", _major, _minor, _patch);
}
}

bool Version::operator!=(const Version &other_version) const {
return VK_MAKE_VERSION(_major, _minor, _patch) !=
Expand Down
9 changes: 3 additions & 6 deletions vkconfig_gui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@
<a href="https://github.com/LunarG/VulkanTools/tree/vkconfig3-dev" target="_blank">https://github.com/LunarG/VulkanTools/tree/vkconfig3-dev</a>

### TODO:
- Update Vulkan Configurator documentation
- Fix preset label display
- Per application vk_layer_settings.txt is not implemented
- Command line layer settings is not implemented
- Extend setting dependencies with messages is not implemented

### Features:
- UI redesign with per use case tabs
- Improve layers loading and selection:
* Add loading of multiple versions of the same layer
* Add explicit selection of the layer version used by a configuration
* No longer load and unload layer manifest when switching configuations
* Json validation caching based on layer manifest modified date and time
* Add layers manifest reloading
* Per-layer enabling of layer settings
- Improve layers ordering:
* Allow ordering of all (implicit layers, unkown layers) layers executed by Vulkan application
* Allow ordering layers independently from enabling them
Expand All @@ -24,10 +20,11 @@
* Add storing multiple set of options per executable
* Add per-application layers configuration
- Add *Vulkan Loader* logging support:
* Add per-executable *Vulkan Loader* loader configuration
* Add *Vulkan Loader* logging outside of application launcher
* Add *Vulkan Loader* selection of each logging message type
* Add per-application *Vulkan Loader* logging message types
- Split GUI and command line into two separated executables
- Add system diagnostic

### Improvements:
- Almost all Vulkan Configurator data is stored in a `$HOME` directory JSON file
Expand Down
31 changes: 12 additions & 19 deletions vkconfig_gui/tab_configurations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,12 @@ bool TabConfigurations::EventFilter(QObject *target, QEvent *event) {
this->OnContextMenuDuplicateClicked(item);
} else if (action == action_delete) {
this->OnContextMenuDeleteClicked(item);
} else if (action == action_reset) {
this->OnContextMenuResetClicked(item);
} else if (action == action_reload) {
this->OnContextMenuReloadClicked(item);
/*
} else if (action == action_reset) {
this->OnContextMenuResetClicked(item);
} else if (action == action_reload) {
this->OnContextMenuReloadClicked(item);
*/
} else if (action == action_export_config) {
this->OnContextMenuExportConfigsClicked(item);
} else if (action == action_export_settings) {
Expand Down Expand Up @@ -754,31 +756,22 @@ void TabConfigurations::on_configurations_executable_scope_currentIndexChanged(i
configurator.Override(OVERRIDE_AREA_ALL);
break;
}
case EXECUTABLE_PER:
case EXECUTABLE_ALL: {
HideMessageType type =
scope == EXECUTABLE_PER ? HIDE_MESSAGE_NOTIFICATION_EXECUTABLE_PER : HIDE_MESSAGE_NOTIFICATION_EXECUTABLE_ALL;
if (!(configurator.Get(type))) {
case EXECUTABLE_PER: {
if (!(configurator.Get(HIDE_MESSAGE_NOTIFICATION_EXECUTABLE_PER))) {
QMessageBox message;
message.setWindowTitle(format("Selected scope: '%s'", ::GetLabel(scope)).c_str());
message.setText(::GetTooltip(scope));
if (scope == EXECUTABLE_PER) {
message.setInformativeText(
"As the vk_layer_settings.txt file is written in the executable working directory, all the executables "
"with the same working directory will share the same loader configuration.\n\nDo you want to continue?");
} else {
message.setInformativeText(
"If the executable working directory contains a vk_layer_settings.txt file, the file will be "
"overwritten.\n\nDo you want to continue?");
}
message.setInformativeText(
"As the vk_layer_settings.txt file is written in the executable working directory, all the executables "
"with the same working directory will share the same loader configuration.\n\nDo you want to continue?");
message.setIcon(QMessageBox::Information);
message.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
message.setDefaultButton(QMessageBox::Ok);
message.setCheckBox(new QCheckBox("Do not show again."));
int retval = message.exec();

if (message.checkBox()->isChecked()) {
configurator.Set(type);
configurator.Set(HIDE_MESSAGE_NOTIFICATION_EXECUTABLE_PER);
}

if (retval == QMessageBox::Cancel) {
Expand Down
2 changes: 0 additions & 2 deletions vkconfig_gui/tab_diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ TabDiagnostics::TabDiagnostics(MainWindow &window, std::shared_ptr<Ui::MainWindo

Configurator &configurator = Configurator::Get();

this->ui->diagnostic_vk_home_browse->setIcon(QIcon(":/resourcefiles/folder_browse.png"));

this->ui->diagnostic_keep_running->blockSignals(true);
this->ui->diagnostic_keep_running->setChecked(configurator.GetUseSystemTray());
this->ui->diagnostic_keep_running->blockSignals(false);
Expand Down

0 comments on commit 9065544

Please sign in to comment.