diff --git a/vkconfig_core/configurator.cpp b/vkconfig_core/configurator.cpp index e2b92a5b04..01492f8cd9 100644 --- a/vkconfig_core/configurator.cpp +++ b/vkconfig_core/configurator.cpp @@ -271,6 +271,7 @@ bool Configurator::WriteLayersSettings(OverrideArea override_area, const Path& l std::vector layers_settings_array; switch (this->executable_scope) { + case EXECUTABLE_ALL: case EXECUTABLE_ANY: { LayersSettings settings; settings.configuration_name = this->selected_global_configuration; @@ -278,7 +279,6 @@ bool Configurator::WriteLayersSettings(OverrideArea override_area, const Path& l layers_settings_array.push_back(settings); break; } - case EXECUTABLE_ALL: case EXECUTABLE_PER: { const std::vector& executables = this->executables.GetExecutables(); @@ -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; @@ -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; } @@ -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; @@ -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& 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& 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& 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]; diff --git a/vkconfig_core/configurator.h b/vkconfig_core/configurator.h index bdf296bc93..c5e6d6d3fa 100644 --- a/vkconfig_core/configurator.h +++ b/vkconfig_core/configurator.h @@ -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); diff --git a/vkconfig_core/executable.cpp b/vkconfig_core/executable.cpp index f38a7a9dca..b8615fdcee 100644 --- a/vkconfig_core/executable.cpp +++ b/vkconfig_core/executable.cpp @@ -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(); diff --git a/vkconfig_core/executable.h b/vkconfig_core/executable.h index 867e74b2a2..dd99ad66ad 100644 --- a/vkconfig_core/executable.h +++ b/vkconfig_core/executable.h @@ -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& GetOptions() const; diff --git a/vkconfig_core/type_executable_mode.cpp b/vkconfig_core/type_executable_mode.cpp index 9258918c17..8ffb8d9fa2 100644 --- a/vkconfig_core/type_executable_mode.cpp +++ b/vkconfig_core/type_executable_mode.cpp @@ -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, diff --git a/vkconfig_core/version.cpp b/vkconfig_core/version.cpp index 7e34e1a337..6807f004ee 100644 --- a/vkconfig_core/version.cpp +++ b/vkconfig_core/version.cpp @@ -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) != diff --git a/vkconfig_gui/CHANGELOG.md b/vkconfig_gui/CHANGELOG.md index 0fe79c4707..47fb989b94 100644 --- a/vkconfig_gui/CHANGELOG.md +++ b/vkconfig_gui/CHANGELOG.md @@ -2,20 +2,16 @@ https://github.com/LunarG/VulkanTools/tree/vkconfig3-dev ### 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 @@ -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 diff --git a/vkconfig_gui/tab_configurations.cpp b/vkconfig_gui/tab_configurations.cpp index 4bc7338c10..35fcb916fb 100644 --- a/vkconfig_gui/tab_configurations.cpp +++ b/vkconfig_gui/tab_configurations.cpp @@ -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) { @@ -754,23 +756,14 @@ 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); @@ -778,7 +771,7 @@ void TabConfigurations::on_configurations_executable_scope_currentIndexChanged(i int retval = message.exec(); if (message.checkBox()->isChecked()) { - configurator.Set(type); + configurator.Set(HIDE_MESSAGE_NOTIFICATION_EXECUTABLE_PER); } if (retval == QMessageBox::Cancel) { diff --git a/vkconfig_gui/tab_diagnostics.cpp b/vkconfig_gui/tab_diagnostics.cpp index 34cd70dc32..3fa0839cf1 100644 --- a/vkconfig_gui/tab_diagnostics.cpp +++ b/vkconfig_gui/tab_diagnostics.cpp @@ -34,8 +34,6 @@ TabDiagnostics::TabDiagnostics(MainWindow &window, std::shared_ptrui->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);