From 5293aca8308eb936048f5149ab7c4a883ae5e63f Mon Sep 17 00:00:00 2001 From: Christophe Date: Mon, 2 Mar 2026 18:26:20 +0100 Subject: [PATCH 01/14] vkconfig: Fix command line whitespace decoding --- vkconfig_core/executable_manager.cpp | 6 +- vkconfig_core/test/test_command_line.cpp | 25 +++++++ vkconfig_core/test/test_util.cpp | 90 +++++++++++++++++++++++- vkconfig_core/util.cpp | 29 ++++++++ vkconfig_core/util.h | 4 +- vkconfig_gui/CHANGELOG.md | 5 +- vkconfig_gui/tab_applications.cpp | 2 +- 7 files changed, 156 insertions(+), 5 deletions(-) diff --git a/vkconfig_core/executable_manager.cpp b/vkconfig_core/executable_manager.cpp index c56584bb72..25612e2e4f 100644 --- a/vkconfig_core/executable_manager.cpp +++ b/vkconfig_core/executable_manager.cpp @@ -195,10 +195,14 @@ bool ExecutableManager::Load(const QJsonObject& json_root_object, ConfiguratorMo executable_options.label = json_options_object.value("label").toString().toStdString(); executable_options.working_folder = json_options_object.value("working_folder").toString().toStdString(); + std::vector args; const QJsonArray& json_command_lines_array = json_options_object.value("arguments").toArray(); for (int k = 0, p = json_command_lines_array.size(); k < p; ++k) { - executable_options.args.push_back(json_command_lines_array[k].toString().toStdString()); + args.push_back(json_command_lines_array[k].toString().toStdString()); } + // Workaround to resolved badly stored arguments when we were using SplitSpace instead of SplitArgs to fill the + // executable arguments option in the UI + executable_options.args = SplitArgs(Merge(args, " ")); const QJsonArray& json_environment_variables_array = json_options_object.value("environment_variables").toArray(); for (int k = 0, p = json_environment_variables_array.size(); k < p; ++k) { diff --git a/vkconfig_core/test/test_command_line.cpp b/vkconfig_core/test/test_command_line.cpp index 9757d3035a..10511b5544 100644 --- a/vkconfig_core/test/test_command_line.cpp +++ b/vkconfig_core/test/test_command_line.cpp @@ -876,6 +876,31 @@ TEST(test_command_line, usage_mode_settings_html_default_implicit_and_output) { EXPECT_EQ(HELP_DEFAULT, command_line.help); } +TEST(test_command_line, usage_mode_settings_html_default_implicit_and_output_whitespace) { + static char* argv[] = {(char*)"vkconfig", (char*)"settings", // settings + (char*)"--generate", (char*)"html", // generate + (char*)"--output", (char*)"\"./my directory/my settings.html\""}; + int argc = static_cast(std::size(argv)); + + CommandLine command_line(argc, argv); + + EXPECT_EQ(COMMAND_SETTINGS, command_line.command); + EXPECT_EQ(COMMAND_RESET_SOFT, command_line.command_reset_arg); + EXPECT_EQ(COMMAND_LAYERS_NONE, command_line.command_layers_arg); + EXPECT_EQ(COMMAND_LOADER_NONE, command_line.command_loader_arg); + EXPECT_EQ(COMMAND_DOC_NONE, command_line.command_doc_arg); + EXPECT_EQ(GENERATE_SETTINGS_HTML, command_line.generate_settings_mode); + EXPECT_TRUE(command_line.selected_layers_name.empty()); + EXPECT_STREQ("default", command_line.selected_configuration_name.c_str()); + EXPECT_TRUE(command_line.GetInputPath().Empty()); + EXPECT_STREQ("\"./my directory/my settings.html\"", + ConvertStandardSeparators(command_line.GetOutputPath().RelativePath()).c_str()); + EXPECT_EQ(false, command_line.dry_run); + EXPECT_EQ(ERROR_NONE, command_line.error); + EXPECT_TRUE(command_line.error_args.empty()); + EXPECT_EQ(HELP_DEFAULT, command_line.help); +} + TEST(test_command_line, usage_mode_settings_html_default_explicit_and_output) { static char* argv[] = {(char*)"vkconfig", (char*)"settings", // settings (char*)"--generate", (char*)"html", // generate diff --git a/vkconfig_core/test/test_util.cpp b/vkconfig_core/test/test_util.cpp index 55c179f741..60d18f1934 100644 --- a/vkconfig_core/test/test_util.cpp +++ b/vkconfig_core/test/test_util.cpp @@ -135,7 +135,7 @@ TEST(test_util, trim_surrounding_whitepace) { std::vector strings; strings.push_back("-o profile.json"); strings.push_back(" -o profile.json "); - strings.push_back("\"-o profile.json\""); + strings.push_back("\t-o profile.json\n"); for (std::size_t i = 0, n = strings.size(); i < n; ++i) { std::string trimed_string = TrimSurroundingWhitespace(strings[i]); @@ -144,6 +144,94 @@ TEST(test_util, trim_surrounding_whitepace) { } } +TEST(test_util, split_args_single) { + const std::string source_arg = "--argA"; + const std::vector split_arg = SplitArgs(source_arg); + EXPECT_EQ(1, split_arg.size()); + EXPECT_STREQ("--argA", split_arg[0].c_str()); +} + +TEST(test_util, split_args_single_with_parem) { + const std::string source_arg = "--argA value-A"; + const std::vector split_arg = SplitArgs(source_arg); + EXPECT_EQ(1, split_arg.size()); + EXPECT_STREQ("--argA value-A", split_arg[0].c_str()); +} + +TEST(test_util, split_args_single_no_quote) { + const std::string source_arg = "--argA value A"; + const std::vector split_arg = SplitArgs(source_arg); + EXPECT_EQ(1, split_arg.size()); + EXPECT_STREQ("--argA value A", split_arg[0].c_str()); +} + +TEST(test_util, split_args_multiple_no_quote) { + const std::string source_arg = "--argA value A --argB"; + const std::vector split_arg = SplitArgs(source_arg); + EXPECT_EQ(2, split_arg.size()); + EXPECT_STREQ("--argA value A", split_arg[0].c_str()); + EXPECT_STREQ("--argB", split_arg[1].c_str()); +} + +TEST(test_util, split_args_single_with_quote_with_space) { + const std::string source_arg = "--argA \"value A\""; + const std::vector split_arg = SplitArgs(source_arg); + EXPECT_EQ(1, split_arg.size()); + EXPECT_STREQ("--argA \"value A\"", split_arg[0].c_str()); +} + +TEST(test_util, split_args_single_with_quote_without_space) { + const std::string source_arg = "--argA \"value-A\""; + const std::vector split_arg = SplitArgs(source_arg); + EXPECT_EQ(1, split_arg.size()); + EXPECT_STREQ("--argA \"value-A\"", split_arg[0].c_str()); +} + +TEST(test_util, split_args_single_with_quote_and_extra) { + const std::string source_arg = "--argA \"value-A\" --argB"; + const std::vector split_arg = SplitArgs(source_arg); + EXPECT_EQ(2, split_arg.size()); + EXPECT_STREQ("--argA \"value-A\"", split_arg[0].c_str()); + EXPECT_STREQ("--argB", split_arg[1].c_str()); +} + +TEST(test_util, split_args_single_with_command_quote_without_space) { + const std::string source_arg = "command --argA \"value-A\""; + const std::vector split_arg = SplitArgs(source_arg); + EXPECT_EQ(2, split_arg.size()); + EXPECT_STREQ("command", split_arg[0].c_str()); + EXPECT_STREQ("--argA \"value-A\"", split_arg[1].c_str()); +} + +TEST(test_util, split_args_single_with_command_double_quote_without_space) { + const std::string source_arg = "command area --argA \"value-A\""; + const std::vector split_arg = SplitArgs(source_arg); + EXPECT_EQ(3, split_arg.size()); + EXPECT_STREQ("command", split_arg[0].c_str()); + EXPECT_STREQ("area", split_arg[1].c_str()); + EXPECT_STREQ("--argA \"value-A\"", split_arg[2].c_str()); +} + +TEST(test_util, split_args_multiple) { + const std::string source_arg = "--argA --argB valueB --argC \"value C\" --argD value D"; + const std::vector split_arg = SplitArgs(source_arg); + EXPECT_EQ(4, split_arg.size()); + EXPECT_STREQ("--argA", split_arg[0].c_str()); + EXPECT_STREQ("--argB valueB", split_arg[1].c_str()); + EXPECT_STREQ("--argC \"value C\"", split_arg[2].c_str()); + EXPECT_STREQ("--argD value D", split_arg[3].c_str()); +} + +TEST(test_util, split_args_multiple_mix) { + const std::string source_arg = "cargo run --example solari --features=\"bevy_solari https free_camera\""; + const std::vector split_arg = SplitArgs(source_arg); + EXPECT_EQ(4, split_arg.size()); + EXPECT_STREQ("cargo", split_arg[0].c_str()); + EXPECT_STREQ("run", split_arg[1].c_str()); + EXPECT_STREQ("--example solari", split_arg[2].c_str()); + EXPECT_STREQ("--features=\"bevy_solari https free_camera\"", split_arg[3].c_str()); +} + TEST(test_util, split_arg_default) { const std::string source_arg = "--argA --argB=valueB \"--argC=value C\" --argD=\"value D\""; const std::vector split_arg = SplitSpace(source_arg); diff --git a/vkconfig_core/util.cpp b/vkconfig_core/util.cpp index 1f464d59fd..ae9116bfb5 100644 --- a/vkconfig_core/util.cpp +++ b/vkconfig_core/util.cpp @@ -214,6 +214,35 @@ std::vector SplitSpace(const std::string& parse) { return split_result; } +std::vector SplitArgs(const std::string& value) { + std::vector space_splitted = SplitSpace(value); + + std::vector split_result; + + bool previous_value_had_dash = false; + for (std::size_t i = 0, n = space_splitted.size(); i < n; ++i) { + std::string value = space_splitted[i]; + if (value.empty()) { + continue; + } + + if (split_result.empty()) { + split_result.push_back(value); + previous_value_had_dash = value[0] == '-'; + continue; + } + + if (previous_value_had_dash && value[0] != '-') { + split_result[split_result.size() - 1] += " " + value; + } else { + split_result.push_back(value); + previous_value_had_dash = value[0] == '-'; + } + } + + return split_result; +} + std::string Merge(const std::vector& value, const std::string& delimiter) { std::string result; diff --git a/vkconfig_core/util.h b/vkconfig_core/util.h index 69f69ef068..d7b986a78e 100644 --- a/vkconfig_core/util.h +++ b/vkconfig_core/util.h @@ -65,12 +65,14 @@ bool IsStringFound(const std::vector& list, const std::string& valu std::string TrimString(const std::string& str, const std::string& whitespaces = " \t"); -std::string TrimSurroundingWhitespace(const std::string& str, const std::string& whitespaces = " \"\t\n\r"); +std::string TrimSurroundingWhitespace(const std::string& str, const std::string& whitespaces = " \t\n\r"); std::vector Split(const std::string& value, const std::string& delimiter); std::vector SplitSpace(const std::string& value); +std::vector SplitArgs(const std::string& value); + std::string Merge(const std::vector& value, const std::string& delimiter); std::vector ConvertString(const QStringList& string_list); diff --git a/vkconfig_gui/CHANGELOG.md b/vkconfig_gui/CHANGELOG.md index 954becc862..c6017a1b43 100644 --- a/vkconfig_gui/CHANGELOG.md +++ b/vkconfig_gui/CHANGELOG.md @@ -5,6 +5,9 @@ - Improve generated layer settings C++ library to output to code for `vulkan.hpp` - Clean up generated layer settings C++ library for less friction on use +### Fixes: +- Fix command line whitespace decoding #2625 + ## Vulkan Configurator 3.4.2 - Febuary 2026 [Vulkan SDK 1.4.341.0](https://github.com/LunarG/VulkanTools/tree/vulkan-sdk-1.4.341) @@ -25,7 +28,7 @@ - Add `settings --layers` command lines option to list multiple layer names when generating files - Add Validation and API Dump default configuration for interleaved log in stdout - Add diagnostic log refresh button -- Add layer settings reset to default values button +- Add layer settings reset to default values button #2573 - Improved UI to set an external `vk_layer_settings.txt` file - Improved "View Enabled Layers" and "Configure All Layers" UI - Add buttons to open Vulkan SDK directories in diagnostics tab #2585 diff --git a/vkconfig_gui/tab_applications.cpp b/vkconfig_gui/tab_applications.cpp index dcab608014..72efe225dc 100644 --- a/vkconfig_gui/tab_applications.cpp +++ b/vkconfig_gui/tab_applications.cpp @@ -418,7 +418,7 @@ void TabApplications::on_launch_options_args_textEdited(const QString &text) { Executable *executable = configurator.executables.GetActiveExecutable(); ExecutableOptions *options = executable->GetActiveOptions(); - options->args = SplitSpace(text.toStdString()); + options->args = SplitArgs(text.toStdString()); } void TabApplications::on_launch_options_envs_textEdited(const QString &text) { From 62bbaad306cb883a872db6b1ccc8b5953eb1913f Mon Sep 17 00:00:00 2001 From: Christophe Date: Mon, 9 Mar 2026 18:20:17 +0100 Subject: [PATCH 02/14] vkconfig: Clarify UI for use without layers overriding - Clarify UI to clarify what is overridden by Vulkan Configurator: Layers, Devices, Loader log - Redesign system tray: - Add selecting Vulkan Layers configuration from system tray - Add selecting Vullan physical device from system tray - Add enabling Vulkan Loader log from system tray - Add preferences settings to show "Vulkan Executables Scope" --- vkconfig_core/configurator.cpp | 41 +- vkconfig_core/configurator.h | 2 + .../generate_layers_settings_file.cpp | 2 +- .../VK_LAYER_LUNARG_reference_1_2_1.bat | 2 +- .../VK_LAYER_LUNARG_reference_1_2_1.sh | 2 +- .../VK_LAYER_LUNARG_reference_1_2_1.txt | 2 +- ...LAYER_LUNARG_reference_1_2_1.vulkan_h_code | 2 +- ...YER_LUNARG_reference_1_2_1.vulkan_hpp_code | 2 +- .../test/generated/vk_layer_settings.bat | 2 +- .../test/generated/vk_layer_settings.sh | 2 +- .../test/generated/vk_layer_settings.txt | 2 +- .../generated/vulkan_hpp_layer_settings.code | 2 +- .../test/generated/vulkan_layer_settings.code | 2 +- vkconfig_core/type_executable_mode.cpp | 17 +- vkconfig_core/type_executable_mode.h | 5 +- vkconfig_core/type_tab.cpp | 4 +- vkconfig_core/type_tab.h | 2 +- vkconfig_core/version.cpp | 2 +- vkconfig_gui/CHANGELOG.md | 9 +- vkconfig_gui/mainwindow.cpp | 227 ++-- vkconfig_gui/mainwindow.h | 25 +- vkconfig_gui/mainwindow.ui | 1072 +++++++++-------- vkconfig_gui/tab_configurations.cpp | 28 +- vkconfig_gui/tab_configurations.h | 1 + vkconfig_gui/tab_diagnostics.cpp | 6 +- vkconfig_gui/tab_drivers.cpp | 4 + vkconfig_gui/tab_layers.cpp | 5 +- vkconfig_gui/tab_preferences.cpp | 10 + vkconfig_gui/tab_preferences.h | 1 + vkconfig_gui/widget_setting_flags.cpp | 4 +- 30 files changed, 844 insertions(+), 643 deletions(-) diff --git a/vkconfig_core/configurator.cpp b/vkconfig_core/configurator.cpp index ac3713e0f6..e26418a10c 100644 --- a/vkconfig_core/configurator.cpp +++ b/vkconfig_core/configurator.cpp @@ -442,7 +442,7 @@ bool Configurator::WriteLoaderSettings(OverrideArea override_area, const Path& l break; } default: - case EXECUTABLE_NONE: + assert(0); break; } @@ -1089,14 +1089,17 @@ bool Configurator::Load() { // TAB_CONFIGURATIONS if (json_interface_object.value(GetToken(TAB_CONFIGURATIONS)) != QJsonValue::Undefined) { const QJsonObject& json_object = json_interface_object.value(GetToken(TAB_CONFIGURATIONS)).toObject(); + if (json_object.value("override_layers") != QJsonValue::Undefined) { + this->layers_override_enabled = json_object.value("override_layers").toBool(); + } this->advanced = json_object.value("advanced").toBool(); this->executable_scope = ::GetExecutableScope(json_object.value("executable_scope").toString().toStdString().c_str()); this->selected_global_configuration = json_object.value("selected_global_configuration").toString().toStdString(); } - // TAB_LAYERS - if (json_interface_object.value(GetToken(TAB_LAYERS)) != QJsonValue::Undefined) { - const QJsonObject& json_object = json_interface_object.value(GetToken(TAB_LAYERS)).toObject(); + // TAB_LAYERS_PATHS + if (json_interface_object.value(GetToken(TAB_LAYERS_PATHS)) != QJsonValue::Undefined) { + const QJsonObject& json_object = json_interface_object.value(GetToken(TAB_LAYERS_PATHS)).toObject(); (void)json_object; } @@ -1224,10 +1227,17 @@ bool Configurator::Load() { ::SetHomePath(json_object.value("VULKAN_HOME").toString().toStdString()); } + if (json_object.value("layers_show_scope") != QJsonValue::Undefined) { + this->configuration_show_scope = json_object.value("layers_show_scope").toBool(); + } else { + this->configuration_show_scope = this->executable_scope != EXECUTABLE_ANY; + } + if (json_object.value("all_enabled_executables_behavior") != QJsonValue::Undefined) { this->executable_behavior = ::GetExecutableAllEnabledBehavior( json_object.value("all_enabled_executables_behavior").toString().toStdString().c_str()); } + if (json_object.value("VULKAN_DOWNLOAD") != QJsonValue::Undefined) { ::SetDownloadPath(json_object.value("VULKAN_DOWNLOAD").toString().toStdString()); } @@ -1277,17 +1287,15 @@ bool Configurator::Save() const { // TAB_CONFIGURATIONS { QJsonObject json_object; + json_object.insert("override_layers", this->layers_override_enabled); json_object.insert("advanced", this->advanced); json_object.insert("executable_scope", ::GetToken(this->executable_scope)); json_object.insert("selected_global_configuration", this->selected_global_configuration.c_str()); json_interface_object.insert(::GetToken(TAB_CONFIGURATIONS), json_object); } - // TAB_LAYERS - { - QJsonObject json_object; - json_interface_object.insert(GetToken(TAB_LAYERS), json_object); - } + // TAB_LAYERS_PATHS + {} // TAB_DRIVER { @@ -1368,6 +1376,7 @@ bool Configurator::Save() const { json_object.insert("show_external_layers_settings", this->show_external_layers_settings); json_object.insert("VULKAN_HOME", ::Path(Path::HOME).RelativePath().c_str()); json_object.insert("VULKAN_DOWNLOAD", ::Path(Path::DOWNLOAD).RelativePath().c_str()); + json_object.insert("layers_show_scope", this->configuration_show_scope); json_object.insert("all_enabled_executables_behavior", ::GetToken(this->executable_behavior)); json_interface_object.insert(GetToken(TAB_PREFERENCES), json_object); @@ -1449,9 +1458,13 @@ bool Configurator::ShouldNotify() const { } bool Configurator::HasActiveSettings() const { + if (!this->layers_override_enabled) { + return false; + } + switch (this->executable_scope) { default: - case EXECUTABLE_NONE: + assert(0); return false; case EXECUTABLE_ALL: case EXECUTABLE_PER: @@ -1483,18 +1496,20 @@ bool Configurator::HasActiveSettings() const { } bool Configurator::HasEnabledUI(EnabledUI enabled_ui) const { + if (!this->layers_override_enabled) { + return false; + } + switch (enabled_ui) { default: assert(false); return false; case ENABLE_UI_CONFIG: { switch (this->GetExecutableScope()) { - default: - case EXECUTABLE_NONE: - return false; case EXECUTABLE_ALL: case EXECUTABLE_PER: return this->executables.GetActiveExecutable() != nullptr; + default: case EXECUTABLE_ANY: return true; } diff --git a/vkconfig_core/configurator.h b/vkconfig_core/configurator.h index 6745e5c71a..4a5413f827 100644 --- a/vkconfig_core/configurator.h +++ b/vkconfig_core/configurator.h @@ -177,6 +177,8 @@ class Configurator { Version latest_sdk_version = Version::NONE; Version current_sdk_version = Version::VKHEADER; + bool configuration_show_scope = false; + bool layers_override_enabled = true; bool driver_override_enabled = false; DriverMode driver_override_mode = DRIVER_MODE_SINGLE; DeviceInfo driver_override_info; diff --git a/vkconfig_core/generate_layers_settings_file.cpp b/vkconfig_core/generate_layers_settings_file.cpp index 8f0ad434e4..c43c1524fd 100644 --- a/vkconfig_core/generate_layers_settings_file.cpp +++ b/vkconfig_core/generate_layers_settings_file.cpp @@ -57,7 +57,7 @@ bool GenerateSettingsTXT(Configurator& configurator, OverrideArea override_area, break; } default: - case EXECUTABLE_NONE: + assert(0); break; } diff --git a/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.bat b/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.bat index 70c489ce94..af20db3d03 100644 --- a/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.bat +++ b/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.bat @@ -13,7 +13,7 @@ :: See the License for the specific language governing permissions and :: limitations under the License. :: -:: This code was generated by Vulkan Configurator 3.4.3 +:: This code was generated by Vulkan Configurator 3.5.0 :: reference layer diff --git a/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.sh b/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.sh index 31f1e2eb9e..a724062d59 100644 --- a/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.sh +++ b/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.sh @@ -13,7 +13,7 @@ #! See the License for the specific language governing permissions and #! limitations under the License. #! -#! This code was generated by Vulkan Configurator 3.4.3 +#! This code was generated by Vulkan Configurator 3.5.0 #! reference layer diff --git a/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.txt b/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.txt index 1a0bc53b63..776c4b26d1 100644 --- a/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.txt +++ b/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.txt @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# This code was generated by Vulkan Configurator 3.4.3 +# This code was generated by Vulkan Configurator 3.5.0 # reference layer # ========================================== diff --git a/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.vulkan_h_code b/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.vulkan_h_code index 9a484c8a57..9bb12fc903 100644 --- a/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.vulkan_h_code +++ b/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.vulkan_h_code @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * This code was generated by Vulkan Configurator 3.4.3 + * This code was generated by Vulkan Configurator 3.5.0 */ #pragma once diff --git a/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.vulkan_hpp_code b/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.vulkan_hpp_code index fe9ef76574..f7ef21cc06 100644 --- a/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.vulkan_hpp_code +++ b/vkconfig_core/test/generated/VK_LAYER_LUNARG_reference_1_2_1.vulkan_hpp_code @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * This code was generated by Vulkan Configurator 3.4.3 + * This code was generated by Vulkan Configurator 3.5.0 */ #pragma once diff --git a/vkconfig_core/test/generated/vk_layer_settings.bat b/vkconfig_core/test/generated/vk_layer_settings.bat index 70c489ce94..af20db3d03 100644 --- a/vkconfig_core/test/generated/vk_layer_settings.bat +++ b/vkconfig_core/test/generated/vk_layer_settings.bat @@ -13,7 +13,7 @@ :: See the License for the specific language governing permissions and :: limitations under the License. :: -:: This code was generated by Vulkan Configurator 3.4.3 +:: This code was generated by Vulkan Configurator 3.5.0 :: reference layer diff --git a/vkconfig_core/test/generated/vk_layer_settings.sh b/vkconfig_core/test/generated/vk_layer_settings.sh index 31f1e2eb9e..a724062d59 100644 --- a/vkconfig_core/test/generated/vk_layer_settings.sh +++ b/vkconfig_core/test/generated/vk_layer_settings.sh @@ -13,7 +13,7 @@ #! See the License for the specific language governing permissions and #! limitations under the License. #! -#! This code was generated by Vulkan Configurator 3.4.3 +#! This code was generated by Vulkan Configurator 3.5.0 #! reference layer diff --git a/vkconfig_core/test/generated/vk_layer_settings.txt b/vkconfig_core/test/generated/vk_layer_settings.txt index 1a0bc53b63..776c4b26d1 100644 --- a/vkconfig_core/test/generated/vk_layer_settings.txt +++ b/vkconfig_core/test/generated/vk_layer_settings.txt @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# This code was generated by Vulkan Configurator 3.4.3 +# This code was generated by Vulkan Configurator 3.5.0 # reference layer # ========================================== diff --git a/vkconfig_core/test/generated/vulkan_hpp_layer_settings.code b/vkconfig_core/test/generated/vulkan_hpp_layer_settings.code index fe9ef76574..f7ef21cc06 100644 --- a/vkconfig_core/test/generated/vulkan_hpp_layer_settings.code +++ b/vkconfig_core/test/generated/vulkan_hpp_layer_settings.code @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * This code was generated by Vulkan Configurator 3.4.3 + * This code was generated by Vulkan Configurator 3.5.0 */ #pragma once diff --git a/vkconfig_core/test/generated/vulkan_layer_settings.code b/vkconfig_core/test/generated/vulkan_layer_settings.code index 9a484c8a57..9bb12fc903 100644 --- a/vkconfig_core/test/generated/vulkan_layer_settings.code +++ b/vkconfig_core/test/generated/vulkan_layer_settings.code @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * This code was generated by Vulkan Configurator 3.4.3 + * This code was generated by Vulkan Configurator 3.5.0 */ #pragma once diff --git a/vkconfig_core/type_executable_mode.cpp b/vkconfig_core/type_executable_mode.cpp index 63cfcf2cd5..ed876c9206 100644 --- a/vkconfig_core/type_executable_mode.cpp +++ b/vkconfig_core/type_executable_mode.cpp @@ -25,7 +25,6 @@ const char* GetLabel(ExecutableScope scope) { static const char* TABLE[]{ - "No Vulkan Executable", // EXECUTABLE_NONE "Any Running Vulkan Executable", // EXECUTABLE_ANY "All Enabled Vulkan Executables", // EXECUTABLE_ALL "Per Vulkan Working Directory", // EXECUTABLE_PER @@ -39,10 +38,9 @@ const char* GetLabel(ExecutableScope scope) { const char* GetTooltip(ExecutableScope scope) { static const char* TABLE[]{ - "Vulkan Configurator won't affect the Vulkan layers for any executable running on the system.", // EXECUTABLE_NONE - "Apply the active layers configuration to any executable running.", // EXECUTABLE_ANY - "Apply the active layers configuration to all enabled executables.", // EXECUTABLE_ALL - "Apply a dedicated layers configuration for each Vulkan executable.", // EXECUTABLE_PER + "Apply the active layers configuration to any executable running.", // EXECUTABLE_ANY + "Apply the active layers configuration to all enabled executables.", // EXECUTABLE_ALL + "Apply a dedicated layers configuration for each Vulkan executable.", // EXECUTABLE_PER }; static_assert(std::size(TABLE) == EXECUTABLE_SCOPE_COUNT, @@ -53,10 +51,9 @@ const char* GetTooltip(ExecutableScope scope) { const char* GetToken(ExecutableScope scope) { static const char* TABLE[]{ - "NONE", // EXECUTABLE_NONE - "ANY", // EXECUTABLE_ANY - "ALL", // EXECUTABLE_ALL - "PER", // EXECUTABLE_PER + "ANY", // EXECUTABLE_ANY + "ALL", // EXECUTABLE_ALL + "PER", // EXECUTABLE_PER }; static_assert(std::size(TABLE) == EXECUTABLE_SCOPE_COUNT, @@ -73,7 +70,7 @@ ExecutableScope GetExecutableScope(const char* token) { } } - return EXECUTABLE_NONE; + return EXECUTABLE_ANY; } bool EnabledExecutables(ExecutableScope scope) { return scope == EXECUTABLE_ALL || scope == EXECUTABLE_PER; } diff --git a/vkconfig_core/type_executable_mode.h b/vkconfig_core/type_executable_mode.h index eebe4f89aa..027dd1a03f 100644 --- a/vkconfig_core/type_executable_mode.h +++ b/vkconfig_core/type_executable_mode.h @@ -21,12 +21,11 @@ #pragma once enum ExecutableScope { // Enum value can't be changed - EXECUTABLE_NONE = 0, - EXECUTABLE_ANY, + EXECUTABLE_ANY = 0, EXECUTABLE_ALL, EXECUTABLE_PER, - EXECUTABLE_SCOPE_FIRST = EXECUTABLE_NONE, + EXECUTABLE_SCOPE_FIRST = EXECUTABLE_ANY, EXECUTABLE_SCOPE_LAST = EXECUTABLE_PER }; diff --git a/vkconfig_core/type_tab.cpp b/vkconfig_core/type_tab.cpp index 84913f046b..9667a7cd8f 100644 --- a/vkconfig_core/type_tab.cpp +++ b/vkconfig_core/type_tab.cpp @@ -26,7 +26,7 @@ const char* GetLabel(TabType type) { static const char* TOKENS[]{ "Vulkan Layers", // TAB_CONFIGURATIONS - "Vulkan Layers Paths", // TAB_LAYERS + "Vulkan Layers Paths", // TAB_LAYERS_PATHS "Vulkan Drivers", // TAB_DRIVERS "Application Launcher", // TAB_APPLICATIONS "Diagnostics", // TAB_DIAGNOSTIC @@ -43,7 +43,7 @@ const char* GetLabel(TabType type) { const char* GetToken(TabType type) { static const char* TOKENS[]{ "CONFIGURATIONS", // TAB_CONFIGURATIONS - "LAYERS", // TAB_LAYERS + "LAYERS", // TAB_LAYERS_PATHS "DRIVERS", // TAB_DRIVERS "APPLICATIONS", // TAB_APPLICATIONS "DIAGNOSTIC", // TAB_DIAGNOSTIC diff --git a/vkconfig_core/type_tab.h b/vkconfig_core/type_tab.h index 5384844df5..abfcfc177e 100644 --- a/vkconfig_core/type_tab.h +++ b/vkconfig_core/type_tab.h @@ -22,7 +22,7 @@ enum TabType { TAB_CONFIGURATIONS = 0, - TAB_LAYERS, + TAB_LAYERS_PATHS, TAB_DRIVERS, TAB_APPLICATIONS, TAB_DIAGNOSTIC, diff --git a/vkconfig_core/version.cpp b/vkconfig_core/version.cpp index f72ed2a375..4b825b1d6e 100644 --- a/vkconfig_core/version.cpp +++ b/vkconfig_core/version.cpp @@ -28,7 +28,7 @@ #include #include -const Version Version::VKCONFIG(3, 4, 3); +const Version Version::VKCONFIG(3, 5, 0); const Version Version::VKHEADER(VK_HEADER_VERSION_COMPLETE); const Version Version::NONE(0, 0, 0); const Version Version::LATEST(~0, ~0, ~0); diff --git a/vkconfig_gui/CHANGELOG.md b/vkconfig_gui/CHANGELOG.md index c6017a1b43..8b2bf94cbb 100644 --- a/vkconfig_gui/CHANGELOG.md +++ b/vkconfig_gui/CHANGELOG.md @@ -1,9 +1,16 @@ -## Vulkan Configurator 3.4.3 - May 2026 +## Vulkan Configurator 3.5.0 - May 2026 [Vulkan SDK 1.4.3XX.0](https://github.com/LunarG/VulkanTools/tree/main) +### Features: +- Add selecting Vulkan Layers configuration from system tray +- Add selecting Vullan physical device from system tray +- Add enabling Vulkan Loader log from system tray + ### Improvements: +- Clarify UI to clarify what is overridden by Vulkan Configurator: Layers, Devices, Loader log - Improve generated layer settings C++ library to output to code for `vulkan.hpp` - Clean up generated layer settings C++ library for less friction on use +- Add preferences settings to show "Vulkan Executables Scope" ### Fixes: - Fix command line whitespace decoding #2625 diff --git a/vkconfig_gui/mainwindow.cpp b/vkconfig_gui/mainwindow.cpp index 78b691870b..106e164ab0 100644 --- a/vkconfig_gui/mainwindow.cpp +++ b/vkconfig_gui/mainwindow.cpp @@ -20,6 +20,7 @@ */ #include "mainwindow.h" +#include "style.h" #include "../vkconfig_core/configurator.h" #include "../vkconfig_core/util.h" @@ -40,23 +41,17 @@ #include #include #include +#include #include MainWindow::MainWindow(QApplication &app, QWidget *parent) - : QMainWindow(parent), - _tray_icon(nullptr), - _tray_icon_menu(nullptr), - _tray_restore_action(nullptr), - _tray_layers{nullptr, nullptr, nullptr, nullptr}, - _tray_quit_action(nullptr), - app(app), - ui(new Ui::MainWindow) { + : QMainWindow(parent), _tray_icon(nullptr), app(app), ui(new Ui::MainWindow) { ui->setupUi(this); this->tabs[TAB_DIAGNOSTIC].reset(new TabDiagnostics(*this, ui)); this->tabs[TAB_APPLICATIONS].reset(new TabApplications(*this, ui)); - this->tabs[TAB_LAYERS].reset(new TabLayers(*this, ui)); + this->tabs[TAB_LAYERS_PATHS].reset(new TabLayers(*this, ui)); this->tabs[TAB_CONFIGURATIONS].reset(new TabConfigurations(*this, ui)); this->tabs[TAB_DOCUMENTATION].reset(new TabDocumentation(*this, ui)); this->tabs[TAB_DRIVERS].reset(new TabDrivers(*this, ui)); @@ -78,7 +73,6 @@ MainWindow::MainWindow(QApplication &app, QWidget *parent) this->ui->tab_widget->setCurrentIndex(configurator.active_tab); - this->InitTray(); this->UpdateUI(UPDATE_REBUILD_UI); configurator.Override(OVERRIDE_AREA_ALL); @@ -103,66 +97,135 @@ void MainWindow::UpdateUI(UpdateUIMode mode) { this->UpdateUI_Status(); } -void MainWindow::InitTray() { +void MainWindow::UpdateUI_Status() { + const Configurator &configurator = Configurator::Get(); + + this->setWindowTitle(GetMainWindowTitle().c_str()); + if (QSystemTrayIcon::isSystemTrayAvailable()) { - this->_tray_quit_action = new QAction("&Quit", this); - this->connect(this->_tray_quit_action, &QAction::triggered, qApp, &QCoreApplication::quit); - this->_tray_restore_action = new QAction("Open &Vulkan Configurator", this); - this->connect(this->_tray_restore_action, &QAction::triggered, this, &MainWindow::trayActionRestore); - - this->_tray_icon_menu = new QMenu(this); - this->_tray_icon_menu->addAction(this->_tray_restore_action); - this->_tray_icon_menu->addSeparator(); - for (int i = 0, n = EXECUTABLE_SCOPE_COUNT; i < n; ++i) { - this->_tray_layers[i] = new QAction(::GetLabel(static_cast(i)), this); - this->_tray_layers[i]->setCheckable(true); - this->_tray_icon_menu->addAction(this->_tray_layers[i]); + const Configurator &configurator = Configurator::Get(); + + QMenu *menu = new QMenu(this); + + { + QAction *tray_restore_action = new QAction("&Show Vulkan Configurator UI", this); + tray_restore_action->setIcon(QIcon(":/resourcefiles/vkconfig-on.png")); + this->connect(tray_restore_action, &QAction::triggered, this, &MainWindow::OnTrayActionShow); + menu->addAction(tray_restore_action); + + QAction *tray_quit_action = new QAction("&Quit Vulkan Configurator", this); + tray_quit_action->setIcon(::Get(configurator.current_theme_mode, ::ICON_EXIT)); + this->connect(tray_quit_action, &QAction::triggered, qApp, &QCoreApplication::quit); + menu->addAction(tray_quit_action); } - this->connect(this->_tray_layers[EXECUTABLE_NONE], &QAction::toggled, this, &MainWindow::on_tray_none); - this->connect(this->_tray_layers[EXECUTABLE_ANY], &QAction::toggled, this, &MainWindow::on_tray_any); - this->connect(this->_tray_layers[EXECUTABLE_ALL], &QAction::toggled, this, &MainWindow::on_tray_all); - this->connect(this->_tray_layers[EXECUTABLE_PER], &QAction::toggled, this, &MainWindow::on_tray_per); + { + menu->addSeparator(); - this->_tray_icon_menu->addSeparator(); - this->_tray_icon_menu->addAction(this->_tray_quit_action); - this->_tray_icon = new QSystemTrayIcon(this); - this->_tray_icon->setContextMenu(this->_tray_icon_menu); - this->_tray_icon->show(); - this->connect(this->_tray_icon, &QSystemTrayIcon::activated, this, &MainWindow::iconActivated); - } -} + const bool enabled_layers = configurator.layers_override_enabled && configurator.GetExecutableScope() != EXECUTABLE_PER; -void MainWindow::UpdateUI_Status() { - const Configurator &configurator = Configurator::Get(); + QAction *tray_override_layers = new QAction("Override System Vulkan &Layers Configurations:", this); + tray_override_layers->setCheckable(true); + tray_override_layers->setChecked(enabled_layers); - this->setWindowTitle(GetMainWindowTitle().c_str()); - if (QSystemTrayIcon::isSystemTrayAvailable()) { - for (int i = 0, n = EXECUTABLE_SCOPE_COUNT; i < n; ++i) { - this->_tray_layers[i]->blockSignals(true); - this->_tray_layers[i]->setChecked(configurator.GetExecutableScope() == i); - this->_tray_layers[i]->blockSignals(false); + this->connect(tray_override_layers, &QAction::toggled, this, &MainWindow::OnTrayActionOverrideLayers); + menu->addAction(tray_override_layers); + + QComboBox *widget = new QComboBox(menu); + int current_index = 0; + + for (std::size_t i = 0, n = configurator.configurations.available_configurations.size(); i < n; ++i) { + const Configuration &configuration = configurator.configurations.available_configurations[i]; + + widget->addItem(configuration.key.c_str()); + + if (configuration.key == configurator.GetSelectedGlobalConfiguration()) { + current_index = static_cast(i); + } + } + + widget->setCurrentIndex(current_index); + this->connect(widget, SIGNAL(currentIndexChanged(int)), this, SLOT(OnLayersChanged(int))); + + QWidgetAction *action = new QWidgetAction(menu); + action->setDefaultWidget(widget); + action->setEnabled(enabled_layers); + menu->addAction(action); } + + { + menu->addSeparator(); + + const bool enabled_physical_devices = + configurator.driver_override_enabled && configurator.driver_override_mode == DRIVER_MODE_SINGLE; + + QAction *tray_override_device = new QAction("Override System Vulkan &Physcial Devices:", this); + tray_override_device->setCheckable(true); + tray_override_device->setChecked(enabled_physical_devices); + + this->connect(tray_override_device, &QAction::toggled, this, &MainWindow::OnTrayActionOverrideDevice); + menu->addAction(tray_override_device); + + QComboBox *widget = new QComboBox(menu); + int current_index = 0; + + for (std::size_t i = 0, n = configurator.vulkan_system_info.physicalDevices.size(); i < n; ++i) { + const VulkanPhysicalDeviceInfo &info = configurator.vulkan_system_info.physicalDevices[i]; + const DeviceInfo &device_info = ::GetDeviceInfo(info); + + widget->addItem(format("%s (%s)", info.GetLabel().c_str(), info.GetVersion().c_str()).c_str()); + + if (device_info == configurator.driver_override_info) { + current_index = static_cast(i); + } + } + + widget->setCurrentIndex(current_index); + this->connect(widget, SIGNAL(currentIndexChanged(int)), this, SLOT(OnDeviceChanged(int))); + + QWidgetAction *action = new QWidgetAction(menu); + action->setDefaultWidget(widget); + action->setEnabled(enabled_physical_devices); + menu->addAction(action); + } + + { + menu->addSeparator(); + + QAction *tray_override_loader_log = new QAction("Override System Vulkan Loader Log", this); + tray_override_loader_log->setCheckable(true); + tray_override_loader_log->setChecked(configurator.loader_log_enabled); + + this->connect(tray_override_loader_log, &QAction::toggled, this, &MainWindow::OnTrayActionOverrideLog); + menu->addAction(tray_override_loader_log); + } + + if (this->_tray_icon != nullptr) { + delete this->_tray_icon; + } + + this->_tray_icon = new QSystemTrayIcon(this); + this->_tray_icon->setContextMenu(menu); + this->_tray_icon->show(); + this->connect(this->_tray_icon, &QSystemTrayIcon::activated, this, &MainWindow::OnIconActivated); } - if (configurator.GetExecutableScope() != EXECUTABLE_NONE) { + if (configurator.layers_override_enabled || configurator.driver_override_enabled) { const QIcon icon(":/resourcefiles/vkconfig-on.png"); this->setWindowIcon(icon); - if (QSystemTrayIcon::isSystemTrayAvailable()) { + if (this->_tray_icon && QSystemTrayIcon::isSystemTrayAvailable()) { this->_tray_icon->setIcon(icon); - this->_tray_icon->setToolTip("Layers controlled by the Vulkan Configurator"); } } else { const QIcon icon(":/resourcefiles/vkconfig-off.png"); this->setWindowIcon(icon); - if (QSystemTrayIcon::isSystemTrayAvailable()) { + if (this->_tray_icon && QSystemTrayIcon::isSystemTrayAvailable()) { this->_tray_icon->setIcon(icon); - this->_tray_icon->setToolTip("Layers controlled by the Vulkan Applications"); } } } -void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason) { +void MainWindow::OnIconActivated(QSystemTrayIcon::ActivationReason reason) { switch (reason) { default: break; @@ -182,50 +245,56 @@ void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason) { } } -void MainWindow::trayActionRestore() { +void MainWindow::OnTrayActionShow() { this->hide(); this->showNormal(); this->UpdateUI(UPDATE_REBUILD_UI); } -void MainWindow::on_tray_none(bool checked) { - if (checked) { - Configurator &configurator = Configurator::Get(); - configurator.SetExecutableScope(EXECUTABLE_NONE); - configurator.Override(OVERRIDE_AREA_ALL); +void MainWindow::OnTrayActionOverrideLayers(bool toggled) { + Configurator &configurator = Configurator::Get(); + configurator.layers_override_enabled = toggled; + configurator.Override(OVERRIDE_AREA_ALL); - this->UpdateUI(UPDATE_REBUILD_UI); - } + this->tabs[TAB_CONFIGURATIONS]->UpdateUI(UPDATE_REBUILD_UI); + this->UpdateUI(UPDATE_REBUILD_UI); } -void MainWindow::on_tray_any(bool checked) { - if (checked) { - Configurator &configurator = Configurator::Get(); - configurator.SetExecutableScope(EXECUTABLE_ANY); - configurator.Override(OVERRIDE_AREA_ALL); +void MainWindow::OnLayersChanged(int index) { + Configurator &configurator = Configurator::Get(); + configurator.SetActiveConfigurationName(configurator.configurations.available_configurations[index].key); + configurator.Override(OVERRIDE_AREA_ALL); - this->UpdateUI(UPDATE_REBUILD_UI); - } + this->tabs[TAB_CONFIGURATIONS]->UpdateUI(UPDATE_REBUILD_UI); + this->UpdateUI(UPDATE_REBUILD_UI); } -void MainWindow::on_tray_all(bool checked) { - if (checked) { - Configurator &configurator = Configurator::Get(); - configurator.SetExecutableScope(EXECUTABLE_ALL); - configurator.Override(OVERRIDE_AREA_ALL); +void MainWindow::OnTrayActionOverrideDevice(bool toggled) { + Configurator &configurator = Configurator::Get(); + configurator.driver_override_mode = DRIVER_MODE_SINGLE; + configurator.driver_override_enabled = toggled; + configurator.Override(OVERRIDE_AREA_LOADER_SETTINGS_BIT); - this->UpdateUI(UPDATE_REBUILD_UI); - } + this->tabs[TAB_DRIVERS]->UpdateUI(UPDATE_REBUILD_UI); + this->UpdateUI(UPDATE_REBUILD_UI); } -void MainWindow::on_tray_per(bool checked) { - if (checked) { - Configurator &configurator = Configurator::Get(); - configurator.SetExecutableScope(EXECUTABLE_PER); - configurator.Override(OVERRIDE_AREA_ALL); +void MainWindow::OnDeviceChanged(int index) { + Configurator &configurator = Configurator::Get(); + configurator.driver_override_info = ::GetDeviceInfo(configurator.vulkan_system_info.physicalDevices[index]); + configurator.Override(OVERRIDE_AREA_LOADER_SETTINGS_BIT); - this->UpdateUI(UPDATE_REBUILD_UI); - } + this->tabs[TAB_DRIVERS]->UpdateUI(UPDATE_REBUILD_UI); + this->UpdateUI(UPDATE_REBUILD_UI); +} + +void MainWindow::OnTrayActionOverrideLog(bool toggled) { + Configurator &configurator = Configurator::Get(); + configurator.loader_log_enabled = toggled; + configurator.Override(OVERRIDE_AREA_LOADER_SETTINGS_BIT); + + this->tabs[TAB_DIAGNOSTIC]->UpdateUI(UPDATE_REBUILD_UI); + this->UpdateUI(UPDATE_REBUILD_UI); } /// The only thing we need to do here is clear the configuration if @@ -241,7 +310,7 @@ void MainWindow::closeEvent(QCloseEvent *event) { if (!(configurator.Get(HIDE_MESSAGE_USE_SYSTEM_TRAY))) { std::string shut_down_state; - if (configurator.GetExecutableScope() != EXECUTABLE_NONE) { + if (configurator.layers_override_enabled) { shut_down_state = "Vulkan Layers override will remain in effect while Vulkan Configurator remain active in the system tray."; } else { diff --git a/vkconfig_gui/mainwindow.h b/vkconfig_gui/mainwindow.h index 5bca6d87c9..2c08ede66c 100644 --- a/vkconfig_gui/mainwindow.h +++ b/vkconfig_gui/mainwindow.h @@ -39,7 +39,7 @@ #include #include -#include +#include class MainWindow : public QMainWindow { Q_OBJECT @@ -57,33 +57,26 @@ class MainWindow : public QMainWindow { void changeEvent(QEvent *event) override; QSystemTrayIcon *_tray_icon = nullptr; - QMenu *_tray_icon_menu = nullptr; - QAction *_tray_restore_action = nullptr; - std::array _tray_layers; - QAction *_tray_quit_action = nullptr; - - private slots: - void trayActionRestore(); - void on_tray_none(bool checked); - void on_tray_any(bool checked); - void on_tray_all(bool checked); - void on_tray_per(bool checked); - - void iconActivated(QSystemTrayIcon::ActivationReason reason); public Q_SLOTS: void commitDataRequest(QSessionManager &manager); void on_tab_widget_currentChanged(int index); + void OnIconActivated(QSystemTrayIcon::ActivationReason reason); + void OnTrayActionShow(); + void OnTrayActionOverrideLayers(bool toggled); + void OnTrayActionOverrideDevice(bool toggled); + void OnTrayActionOverrideLog(bool toggled); + void OnLayersChanged(int index); + void OnDeviceChanged(int index); + void UpdateUI_Status(); private: MainWindow(const MainWindow &) = delete; MainWindow &operator=(const MainWindow &) = delete; - void InitTray(); - public: QApplication &app; diff --git a/vkconfig_gui/mainwindow.ui b/vkconfig_gui/mainwindow.ui index 6d343c0eec..c87d06814e 100644 --- a/vkconfig_gui/mainwindow.ui +++ b/vkconfig_gui/mainwindow.ui @@ -91,7 +91,7 @@ QTabWidget::Rounded - 7 + 4 @@ -120,9 +120,22 @@ 0 - + + + + Arial + 10 + true + + + + Control the Vulkan Layers used by running Vulkan applications + - + Override System Vulkan Layers + + + true @@ -208,7 +221,10 @@ - Vulkan Layers Configuration Scope: + Vulkan Executables Scope: + + + false @@ -914,9 +930,22 @@ 5 - + + + + Arial + 10 + true + + - + System Vulkan Layers Paths + + + false + + + false @@ -953,6 +982,13 @@ 24 + + + Arial + 10 + false + + Check to validate the layer manifests wheen adding a user path. This may take some time... @@ -981,6 +1017,13 @@ 24 + + + Arial + 10 + false + + 24 @@ -1009,6 +1052,13 @@ 24 + + + Arial + 10 + false + + Enter a Vulkan layers directory to control them in Vulkan Configurator @@ -1034,6 +1084,13 @@ 24 + + + Arial + 10 + false + + Append a user-defined layers path @@ -1068,6 +1125,13 @@ 24 + + + Arial + 10 + false + + Reload all modified layer manifest @@ -1092,6 +1156,13 @@ 0 + + + Arial + 10 + false + + QFrame::NoFrame @@ -1160,8 +1231,11 @@ true + + Control Vulkan Physical Device used by all running Vulkan applications + - Override Vulkan Devices to all Vulkan applications: + Override System Vulkan Devices true @@ -2538,61 +2612,78 @@ 5 - - - - Arial - 10 - true - - - - false - - - Diagnostic Logs + + + 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 + + + + true + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + Arial + 10 + true + + + + Produce Vulkan Loader Log to all running Vulkan applications + + + Override System Vulkan Loader Log + + + true + + + false + + + + 11 0 + + 0 + 0 - - - - 24 - 24 - + + + + Arial + 10 + false + - - - 24 - 24 - + + Log Errors preventing the correct execution of the Vulkan Loader + + + Errors + + + + Arial @@ -2600,38 +2691,33 @@ false - - Open Vulkan Caps Viewer + + Log Warnings which may result in unexpected behavior of the Vulkan Loader - - - - - :/resourcefiles/vulkancapsviewer.png:/resourcefiles/vulkancapsviewer.png + Warnings - - - - 0 - 0 - + + + + Arial + 10 + false + - - - 24 - 24 - + + Log Information relative to the expected Vulkan Loader execution - - - 24 - 24 - + + Information + + + + Arial @@ -2639,28 +2725,30 @@ false - - Export all diagnostic logs + + Log Verbose Information relative to the expected Vulkan Loader execution - + Debug - - - - 0 - 24 - + + + + Arial + 10 + false + - - - 16777215 - 24 - + + Additional Areas: + + + + Arial @@ -2668,65 +2756,16 @@ false - - QComboBox::AdjustToContents + + Enable a log area relative to the Vulkan Layers handling by the Vulkan Loader + + + Layers - - - Vulkan Development Status - - - - - VulkanInfo Summary - - - - - VulkanInfo Full Text - - - - - Vulkan Profile - - - - - Vulkan Loader Log - - - - - Vulkan Loader Configuration - - - - - Vulkan Layers Settings - - - - - Vulkan Loader Settings - - - - - - 0 - 24 - - - - - 16777215 - 24 - - + Arial @@ -2734,25 +2773,72 @@ false - - QComboBox::AdjustToContents + + Enable a log area relative to the Vulkan Drivers handling by the Vulkan Loader + + + Drivers - - - - 24 - 24 - + + + Qt::Horizontal - + - 24 - 24 + 40 + 20 + + + + + + + + + + 0 + 0 + + + + + Arial + 10 + true + + + + Vulkan SDK directories + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + Arial @@ -2761,12 +2847,12 @@ - + Open: - + 24 @@ -2787,7 +2873,7 @@ - Export the selected diagnostic log + Open Vulkan SDK installation directory @@ -2795,16 +2881,16 @@ - + - 0 + 24 24 - 16777215 + 24 24 @@ -2815,16 +2901,16 @@ false + + Open Vulkan SDK home directory + + + + - - - - 0 - 0 - - + 24 @@ -2837,22 +2923,70 @@ 24 + + + Arial + 10 + false + + - Clear the search text + Open Vulkan SDK system directory + + + + + + + + + + Arial + 10 + true + + + + false + + + Diagnostic Logs + + + + 10 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + 0 + + + 0 + - - - - 0 - 0 - - + 24 @@ -2865,16 +2999,27 @@ 24 + + + Arial + 10 + false + + - Find Next (F3) + Open Vulkan Caps Viewer + + + :/resourcefiles/vulkancapsviewer.png:/resourcefiles/vulkancapsviewer.png + - + 0 @@ -2893,8 +3038,15 @@ 24 + + + Arial + 10 + false + + - Find Previous (Shift+F3) + Export all diagnostic logs @@ -2902,75 +3054,99 @@ - - - - 0 - 0 - - + - 24 + 0 24 - 24 + 16777215 24 - - Match case (Alt+C) + + + Arial + 10 + false + - - - - - true + + QComboBox::AdjustToContents + + + Vulkan Development Status + + + + + VulkanInfo Summary + + + + + VulkanInfo Full Text + + + + + Vulkan Profile + + + + + Vulkan Loader Log + + + + + Vulkan Loader Configuration + + + + + Vulkan Layers Settings + + + + + Vulkan Loader Settings + + - - - - 0 - 0 - - + - 24 + 0 24 - 24 + 16777215 24 - - Match whole word (Alt+W) - - - + + + Arial + 10 + false + - - true + + QComboBox::AdjustToContents - - - - 0 - 0 - - + 24 @@ -2983,104 +3159,6 @@ 24 - - Use Regular Expressions (Alt+R) - - - - - - true - - - - - - - - - - Consolas - 10 - false - - - - QFrame::NoFrame - - - 0 - - - Qt::ScrollBarAlwaysOn - - - QAbstractScrollArea::AdjustToContents - - - true - - - 10.000000000000000 - - - - - - - - - - 0 - - - - - true - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - Arial - 10 - true - - - - Enable Vulkan Loader Log to all Vulkan applications - - - true - - - false - - - - 11 - - - 0 - - - 0 - - - 0 - - - Arial @@ -3088,33 +3166,25 @@ false - - Log Errors preventing the correct execution of the Vulkan Loader - - Errors + - - - - Arial - 10 - false - - - - Log Warnings which may result in unexpected behavior of the Vulkan Loader + + + + 24 + 24 + - - Warnings + + + 24 + 24 + - - - - Arial @@ -3122,33 +3192,28 @@ false - - Log Information relative to the expected Vulkan Loader execution + + Export the selected diagnostic log - Information + - - - - Arial - 10 - false - - - - Log Verbose Information relative to the expected Vulkan Loader execution + + + + 0 + 24 + - - Debug + + + 16777215 + 24 + - - - - Arial @@ -3156,117 +3221,100 @@ false - - Additional Areas: - - - - - Arial - 10 - false - - - - Enable a log area relative to the Vulkan Layers handling by the Vulkan Loader - - - Layers + + + + 0 + 0 + - - - - - - - Arial - 10 - false - + + + 24 + 24 + - - Enable a log area relative to the Vulkan Drivers handling by the Vulkan Loader + + + 24 + 24 + + + + Clear the search text - Drivers + - - - Qt::Horizontal + + + + 0 + 0 + - + - 40 - 20 + 24 + 24 - + + + 24 + 24 + + + + Find Next (F3) + + + + + - - - - - - - - 0 - 0 - - - - - Arial - 10 - true - - - - Vulkan SDK directories - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - + - + 0 0 - - - Arial - 10 - false - + + + 24 + 24 + + + + + 24 + 24 + + + + Find Previous (Shift+F3) - Open: + - + + + + 0 + 0 + + 24 @@ -3279,23 +3327,25 @@ 24 - - - Arial - 10 - false - - - Open Vulkan SDK installation directory + Match case (Alt+C) + + true + - + + + + 0 + 0 + + 24 @@ -3308,23 +3358,25 @@ 24 - - - Arial - 10 - false - - - Open Vulkan SDK home directory + Match whole word (Alt+W) + + true + - + + + + 0 + 0 + + 24 @@ -3337,25 +3389,50 @@ 24 - - - Arial - 10 - false - - - Open Vulkan SDK system directory + Use Regular Expressions (Alt+R) + + true + - - - + + + + + + Consolas + 10 + false + + + + QFrame::NoFrame + + + 0 + + + Qt::ScrollBarAlwaysOn + + + QAbstractScrollArea::AdjustToContents + + + true + + + 10.000000000000000 + + + + + @@ -3662,11 +3739,41 @@ + + + + + Arial + 10 + false + + + + Allows overriding Vulkan Layers only for selected Vulkan executable + + + Show "Vulkan Executables Scope" in Vulkan Layers tab + + + + + 0 + + + 0 + 0 + + + + + + + @@ -3720,37 +3827,6 @@ - - - - - - - - Arial - 10 - true - - - - Vulkan Configurator UI: - - - - 0 - - - 5 - - - 5 - - - 5 - - - 5 - @@ -4009,7 +4085,7 @@ - + diff --git a/vkconfig_gui/tab_configurations.cpp b/vkconfig_gui/tab_configurations.cpp index 63b177e4f8..d4eb1fe027 100644 --- a/vkconfig_gui/tab_configurations.cpp +++ b/vkconfig_gui/tab_configurations.cpp @@ -81,6 +81,9 @@ TabConfigurations::TabConfigurations(MainWindow &window, std::shared_ptrui->configurations_layers_list->installEventFilter(&window); this->ui->configurations_settings->installEventFilter(&window); + this->connect(this->ui->configurations_group_box_override, SIGNAL(toggled(bool)), this, + SLOT(on_configurations_override_toggled(bool))); + this->connect(this->ui->configurations_executable_scope, SIGNAL(currentIndexChanged(int)), this, SLOT(on_configurations_executable_scope_currentIndexChanged(int))); this->connect(this->ui->configurations_executable_list, SIGNAL(currentIndexChanged(int)), this, @@ -117,6 +120,11 @@ TabConfigurations::TabConfigurations(MainWindow &window, std::shared_ptrui->configurations_group_box_scope->blockSignals(true); + this->ui->configurations_group_box_scope->setVisible(configurator.configuration_show_scope || + configurator.GetExecutableScope() != EXECUTABLE_ANY); + this->ui->configurations_group_box_scope->blockSignals(true); + this->ui->configurations_executable_scope->blockSignals(true); this->ui->configurations_executable_scope->clear(); for (int i = 0, n = EXECUTABLE_SCOPE_COUNT; i < n; ++i) { @@ -347,6 +355,11 @@ void TabConfigurations::UpdateUI(UpdateUIMode ui_update_mode) { this->advanced_mode->setToolTip("Configure all Available Vulkan Layers"); } + this->ui->configurations_group_box_scope->blockSignals(true); + this->ui->configurations_group_box_scope->setVisible(configurator.configuration_show_scope); + this->ui->configurations_group_box_scope->setChecked(configurator.layers_override_enabled); + this->ui->configurations_group_box_scope->blockSignals(true); + this->ui->configurations_executable_scope->setToolTip(::GetTooltip(scope)); this->ui->configurations_executable_list->setEnabled(enabled_executable); this->ui->configurations_executable_append->setEnabled(enabled_executable); @@ -360,6 +373,8 @@ void TabConfigurations::UpdateUI(UpdateUIMode ui_update_mode) { this->ui->configurations_group_box_list->setChecked(executable->enabled); } this->ui->configurations_group_box_list->blockSignals(false); + + this->window.UpdateUI_Status(); } void TabConfigurations::CleanUI() { this->_settings_tree_manager.CleanupGUI(); } @@ -402,7 +417,7 @@ bool TabConfigurations::EventFilter(QObject *target, QEvent *event) { return true; } - if (configurator.GetExecutableScope() == EXECUTABLE_NONE || !ui->configurations_list->isEnabled()) { + if (!configurator.layers_override_enabled || !ui->configurations_list->isEnabled()) { return true; } else if (target == this->ui->configurations_list) { QContextMenuEvent *right_click = dynamic_cast(event); @@ -1096,6 +1111,14 @@ void TabConfigurations::on_configurations_advanced_toggle_pressed() { this->UpdateUI(UPDATE_REBUILD_UI); } +void TabConfigurations::on_configurations_override_toggled(bool checked) { + Configurator &configurator = Configurator::Get(); + configurator.layers_override_enabled = checked; + configurator.Override(OVERRIDE_AREA_LOADER_SETTINGS_BIT); + + this->UpdateUI(UPDATE_REBUILD_UI); +} + void TabConfigurations::on_configurations_executable_scope_currentIndexChanged(int index) { Configurator &configurator = Configurator::Get(); @@ -1136,7 +1159,6 @@ void TabConfigurations::on_configurations_executable_scope_currentIndexChanged(i } this->UpdateUI(UPDATE_REFRESH_UI); - this->window.UpdateUI_Status(); } void TabConfigurations::on_configurations_executable_list_currentIndexChanged(int index) { @@ -1305,7 +1327,7 @@ void TabConfigurations::on_configurations_list_currentRowChanged(int currentRow) alert.setText(text.c_str()); alert.setIcon(QMessageBox::Warning); alert.setCheckBox(new QCheckBox("Do not show again.")); - alert.setInformativeText(format("Use the '%s' tab to add the missing layers.", GetLabel(TAB_LAYERS)).c_str()); + alert.setInformativeText(format("Use the '%s' tab to add the missing layers.", GetLabel(TAB_LAYERS_PATHS)).c_str()); alert.exec(); if (alert.checkBox()->isChecked()) { diff --git a/vkconfig_gui/tab_configurations.h b/vkconfig_gui/tab_configurations.h index 296aa6c615..9af22ad6ca 100644 --- a/vkconfig_gui/tab_configurations.h +++ b/vkconfig_gui/tab_configurations.h @@ -50,6 +50,7 @@ class TabConfigurations : public Tab { public Q_SLOTS: void on_configurations_advanced_toggle_pressed(); + void on_configurations_override_toggled(bool checked); void on_configurations_executable_scope_currentIndexChanged(int index); void on_configurations_executable_list_currentIndexChanged(int index); void on_configurations_executable_append_pressed(); diff --git a/vkconfig_gui/tab_diagnostics.cpp b/vkconfig_gui/tab_diagnostics.cpp index 9be6d65cd6..332824299d 100644 --- a/vkconfig_gui/tab_diagnostics.cpp +++ b/vkconfig_gui/tab_diagnostics.cpp @@ -168,7 +168,8 @@ std::string TabDiagnostics::BuildStatus(DiagnosticMode selected_mode, std::size_ this->log_path = working_directory.AbsolutePath() + "/" + filename; } - configurator.SetExecutableScope(selected_mode == DIAGNOSTIC_VULKAN_PROFILE ? EXECUTABLE_NONE : EXECUTABLE_ANY); + // configurator.SetExecutableScope(selected_mode == DIAGNOSTIC_VULKAN_PROFILE ? EXECUTABLE_NONE : EXECUTABLE_ANY); + configurator.layers_override_enabled = selected_mode != DIAGNOSTIC_VULKAN_PROFILE; configurator.Override(OVERRIDE_AREA_ALL); this->process->setArguments(args); @@ -291,7 +292,8 @@ void TabDiagnostics::UpdateUI(UpdateUIMode mode) { this->ui->diagnostic_group_box_loader_log->blockSignals(true); this->ui->diagnostic_group_box_loader_log->setChecked(configurator.loader_log_enabled); this->ui->diagnostic_group_box_loader_log->blockSignals(false); - // this->UpdateStatus(); + + this->window.UpdateUI_Status(); } void TabDiagnostics::CleanUI() {} diff --git a/vkconfig_gui/tab_drivers.cpp b/vkconfig_gui/tab_drivers.cpp index 0a39cc5789..e4b01ce1ed 100644 --- a/vkconfig_gui/tab_drivers.cpp +++ b/vkconfig_gui/tab_drivers.cpp @@ -143,6 +143,8 @@ void TabDrivers::UpdateUI(UpdateUIMode ui_update_mode) { this->ui->driver_paths_list->blockSignals(false); } break; } + + this->window.UpdateUI_Status(); } void TabDrivers::CleanUI() {} @@ -185,6 +187,8 @@ void TabDrivers::on_driver_override_toggled(bool checked) { configurator.driver_override_info = ::GetDeviceInfo(configurator.vulkan_system_info.physicalDevices[this->ui->driver_forced_name->currentIndex()]); configurator.Override(OVERRIDE_AREA_LOADER_SETTINGS_BIT); + + this->UpdateUI(UPDATE_REBUILD_UI); } void TabDrivers::on_driver_mode_changed(int index) { diff --git a/vkconfig_gui/tab_layers.cpp b/vkconfig_gui/tab_layers.cpp index 50e0f0f749..f30cc9d253 100644 --- a/vkconfig_gui/tab_layers.cpp +++ b/vkconfig_gui/tab_layers.cpp @@ -32,7 +32,7 @@ #include #include -TabLayers::TabLayers(MainWindow &window, std::shared_ptr ui) : Tab(TAB_LAYERS, window, ui) { +TabLayers::TabLayers(MainWindow &window, std::shared_ptr ui) : Tab(TAB_LAYERS_PATHS, window, ui) { Configurator &configurator = Configurator::Get(); this->ui->layers_progress->setValue(0); @@ -125,8 +125,11 @@ void TabLayers::UpdateUI_LayersPaths(UpdateUIMode ui_update_mode) { } void TabLayers::UpdateUI(UpdateUIMode ui_update_mode) { + const Configurator &configurator = Configurator::Get(); + this->ui->layers_progress->resetFormat(); this->ui->layers_progress->setValue(0); + this->UpdateUI_LayersPaths(ui_update_mode); } diff --git a/vkconfig_gui/tab_preferences.cpp b/vkconfig_gui/tab_preferences.cpp index ce0d534140..a4fb5d44eb 100644 --- a/vkconfig_gui/tab_preferences.cpp +++ b/vkconfig_gui/tab_preferences.cpp @@ -40,6 +40,8 @@ TabPreferences::TabPreferences(MainWindow &window, std::shared_ptrconnect(this->ui->preferences_keep_running, SIGNAL(toggled(bool)), this, SLOT(on_keep_running_toggled(bool))); this->connect(this->ui->preferences_vk_home_text, SIGNAL(returnPressed()), this, SLOT(on_vk_home_text_pressed())); this->connect(this->ui->preferences_vk_home_browse, SIGNAL(clicked()), this, SLOT(on_vk_home_browse_pressed())); + this->connect(this->ui->preferences_show_executable_scope, SIGNAL(toggled(bool)), this, + SLOT(on_show_executables_scope_toggled(bool))); this->connect(this->ui->preferences_all_enabled_executables, SIGNAL(currentIndexChanged(int)), this, SLOT(on_all_enabled_executables_changed(int))); this->connect(this->ui->preferences_vk_download_browse, SIGNAL(clicked()), this, SLOT(on_vk_download_browse_pressed())); @@ -119,6 +121,7 @@ void TabPreferences::UpdateUI(UpdateUIMode mode) { this->ui->preferences_vk_home_text->blockSignals(false); this->ui->preferences_all_enabled_executables->blockSignals(true); + this->ui->preferences_all_enabled_executables->setEnabled(configurator.configuration_show_scope); this->ui->preferences_all_enabled_executables->setCurrentIndex( static_cast(configurator.GetAllEnabledExecutableBehavior())); this->ui->preferences_all_enabled_executables->blockSignals(false); @@ -142,6 +145,13 @@ bool TabPreferences::EventFilter(QObject *target, QEvent *event) { return false; } +void TabPreferences::on_show_executables_scope_toggled(bool checked) { + Configurator &configurator = Configurator::Get(); + configurator.configuration_show_scope = checked; + + this->UpdateUI(UPDATE_REFRESH_UI); +} + void TabPreferences::on_all_enabled_executables_changed(int index) { Configurator &configurator = Configurator::Get(); diff --git a/vkconfig_gui/tab_preferences.h b/vkconfig_gui/tab_preferences.h index fa83e0c8dd..62431c434a 100644 --- a/vkconfig_gui/tab_preferences.h +++ b/vkconfig_gui/tab_preferences.h @@ -40,6 +40,7 @@ class TabPreferences : public Tab { void on_keep_running_toggled(bool checked); void on_vk_home_text_pressed(); void on_vk_home_browse_pressed(); + void on_show_executables_scope_toggled(bool checked); void on_all_enabled_executables_changed(int index); void on_vk_download_browse_pressed(); void on_vk_download_open_pressed(); diff --git a/vkconfig_gui/widget_setting_flags.cpp b/vkconfig_gui/widget_setting_flags.cpp index 497e9f0074..573fbe798e 100644 --- a/vkconfig_gui/widget_setting_flags.cpp +++ b/vkconfig_gui/widget_setting_flags.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 2a03e807b85321da236abaa5023aa58e089b4128 Mon Sep 17 00:00:00 2001 From: Christophe Date: Tue, 17 Mar 2026 21:51:21 +0100 Subject: [PATCH 03/14] vkconfig: Add Vulkan Drivers override mode for no physical device --- vkconfig_core/application_singleton.cpp | 4 ++-- vkconfig_core/configurator.cpp | 15 +++++++++++++++ vkconfig_core/json.cpp | 4 ++-- vkconfig_core/json_validator.cpp | 4 ++-- vkconfig_core/registry.h | 4 ++-- vkconfig_core/setting_float.h | 4 ++-- vkconfig_core/setting_frames.cpp | 4 ++-- vkconfig_core/setting_frames.h | 4 ++-- vkconfig_core/setting_group.cpp | 4 ++-- vkconfig_core/setting_group.h | 4 ++-- vkconfig_core/setting_int.cpp | 4 ++-- vkconfig_core/setting_int.h | 4 ++-- vkconfig_core/setting_list.h | 4 ++-- vkconfig_core/test/test_date.cpp | 4 ++-- vkconfig_core/test/test_json.cpp | 4 ++-- vkconfig_core/test/test_setting.cpp | 7 +++---- vkconfig_core/test/test_setting_type_bool.cpp | 4 ++-- .../test/test_setting_type_bool_numeric.cpp | 4 ++-- vkconfig_core/test/test_setting_type_enum.cpp | 4 ++-- .../test/test_setting_type_file_load.cpp | 4 ++-- .../test/test_setting_type_file_save.cpp | 4 ++-- vkconfig_core/test/test_setting_type_flags.cpp | 4 ++-- vkconfig_core/test/test_setting_type_float.cpp | 4 ++-- .../test/test_setting_type_folder_save.cpp | 4 ++-- vkconfig_core/test/test_setting_type_frames.cpp | 4 ++-- vkconfig_core/test/test_setting_type_group.cpp | 4 ++-- vkconfig_core/test/test_setting_type_int.cpp | 4 ++-- vkconfig_core/test/test_setting_type_list.cpp | 4 ++-- vkconfig_core/test/test_setting_type_string.cpp | 4 ++-- vkconfig_core/type_driver_mode.cpp | 1 + vkconfig_core/type_driver_mode.h | 3 ++- vkconfig_gui/CHANGELOG.md | 1 + vkconfig_gui/combo_box.h | 4 ++-- vkconfig_gui/mainwindow.ui | 13 +++++++++---- vkconfig_gui/tab_drivers.cpp | 12 +++++++++++- vkconfig_gui/widget_setting.cpp | 4 ++-- vkconfig_gui/widget_setting_bool.cpp | 4 ++-- vkconfig_gui/widget_setting_bool.h | 4 ++-- vkconfig_gui/widget_setting_flags.h | 4 ++-- vkconfig_gui/widget_setting_float.h | 4 ++-- vkconfig_gui/widget_setting_frames.h | 4 ++-- vkconfig_gui/widget_setting_int.h | 4 ++-- vkconfig_gui/widget_setting_list.cpp | 4 ++-- vkconfig_gui/widget_setting_list.h | 4 ++-- vkconfig_gui/widget_setting_list_element.cpp | 4 ++-- vkconfig_gui/widget_setting_list_element.h | 4 ++-- vkconfig_gui/widget_setting_string.cpp | 4 ++-- vkconfig_gui/widget_setting_string.h | 4 ++-- 48 files changed, 124 insertions(+), 92 deletions(-) diff --git a/vkconfig_core/application_singleton.cpp b/vkconfig_core/application_singleton.cpp index fe6c51d84d..befe4694f1 100644 --- a/vkconfig_core/application_singleton.cpp +++ b/vkconfig_core/application_singleton.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/configurator.cpp b/vkconfig_core/configurator.cpp index e26418a10c..1492a167e5 100644 --- a/vkconfig_core/configurator.cpp +++ b/vkconfig_core/configurator.cpp @@ -244,6 +244,14 @@ QJsonObject Configurator::CreateJsonSettingObject(const Configurator::LoaderSett } json_settings.insert("device_configurations", json_devices); } break; + case DRIVER_MODE_NONE: { + QJsonArray json_devices; + json_settings.insert("device_configurations", json_devices); + } break; + default: { + assert(0); + break; + } } } @@ -316,6 +324,13 @@ QJsonObject Configurator::CreateJsonGlobalObject() const { } json_settings.insert("device_configurations", json_devices); } break; + case DRIVER_MODE_NONE: { + QJsonArray json_devices; + json_settings.insert("device_configurations", json_devices); + } break; + default: { + assert(0); + } } } diff --git a/vkconfig_core/json.cpp b/vkconfig_core/json.cpp index 93b0cc6c2f..044079cf93 100644 --- a/vkconfig_core/json.cpp +++ b/vkconfig_core/json.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/json_validator.cpp b/vkconfig_core/json_validator.cpp index 43b34f1c71..791debdbd1 100644 --- a/vkconfig_core/json_validator.cpp +++ b/vkconfig_core/json_validator.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/registry.h b/vkconfig_core/registry.h index 2fd52d9740..735dd836f4 100644 --- a/vkconfig_core/registry.h +++ b/vkconfig_core/registry.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/setting_float.h b/vkconfig_core/setting_float.h index 28121c9709..8a98d2bd4f 100644 --- a/vkconfig_core/setting_float.h +++ b/vkconfig_core/setting_float.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/setting_frames.cpp b/vkconfig_core/setting_frames.cpp index 2d8cbd53ae..fa85c87854 100644 --- a/vkconfig_core/setting_frames.cpp +++ b/vkconfig_core/setting_frames.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/setting_frames.h b/vkconfig_core/setting_frames.h index 78dda22fdf..4c6bc2ed02 100644 --- a/vkconfig_core/setting_frames.h +++ b/vkconfig_core/setting_frames.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/setting_group.cpp b/vkconfig_core/setting_group.cpp index cd2f96aa41..af312d29e3 100644 --- a/vkconfig_core/setting_group.cpp +++ b/vkconfig_core/setting_group.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/setting_group.h b/vkconfig_core/setting_group.h index 2282189418..bf23d8b461 100644 --- a/vkconfig_core/setting_group.h +++ b/vkconfig_core/setting_group.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/setting_int.cpp b/vkconfig_core/setting_int.cpp index d0ffae06fd..8ba1dd75fb 100644 --- a/vkconfig_core/setting_int.cpp +++ b/vkconfig_core/setting_int.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/setting_int.h b/vkconfig_core/setting_int.h index f504baab28..e1f1b7f798 100644 --- a/vkconfig_core/setting_int.h +++ b/vkconfig_core/setting_int.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/setting_list.h b/vkconfig_core/setting_list.h index 7d563229ca..564c558d3d 100644 --- a/vkconfig_core/setting_list.h +++ b/vkconfig_core/setting_list.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_date.cpp b/vkconfig_core/test/test_date.cpp index 36d8e4b901..6d65e46291 100644 --- a/vkconfig_core/test/test_date.cpp +++ b/vkconfig_core/test/test_date.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_json.cpp b/vkconfig_core/test/test_json.cpp index f95ebb5ee3..56d6750285 100644 --- a/vkconfig_core/test/test_json.cpp +++ b/vkconfig_core/test/test_json.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_setting.cpp b/vkconfig_core/test/test_setting.cpp index 4af1c111d2..0cb451d0d6 100644 --- a/vkconfig_core/test/test_setting.cpp +++ b/vkconfig_core/test/test_setting.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,11 +24,10 @@ TEST(test_setting, is_enum_true) { EXPECT_EQ(true, IsEnum(SETTING_ENUM)); } -TEST(test_setting, is_flags_true) { EXPECT_EQ(true, IsFlags(SETTING_FLAGS)); } +TEST(test_setting, is_flags_true) { EXPECT_EQ(true, IsFlags(SETTING_FLAGS)); } TEST(test_setting, is_enum_false) { EXPECT_EQ(false, IsEnum(SETTING_STRING)); } TEST(test_setting, get_setting_token) { EXPECT_STREQ("STRING", GetToken(SETTING_STRING)); } TEST(test_setting, get_setting_type) { EXPECT_EQ(SETTING_STRING, GetSettingType("STRING")); } - diff --git a/vkconfig_core/test/test_setting_type_bool.cpp b/vkconfig_core/test/test_setting_type_bool.cpp index c063b74504..7f1b57e0b1 100644 --- a/vkconfig_core/test/test_setting_type_bool.cpp +++ b/vkconfig_core/test/test_setting_type_bool.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_setting_type_bool_numeric.cpp b/vkconfig_core/test/test_setting_type_bool_numeric.cpp index 477da3c816..7cf93408f0 100644 --- a/vkconfig_core/test/test_setting_type_bool_numeric.cpp +++ b/vkconfig_core/test/test_setting_type_bool_numeric.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_setting_type_enum.cpp b/vkconfig_core/test/test_setting_type_enum.cpp index 280a8dbd3e..196a0cdb83 100644 --- a/vkconfig_core/test/test_setting_type_enum.cpp +++ b/vkconfig_core/test/test_setting_type_enum.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_setting_type_file_load.cpp b/vkconfig_core/test/test_setting_type_file_load.cpp index 1a3c0f2df4..b393fd860c 100644 --- a/vkconfig_core/test/test_setting_type_file_load.cpp +++ b/vkconfig_core/test/test_setting_type_file_load.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_setting_type_file_save.cpp b/vkconfig_core/test/test_setting_type_file_save.cpp index a472bd0bb4..61085ddd74 100644 --- a/vkconfig_core/test/test_setting_type_file_save.cpp +++ b/vkconfig_core/test/test_setting_type_file_save.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_setting_type_flags.cpp b/vkconfig_core/test/test_setting_type_flags.cpp index da5c8d803d..275853a8c1 100644 --- a/vkconfig_core/test/test_setting_type_flags.cpp +++ b/vkconfig_core/test/test_setting_type_flags.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_setting_type_float.cpp b/vkconfig_core/test/test_setting_type_float.cpp index 39ab01ab49..c778629edb 100644 --- a/vkconfig_core/test/test_setting_type_float.cpp +++ b/vkconfig_core/test/test_setting_type_float.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_setting_type_folder_save.cpp b/vkconfig_core/test/test_setting_type_folder_save.cpp index d8a3030ec1..a5af8d6d50 100644 --- a/vkconfig_core/test/test_setting_type_folder_save.cpp +++ b/vkconfig_core/test/test_setting_type_folder_save.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_setting_type_frames.cpp b/vkconfig_core/test/test_setting_type_frames.cpp index 11e2a90265..37a8a35944 100644 --- a/vkconfig_core/test/test_setting_type_frames.cpp +++ b/vkconfig_core/test/test_setting_type_frames.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_setting_type_group.cpp b/vkconfig_core/test/test_setting_type_group.cpp index ca5ec56e20..d7f19c1d4b 100644 --- a/vkconfig_core/test/test_setting_type_group.cpp +++ b/vkconfig_core/test/test_setting_type_group.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_setting_type_int.cpp b/vkconfig_core/test/test_setting_type_int.cpp index 806c1f4f7a..82ef462f2b 100644 --- a/vkconfig_core/test/test_setting_type_int.cpp +++ b/vkconfig_core/test/test_setting_type_int.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_setting_type_list.cpp b/vkconfig_core/test/test_setting_type_list.cpp index 2087db2149..8b19304f86 100644 --- a/vkconfig_core/test/test_setting_type_list.cpp +++ b/vkconfig_core/test/test_setting_type_list.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/test/test_setting_type_string.cpp b/vkconfig_core/test/test_setting_type_string.cpp index 225c0b58ec..b30eba3162 100644 --- a/vkconfig_core/test/test_setting_type_string.cpp +++ b/vkconfig_core/test/test_setting_type_string.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_core/type_driver_mode.cpp b/vkconfig_core/type_driver_mode.cpp index d6f858c249..03c7827d52 100644 --- a/vkconfig_core/type_driver_mode.cpp +++ b/vkconfig_core/type_driver_mode.cpp @@ -27,6 +27,7 @@ const char* GetToken(DriverMode mode) { static const char* TOKENS[] = { "Single", // DRIVER_MODE_SINGLE "Sorted", // DRIVER_MODE_SORTED + "None", // DRIVER_MODE_NONE }; static_assert(std::size(TOKENS) == DRIVER_MODE_COUNT); diff --git a/vkconfig_core/type_driver_mode.h b/vkconfig_core/type_driver_mode.h index 8149930dd1..af5294875c 100644 --- a/vkconfig_core/type_driver_mode.h +++ b/vkconfig_core/type_driver_mode.h @@ -23,9 +23,10 @@ enum DriverMode { DRIVER_MODE_SINGLE = 0, DRIVER_MODE_SORTED, + DRIVER_MODE_NONE, DRIVER_MODE_FIRST = DRIVER_MODE_SINGLE, - DRIVER_MODE_LAST = DRIVER_MODE_SORTED + DRIVER_MODE_LAST = DRIVER_MODE_NONE }; enum { DRIVER_MODE_COUNT = DRIVER_MODE_LAST - DRIVER_MODE_FIRST + 1 }; diff --git a/vkconfig_gui/CHANGELOG.md b/vkconfig_gui/CHANGELOG.md index 8b2bf94cbb..75cb1c0abf 100644 --- a/vkconfig_gui/CHANGELOG.md +++ b/vkconfig_gui/CHANGELOG.md @@ -5,6 +5,7 @@ - Add selecting Vulkan Layers configuration from system tray - Add selecting Vullan physical device from system tray - Add enabling Vulkan Loader log from system tray +- Add Vulkan Drivers override mode for no physical device ### Improvements: - Clarify UI to clarify what is overridden by Vulkan Configurator: Layers, Devices, Loader log diff --git a/vkconfig_gui/combo_box.h b/vkconfig_gui/combo_box.h index 828ae3d671..0b2550f9df 100644 --- a/vkconfig_gui/combo_box.h +++ b/vkconfig_gui/combo_box.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_gui/mainwindow.ui b/vkconfig_gui/mainwindow.ui index c87d06814e..734d35eff6 100644 --- a/vkconfig_gui/mainwindow.ui +++ b/vkconfig_gui/mainwindow.ui @@ -91,7 +91,7 @@ QTabWidget::Rounded - 4 + 0 @@ -132,7 +132,7 @@ Control the Vulkan Layers used by running Vulkan applications - Override System Vulkan Layers + Configure System Vulkan Layers true @@ -1235,7 +1235,7 @@ Control Vulkan Physical Device used by all running Vulkan applications - Override System Vulkan Devices + Configure System Vulkan Devices true @@ -1326,6 +1326,11 @@ Order Vulkan physical devices + + + No Vulkan physical device available + + @@ -2644,7 +2649,7 @@ Produce Vulkan Loader Log to all running Vulkan applications - Override System Vulkan Loader Log + Configure System Vulkan Loader Log true diff --git a/vkconfig_gui/tab_drivers.cpp b/vkconfig_gui/tab_drivers.cpp index e4b01ce1ed..c00c5a3cb9 100644 --- a/vkconfig_gui/tab_drivers.cpp +++ b/vkconfig_gui/tab_drivers.cpp @@ -65,7 +65,6 @@ void TabDrivers::UpdateUI(UpdateUIMode ui_update_mode) { this->ui->driver_mode->blockSignals(false); switch (configurator.driver_override_mode) { - default: case DRIVER_MODE_SINGLE: { this->ui->driver_forced_name->blockSignals(true); this->ui->driver_forced_name->clear(); @@ -118,6 +117,17 @@ void TabDrivers::UpdateUI(UpdateUIMode ui_update_mode) { this->ui->drivers_device_list->setVisible(true); this->ui->drivers_label_last->setVisible(true); } break; + case DRIVER_MODE_NONE: { + this->ui->driver_name_label->setVisible(false); + this->ui->driver_forced_name->setVisible(false); + this->ui->drivers_label_first->setVisible(false); + this->ui->drivers_device_list->setVisible(false); + this->ui->drivers_label_last->setVisible(false); + } break; + default: { + assert(0); + break; + } } this->ui->driver_group_box_paths->blockSignals(true); diff --git a/vkconfig_gui/widget_setting.cpp b/vkconfig_gui/widget_setting.cpp index cd9e7ec7d9..9ec0ad5d14 100644 --- a/vkconfig_gui/widget_setting.cpp +++ b/vkconfig_gui/widget_setting.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_gui/widget_setting_bool.cpp b/vkconfig_gui/widget_setting_bool.cpp index 91451a0c3b..83d2b63771 100644 --- a/vkconfig_gui/widget_setting_bool.cpp +++ b/vkconfig_gui/widget_setting_bool.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_gui/widget_setting_bool.h b/vkconfig_gui/widget_setting_bool.h index e36f7bb012..b764499d73 100644 --- a/vkconfig_gui/widget_setting_bool.h +++ b/vkconfig_gui/widget_setting_bool.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_gui/widget_setting_flags.h b/vkconfig_gui/widget_setting_flags.h index 0697f8e728..fff6402833 100644 --- a/vkconfig_gui/widget_setting_flags.h +++ b/vkconfig_gui/widget_setting_flags.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_gui/widget_setting_float.h b/vkconfig_gui/widget_setting_float.h index 0587c393b4..66ab383de7 100644 --- a/vkconfig_gui/widget_setting_float.h +++ b/vkconfig_gui/widget_setting_float.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_gui/widget_setting_frames.h b/vkconfig_gui/widget_setting_frames.h index d4e5f3564f..7c060b79a7 100644 --- a/vkconfig_gui/widget_setting_frames.h +++ b/vkconfig_gui/widget_setting_frames.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_gui/widget_setting_int.h b/vkconfig_gui/widget_setting_int.h index aac5214b43..98c08c13e1 100644 --- a/vkconfig_gui/widget_setting_int.h +++ b/vkconfig_gui/widget_setting_int.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_gui/widget_setting_list.cpp b/vkconfig_gui/widget_setting_list.cpp index 68c30216e3..98afb89715 100644 --- a/vkconfig_gui/widget_setting_list.cpp +++ b/vkconfig_gui/widget_setting_list.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_gui/widget_setting_list.h b/vkconfig_gui/widget_setting_list.h index 5144ae2b18..51a443cc9b 100644 --- a/vkconfig_gui/widget_setting_list.h +++ b/vkconfig_gui/widget_setting_list.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_gui/widget_setting_list_element.cpp b/vkconfig_gui/widget_setting_list_element.cpp index 4c24c9f0d0..3ecd379d8b 100644 --- a/vkconfig_gui/widget_setting_list_element.cpp +++ b/vkconfig_gui/widget_setting_list_element.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_gui/widget_setting_list_element.h b/vkconfig_gui/widget_setting_list_element.h index c9ad9c8dea..37c7a58273 100644 --- a/vkconfig_gui/widget_setting_list_element.h +++ b/vkconfig_gui/widget_setting_list_element.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_gui/widget_setting_string.cpp b/vkconfig_gui/widget_setting_string.cpp index 83bef4b588..9021beb707 100644 --- a/vkconfig_gui/widget_setting_string.cpp +++ b/vkconfig_gui/widget_setting_string.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vkconfig_gui/widget_setting_string.h b/vkconfig_gui/widget_setting_string.h index 1cb39bd492..dd9031173f 100644 --- a/vkconfig_gui/widget_setting_string.h +++ b/vkconfig_gui/widget_setting_string.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2026 Valve Corporation + * Copyright (c) 2020-2026 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 466c0ddb92d40261ff46dc098b516bd6896ea204 Mon Sep 17 00:00:00 2001 From: Christophe Date: Wed, 18 Mar 2026 13:13:17 +0100 Subject: [PATCH 04/14] vkconfig: Fix application launcher 'options' edit #2598 --- vkconfig_gui/CHANGELOG.md | 1 + vkconfig_gui/tab_applications.cpp | 11 ++++++----- vkconfig_gui/tab_applications.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/vkconfig_gui/CHANGELOG.md b/vkconfig_gui/CHANGELOG.md index 75cb1c0abf..58de6a4001 100644 --- a/vkconfig_gui/CHANGELOG.md +++ b/vkconfig_gui/CHANGELOG.md @@ -15,6 +15,7 @@ ### Fixes: - Fix command line whitespace decoding #2625 +- Fix application launcher 'options' edit #2598 ## Vulkan Configurator 3.4.2 - Febuary 2026 [Vulkan SDK 1.4.341.0](https://github.com/LunarG/VulkanTools/tree/vulkan-sdk-1.4.341) diff --git a/vkconfig_gui/tab_applications.cpp b/vkconfig_gui/tab_applications.cpp index 72efe225dc..e40fb1bd71 100644 --- a/vkconfig_gui/tab_applications.cpp +++ b/vkconfig_gui/tab_applications.cpp @@ -53,8 +53,8 @@ TabApplications::TabApplications(MainWindow &window, std::shared_ptrconnect(this->ui->launch_options_list, SIGNAL(currentIndexChanged(int)), this, SLOT(on_launch_options_list_activated(int))); - this->connect(this->ui->launch_options_list->lineEdit(), SIGNAL(textEdited(QString)), this, - SLOT(on_launch_options_list_textEdited(QString))); + this->connect(this->ui->launch_options_list->lineEdit(), &QLineEdit::editingFinished, this, + &TabApplications::on_launch_options_list_finished); this->connect(this->ui->launch_options_append, SIGNAL(clicked()), this, SLOT(on_launch_options_append_pressed())); this->connect(this->ui->launch_options_remove, SIGNAL(clicked()), this, SLOT(on_launch_options_remove_pressed())); @@ -328,14 +328,15 @@ void TabApplications::on_launch_options_list_activated(int index) { ui->launch_options_log_edit->setToolTip(options->log_file.AbsolutePath().c_str()); } -void TabApplications::on_launch_options_list_textEdited(const QString &text) { +void TabApplications::on_launch_options_list_finished() { + std::string new_text = this->ui->launch_options_list->lineEdit()->text().toStdString(); + Configurator &configurator = Configurator::Get(); Executable *executable = configurator.executables.GetActiveExecutable(); - executable->RenameActiveOptions(text.toStdString()); + executable->RenameActiveOptions(new_text); this->RebuildOptions(); this->ui->launch_options_list->setCurrentIndex(executable->GetActiveOptionsIndex()); - // this->ui->launch_options_list->setItemText(executable->GetActiveOptionsIndex(), text); } void TabApplications::on_launch_options_append_pressed() { diff --git a/vkconfig_gui/tab_applications.h b/vkconfig_gui/tab_applications.h index d2e53fb784..5c4b9cd25f 100644 --- a/vkconfig_gui/tab_applications.h +++ b/vkconfig_gui/tab_applications.h @@ -48,7 +48,7 @@ class TabApplications : public Tab { void on_launch_executable_remove_pressed(); void on_launch_options_list_activated(int index); - void on_launch_options_list_textEdited(const QString& text); + void on_launch_options_list_finished(); void on_launch_options_append_pressed(); void on_launch_options_remove_pressed(); From c8f7fb666e6e7ba91be24617931380b433963080 Mon Sep 17 00:00:00 2001 From: Christophe Date: Wed, 18 Mar 2026 16:59:44 +0100 Subject: [PATCH 05/14] vkconfig: Improve layer control tooltips #2595 --- vkconfig_core/layer.cpp | 24 ------- vkconfig_core/layer.h | 1 - vkconfig_core/type_layer_builtin.cpp | 10 +-- vkconfig_core/type_layer_builtin.h | 2 +- vkconfig_core/type_layer_control.cpp | 12 ---- vkconfig_core/type_layer_control.h | 1 - vkconfig_gui/CHANGELOG.md | 2 + .../widget_tab_configurations_layer.cpp | 68 ++++++++++++++++--- 8 files changed, 66 insertions(+), 54 deletions(-) diff --git a/vkconfig_core/layer.cpp b/vkconfig_core/layer.cpp index 0fa35136d7..d6042d39e1 100644 --- a/vkconfig_core/layer.cpp +++ b/vkconfig_core/layer.cpp @@ -103,30 +103,6 @@ LayerControl Layer::GetActualControl() const { } } -std::string Layer::GetActualControlTooltip() const { - if (this->type == LAYER_TYPE_IMPLICIT) { - if (!this->disable_env.empty()) { - if (qEnvironmentVariableIsSet(this->disable_env.c_str())) { - return format("'%s' is set", this->disable_env.c_str()); - } - } - - if (!this->enable_env.empty()) { - const std::string& value = qgetenv(this->enable_env.c_str()).toStdString(); - if (value == this->enable_value) { - return format("'%s' is set to '%s'.", this->enable_env.c_str(), value.c_str()); - } else { - return format("Set '%s' to '%s' to enable '%s' by default.", this->enable_env.c_str(), this->enable_value.c_str(), - this->key.c_str()); - } - } - - return format("Set '%s' to disable '%s' by default.", this->disable_env.c_str(), this->key.c_str()); - } else { - return ::GetDescription(LAYER_CONTROL_AUTO); - } -} - int Layer::FindPresetIndex(const SettingDataSet& settings) const { for (std::size_t i = 0, n = this->presets.size(); i < n; ++i) { if (::HasPreset(settings, this->presets[i].settings)) { diff --git a/vkconfig_core/layer.h b/vkconfig_core/layer.h index 5fbf7d3e8e..8380149405 100644 --- a/vkconfig_core/layer.h +++ b/vkconfig_core/layer.h @@ -82,7 +82,6 @@ class Layer { bool IsValid() const; LayerControl GetActualControl() const; - std::string GetActualControlTooltip() const; int FindPresetIndex(const SettingDataSet& settings) const; diff --git a/vkconfig_core/type_layer_builtin.cpp b/vkconfig_core/type_layer_builtin.cpp index aa0daffbe7..b4d1cb71e1 100644 --- a/vkconfig_core/type_layer_builtin.cpp +++ b/vkconfig_core/type_layer_builtin.cpp @@ -44,20 +44,22 @@ const char* GetToken(LayerBuiltin builtin) { const char* GetLabel(LayerBuiltin builtin) { static const char* TABLE[] = { - "N/A", // LAYER_BUILTIN_NONE - "Vulkan Layers Located by the Vulkan Application", // LAYER_BUILTIN_UNORDERED + "N/A", // LAYER_BUILTIN_NONE + "Vulkan Layers Located by Vulkan Applications", // LAYER_BUILTIN_UNORDERED }; static_assert(std::size(TABLE) == LAYER_BUILTIN_COUNT); return TABLE[builtin]; } - +/* const char* GetDescription(LayerBuiltin builtin) { static const char* TABLE[] = { "N/A", // LAYER_BUILTIN_NONE - "Vulkan Layers are located by the Vulkan Application by setting 'VK_ADD_LAYER_PATH' Application at launch", // LAYER_BUILTIN_UNORDERED + "Vulkan Layers are located by the Vulkan Application by setting 'VK_ADD_LAYER_PATH' Application at launch", // +LAYER_BUILTIN_UNORDERED }; static_assert(std::size(TABLE) == LAYER_BUILTIN_COUNT); return TABLE[builtin]; } +*/ diff --git a/vkconfig_core/type_layer_builtin.h b/vkconfig_core/type_layer_builtin.h index 08ec82d5ef..700f95a8f0 100644 --- a/vkconfig_core/type_layer_builtin.h +++ b/vkconfig_core/type_layer_builtin.h @@ -33,4 +33,4 @@ enum { LAYER_BUILTIN_COUNT = LAYER_BUILTIN_LAST - LAYER_BUILTIN_FIRST + 1 }; LayerBuiltin GetLayerBuiltin(const char* token); const char* GetToken(LayerBuiltin builtin); const char* GetLabel(LayerBuiltin builtin); -const char* GetDescription(LayerBuiltin builtin); +// const char* GetDescription(LayerBuiltin builtin); diff --git a/vkconfig_core/type_layer_control.cpp b/vkconfig_core/type_layer_control.cpp index 215540626c..1d3cda04b2 100644 --- a/vkconfig_core/type_layer_control.cpp +++ b/vkconfig_core/type_layer_control.cpp @@ -70,15 +70,3 @@ const char* GetLabel(LayerControl control) { return TABLE[control]; } - -const char* GetDescription(LayerControl control) { - static const char* TOKENS[] = { - "Explicit layers are disabled by default and implicit layers are enabled by default.", // LAYER_CONTROL_AUTO - "Discard the layer, don't notify the Vulkan Loader that this layer exists.", // LAYER_CONTROL_DISCARD - "Enable the layer, ensuring its execution.", // LAYER_CONTROL_ON - "Disable the layer, preventing its execution.", // LAYER_CONTROL_OFF - }; - static_assert(std::size(TOKENS) == LAYER_CONTROL_COUNT); - - return TOKENS[control]; -} diff --git a/vkconfig_core/type_layer_control.h b/vkconfig_core/type_layer_control.h index d090f38080..e6c19e9df2 100644 --- a/vkconfig_core/type_layer_control.h +++ b/vkconfig_core/type_layer_control.h @@ -42,4 +42,3 @@ LayerControl MapToUnordered(LayerControl control); LayerControl GetLayerControl(const char* token); const char* GetToken(LayerControl control); const char* GetLabel(LayerControl control); -const char* GetDescription(LayerControl control); diff --git a/vkconfig_gui/CHANGELOG.md b/vkconfig_gui/CHANGELOG.md index 58de6a4001..eb16313a9c 100644 --- a/vkconfig_gui/CHANGELOG.md +++ b/vkconfig_gui/CHANGELOG.md @@ -16,6 +16,8 @@ ### Fixes: - Fix command line whitespace decoding #2625 - Fix application launcher 'options' edit #2598 +- Fix "Vulkan Layers Located by Vulkan Applications" tooltips #2595 +- Fix "discard" layer control tooltip #2595 ## Vulkan Configurator 3.4.2 - Febuary 2026 [Vulkan SDK 1.4.341.0](https://github.com/LunarG/VulkanTools/tree/vulkan-sdk-1.4.341) diff --git a/vkconfig_gui/widget_tab_configurations_layer.cpp b/vkconfig_gui/widget_tab_configurations_layer.cpp index d38876cd95..5ddf0e4b3e 100644 --- a/vkconfig_gui/widget_tab_configurations_layer.cpp +++ b/vkconfig_gui/widget_tab_configurations_layer.cpp @@ -29,6 +29,56 @@ #include +static const char *GetDescription(LayerControl control, LayerBuiltin builtin) { + if (builtin == LAYER_BUILTIN_UNORDERED) { + static const char *TABLE[] = { + "Vulkan Layers located by Vulkan Applications using 'VK_ADD_LAYER_PATH' at launch", // LAYER_CONTROL_AUTO + "Prevent Vulkan applications from loading additional Vulkan Layers not visible by Vulkan Configurator", // LAYER_CONTROL_DISCARD + }; + static_assert(std::size(TABLE) == LAYER_CONTROL_UNORDERED_COUNT); + + return TABLE[control]; + } else { + static const char + * + TABLE[] = + { + "Explicit layers are disabled by default and implicit layers are enabled by default.", // LAYER_CONTROL_AUTO + "Discard the layer, the Vulkan Loader isn't made awate of this layer but the Vulkan application can locate " + "it.", // LAYER_CONTROL_DISCARD + "Enable the layer, ensuring its execution.", // LAYER_CONTROL_ON + "Disable the layer, preventing its execution.", // LAYER_CONTROL_OFF + }; + static_assert(std::size(TABLE) == LAYER_CONTROL_COUNT); + + return TABLE[control]; + } +} + +static std::string GetActualControlTooltip(const Layer *layer) { + if (layer->type == LAYER_TYPE_IMPLICIT) { + if (!layer->disable_env.empty()) { + if (qEnvironmentVariableIsSet(layer->disable_env.c_str())) { + return format("'%s' is set", layer->disable_env.c_str()); + } + } + + if (!layer->enable_env.empty()) { + const std::string &value = qgetenv(layer->enable_env.c_str()).toStdString(); + if (value == layer->enable_value) { + return format("'%s' is set to '%s'.", layer->enable_env.c_str(), value.c_str()); + } else { + return format("Set '%s' to '%s' to enable '%s' by default.", layer->enable_env.c_str(), layer->enable_value.c_str(), + layer->key.c_str()); + } + } + + return format("Set '%s' to disable '%s' by default.", layer->disable_env.c_str(), layer->key.c_str()); + } else { + return ::GetDescription(LAYER_CONTROL_AUTO, LAYER_BUILTIN_NONE); + } +} + ConfigurationLayerWidget::ConfigurationLayerWidget(TabConfigurations *tab, const Parameter ¶meter) : layer_name(parameter.key), tab(tab) { const Configurator &configurator = Configurator::Get(); @@ -48,22 +98,18 @@ ConfigurationLayerWidget::ConfigurationLayerWidget(TabConfigurations *tab, const for (int i = first; i <= last; ++i) { const LayerControl layer_control = static_cast(i); std::string label = ::GetLabel(layer_control); - /* - if (i == LAYER_CONTROL_AUTO && layer != nullptr) { - label += layer->GetActualControl() == LAYER_CONTROL_ON ? " (E)" : " (D)"; - } - */ + this->layer_state->addItem(label.c_str()); - this->layer_state->setItemData(i, ::GetDescription(layer_control), Qt::ToolTipRole); + this->layer_state->setItemData(i, ::GetDescription(layer_control, parameter.builtin), Qt::ToolTipRole); } this->layer_state->setCurrentIndex(parameter.control); - if (parameter.control == LAYER_CONTROL_AUTO && layer != nullptr) { + if (parameter.builtin == LAYER_BUILTIN_NONE && parameter.control == LAYER_CONTROL_AUTO && layer != nullptr) { std::string message = ::GetToken(layer->type) + std::string(" layer: ") + ::GetLabel(layer->GetActualControl()); - message += format(". %s", layer->GetActualControlTooltip().c_str()); + message += format(". %s", ::GetActualControlTooltip(layer).c_str()); this->layer_state->setToolTip(message.c_str()); } else { - this->layer_state->setToolTip(::GetDescription(parameter.control)); + this->layer_state->setToolTip(::GetDescription(parameter.control, parameter.builtin)); } this->connect(this->layer_state, SIGNAL(currentIndexChanged(int)), this, SLOT(on_layer_state_currentIndexChanged(int))); @@ -97,7 +143,7 @@ ConfigurationLayerWidget::ConfigurationLayerWidget(TabConfigurations *tab, const this->setText(decorated_name.c_str()); if (parameter.builtin != LAYER_BUILTIN_NONE) { - this->setToolTip(::GetDescription(parameter.builtin)); + this->setToolTip(::GetDescription(parameter.control, parameter.builtin)); } else if (!parameter.manifest.Empty()) { this->setToolTip(parameter.manifest.AbsolutePath().c_str()); } @@ -192,7 +238,7 @@ void ConfigurationLayerWidget::on_layer_state_currentIndexChanged(int index) { } parameter->control = control; - this->layer_state->setToolTip(GetDescription(control)); + this->layer_state->setToolTip(GetDescription(control, parameter->builtin)); configurator.Override(OVERRIDE_AREA_ALL); } From a578e5f055c5fdae7b20a8bf513e5054e5e65b5a Mon Sep 17 00:00:00 2001 From: Christophe Date: Wed, 18 Mar 2026 19:25:29 +0100 Subject: [PATCH 06/14] vkconfig: Add vkconfig.json backup on Reset to Default Change-Id: I5a003d3e539bac5f2dce72cc2fc5a9711cbfe1b9 --- vkconfig_core/configurator.cpp | 1 + vkconfig_core/layer.cpp | 1 - vkconfig_core/path.cpp | 22 ++++++++++++++++++++++ vkconfig_core/path.h | 1 + vkconfig_core/type_tab.cpp | 16 ++++++++-------- vkconfig_gui/CHANGELOG.md | 1 + vkconfig_gui/mainwindow.ui | 2 +- 7 files changed, 34 insertions(+), 10 deletions(-) diff --git a/vkconfig_core/configurator.cpp b/vkconfig_core/configurator.cpp index 1492a167e5..88a5b4779a 100644 --- a/vkconfig_core/configurator.cpp +++ b/vkconfig_core/configurator.cpp @@ -572,6 +572,7 @@ void Configurator::Reset(bool hard) { this->Surrender(OVERRIDE_AREA_LOADER_SETTINGS_BIT); const Path& vkconfig_init_path = ::Path(Path::INIT); + vkconfig_init_path.Backup(); vkconfig_init_path.Remove(); QSettings settings("LunarG", VKCONFIG_SHORT_NAME); diff --git a/vkconfig_core/layer.cpp b/vkconfig_core/layer.cpp index d6042d39e1..919eb811bf 100644 --- a/vkconfig_core/layer.cpp +++ b/vkconfig_core/layer.cpp @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include diff --git a/vkconfig_core/path.cpp b/vkconfig_core/path.cpp index 6ec2ab6580..3f620e004c 100644 --- a/vkconfig_core/path.cpp +++ b/vkconfig_core/path.cpp @@ -189,6 +189,28 @@ bool Path::Create(bool as_file) const { return true; } +bool Path::Backup() const { + if (this->IsFile()) { + QFile file(this->AbsolutePath().c_str()); + + QDateTime date_time = QDateTime::currentDateTime(); + std::string date = date_time.toString(Qt::ISODate).toStdString(); + std::replace(date.begin(), date.end(), ':', '-'); + + std::string path = this->AbsolutePath(); + std::string extension = path.substr(path.find_last_of(".")); + std::string prefix = path.substr(0, path.find_last_of(".")); + //"vkconfig-" + date_time.toString(Qt::ISODate).toStdString() + ".json"; + + std::string dest = prefix + "-" + date + extension; + + bool result = file.copy(dest.c_str()); + return result; + } else { + return false; + } +} + bool Path::Remove() const { if (!this->Exists()) { return false; diff --git a/vkconfig_core/path.h b/vkconfig_core/path.h index 3342628105..a10f34e06b 100644 --- a/vkconfig_core/path.h +++ b/vkconfig_core/path.h @@ -61,6 +61,7 @@ class Path { void Clear(); bool Exists() const; bool Create(bool as_file = false) const; + bool Backup() const; bool Remove() const; std::string Filename() const; std::string Basename() const; diff --git a/vkconfig_core/type_tab.cpp b/vkconfig_core/type_tab.cpp index 9667a7cd8f..b7f0371080 100644 --- a/vkconfig_core/type_tab.cpp +++ b/vkconfig_core/type_tab.cpp @@ -25,14 +25,14 @@ const char* GetLabel(TabType type) { static const char* TOKENS[]{ - "Vulkan Layers", // TAB_CONFIGURATIONS - "Vulkan Layers Paths", // TAB_LAYERS_PATHS - "Vulkan Drivers", // TAB_DRIVERS - "Application Launcher", // TAB_APPLICATIONS - "Diagnostics", // TAB_DIAGNOSTIC - "Documentation", // TAB_DOCUMENTATION - "Preferences", // TAB_PREFERENCES - "About" // TAB_ABOUT + "Vulkan Layers Configuration", // TAB_CONFIGURATIONS + "Vulkan Layers Paths", // TAB_LAYERS_PATHS + "Vulkan Drivers", // TAB_DRIVERS + "Application Launcher", // TAB_APPLICATIONS + "Diagnostics", // TAB_DIAGNOSTIC + "Documentation", // TAB_DOCUMENTATION + "Preferences", // TAB_PREFERENCES + "About" // TAB_ABOUT }; static_assert(std::size(TOKENS) == TAB_COUNT, "The tranlation table size doesn't match the enum number of elements"); diff --git a/vkconfig_gui/CHANGELOG.md b/vkconfig_gui/CHANGELOG.md index eb16313a9c..d576d85f91 100644 --- a/vkconfig_gui/CHANGELOG.md +++ b/vkconfig_gui/CHANGELOG.md @@ -12,6 +12,7 @@ - Improve generated layer settings C++ library to output to code for `vulkan.hpp` - Clean up generated layer settings C++ library for less friction on use - Add preferences settings to show "Vulkan Executables Scope" +- Add `vkconfig.json` backup when doing a "Reset To Default" #2570 ### Fixes: - Fix command line whitespace decoding #2625 diff --git a/vkconfig_gui/mainwindow.ui b/vkconfig_gui/mainwindow.ui index 734d35eff6..50bd9eb7d8 100644 --- a/vkconfig_gui/mainwindow.ui +++ b/vkconfig_gui/mainwindow.ui @@ -91,7 +91,7 @@ QTabWidget::Rounded - 0 + 1 From bf527b2ddb1a7fcfb4dd379e931a926007501876 Mon Sep 17 00:00:00 2001 From: Christophe Date: Wed, 18 Mar 2026 20:18:52 +0100 Subject: [PATCH 07/14] vkconfig: Add 'Discard Ordering and Enabling Layers' default config #2596 Change-Id: Ia70b0040cfb274ed40e849d291a9f050cf0b9324 --- .../Discard Ordering and Enabling Layers.json | 44 +++++++++++++++++++ .../Validation with API Dump Log.json | 2 +- vkconfig_core/test/resources.qrc | 1 + vkconfig_gui/CHANGELOG.md | 2 + vkconfig_gui/mainwindow.ui | 2 +- vkconfig_gui/resources.qrc | 1 + 6 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 vkconfig_core/configurations/Discard Ordering and Enabling Layers.json diff --git a/vkconfig_core/configurations/Discard Ordering and Enabling Layers.json b/vkconfig_core/configurations/Discard Ordering and Enabling Layers.json new file mode 100644 index 0000000000..e0fdbf378f --- /dev/null +++ b/vkconfig_core/configurations/Discard Ordering and Enabling Layers.json @@ -0,0 +1,44 @@ +{ + "file_format_version": "3.0.0", + "configuration": { + "name": "Discard Ordering and Enabling Layers", + "version": 1, + "platforms": [ + "WINDOWS", + "LINUX", + "MACOS" + ], + "selected_layer_name": "", + "default_layer_control": "discard", + "override_layers": true, + "override_loader": false, + "loader_message_types": [ + "error", + "warn", + "info", + "debug", + "perf", + "layer", + "driver" + ], + "layers": [ + { + "builtin": "unordered_layer_location", + "control": "auto", + "name": "Vulkan Layers Located by Vulkan Applications", + "override_settings": true, + "platforms": [ + "WINDOWS_X86", + "WINDOWS_ARM", + "LINUX", + "MACOS" + ], + "rank": 9, + "settings": [ + ], + "type": "Explicit", + "version": "latest" + } + ] + } +} diff --git a/vkconfig_core/configurations/Validation with API Dump Log.json b/vkconfig_core/configurations/Validation with API Dump Log.json index 5e1e3ae657..3eb702a824 100644 --- a/vkconfig_core/configurations/Validation with API Dump Log.json +++ b/vkconfig_core/configurations/Validation with API Dump Log.json @@ -1,7 +1,7 @@ { "file_format_version": "3.0.0", "configuration": { - "name": "API dump", + "name": "Validation with API Dump Log", "version": 1, "platforms": [ "WINDOWS", diff --git a/vkconfig_core/test/resources.qrc b/vkconfig_core/test/resources.qrc index 2d9d021070..d542348c98 100644 --- a/vkconfig_core/test/resources.qrc +++ b/vkconfig_core/test/resources.qrc @@ -65,6 +65,7 @@ ../configurations/API dump.json ../configurations/Crash Diagnostic.json ../configurations/Disable All Vulkan Layers.json + ../configurations/Discard Ordering and Enabling Layers.json ../configurations/Frame Capture.json ../configurations/Portability.json ../configurations/Validation.json diff --git a/vkconfig_gui/CHANGELOG.md b/vkconfig_gui/CHANGELOG.md index d576d85f91..ea2998c4da 100644 --- a/vkconfig_gui/CHANGELOG.md +++ b/vkconfig_gui/CHANGELOG.md @@ -13,12 +13,14 @@ - Clean up generated layer settings C++ library for less friction on use - Add preferences settings to show "Vulkan Executables Scope" - Add `vkconfig.json` backup when doing a "Reset To Default" #2570 +- Add "Discard Ordering and Enabling Layers" default configuration #2596 ### Fixes: - Fix command line whitespace decoding #2625 - Fix application launcher 'options' edit #2598 - Fix "Vulkan Layers Located by Vulkan Applications" tooltips #2595 - Fix "discard" layer control tooltip #2595 +- Fix "Validation with API Dump log" configuration not loaded ## Vulkan Configurator 3.4.2 - Febuary 2026 [Vulkan SDK 1.4.341.0](https://github.com/LunarG/VulkanTools/tree/vulkan-sdk-1.4.341) diff --git a/vkconfig_gui/mainwindow.ui b/vkconfig_gui/mainwindow.ui index 50bd9eb7d8..734d35eff6 100644 --- a/vkconfig_gui/mainwindow.ui +++ b/vkconfig_gui/mainwindow.ui @@ -91,7 +91,7 @@ QTabWidget::Rounded - 1 + 0 diff --git a/vkconfig_gui/resources.qrc b/vkconfig_gui/resources.qrc index 3ecfa0c893..d24e5602a2 100644 --- a/vkconfig_gui/resources.qrc +++ b/vkconfig_gui/resources.qrc @@ -96,6 +96,7 @@ ../vkconfig_core/configurations/API dump.json ../vkconfig_core/configurations/Crash Diagnostic.json ../vkconfig_core/configurations/Disable All Vulkan Layers.json + ../vkconfig_core/configurations/Discard Ordering and Enabling Layers.json ../vkconfig_core/configurations/Frame Capture.json ../vkconfig_core/configurations/Portability.json ../vkconfig_core/configurations/Validation.json From 99917c03d9ee6a70096b501d692da918c62e0003 Mon Sep 17 00:00:00 2001 From: Christophe Date: Wed, 18 Mar 2026 20:36:42 +0100 Subject: [PATCH 08/14] vkconfig: Updated message when loader is not found #2533 Change-Id: Ibe020afd10370ba142e8dc7a9f25f2ded7e48932 --- vkconfig_gui/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vkconfig_gui/main.cpp b/vkconfig_gui/main.cpp index adaeb92c69..9466e0f8d0 100644 --- a/vkconfig_gui/main.cpp +++ b/vkconfig_gui/main.cpp @@ -110,7 +110,9 @@ int main(int argc, char* argv[]) { QMessageBox alert; alert.QDialog::setWindowTitle("Vulkan Configurator failed to start..."); alert.setText("Could not find a Vulkan Loader. Please install the Vulkan SDK."); - alert.setInformativeText("https://vulkan.lunarg.com/sdk/home"); + alert.setInformativeText( + "For more information: Read the Vulkan SDK 'Getting Started' " + "documentation"); alert.setIcon(QMessageBox::Critical); alert.exec(); return -1; From 7463bbe77f4fbddab839f75aa92aae72fac68483 Mon Sep 17 00:00:00 2001 From: Christophe Date: Thu, 19 Mar 2026 19:16:08 +0100 Subject: [PATCH 09/14] vkconfig: Fix high CPU usage on idle when no layers configuration is applied Change-Id: I3adc1adf4311a2cc865b6b610345b11d66929627 --- vkconfig_gui/CHANGELOG.md | 1 + vkconfig_gui/mainwindow.cpp | 2 +- vkconfig_gui/tab_configurations.cpp | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vkconfig_gui/CHANGELOG.md b/vkconfig_gui/CHANGELOG.md index ea2998c4da..a950384a5b 100644 --- a/vkconfig_gui/CHANGELOG.md +++ b/vkconfig_gui/CHANGELOG.md @@ -21,6 +21,7 @@ - Fix "Vulkan Layers Located by Vulkan Applications" tooltips #2595 - Fix "discard" layer control tooltip #2595 - Fix "Validation with API Dump log" configuration not loaded +- Fix high CPU usage on idle when no layers configuration is active #2603 ## Vulkan Configurator 3.4.2 - Febuary 2026 [Vulkan SDK 1.4.341.0](https://github.com/LunarG/VulkanTools/tree/vulkan-sdk-1.4.341) diff --git a/vkconfig_gui/mainwindow.cpp b/vkconfig_gui/mainwindow.cpp index 106e164ab0..224ae30588 100644 --- a/vkconfig_gui/mainwindow.cpp +++ b/vkconfig_gui/mainwindow.cpp @@ -364,7 +364,7 @@ void MainWindow::showEvent(QShowEvent *event) { bool MainWindow::eventFilter(QObject *target, QEvent *event) { if (this->tabs[this->ui->tab_widget->currentIndex()] == nullptr) { - return false; + return true; } return this->tabs[this->ui->tab_widget->currentIndex()]->EventFilter(target, event); diff --git a/vkconfig_gui/tab_configurations.cpp b/vkconfig_gui/tab_configurations.cpp index d4eb1fe027..8740e6122e 100644 --- a/vkconfig_gui/tab_configurations.cpp +++ b/vkconfig_gui/tab_configurations.cpp @@ -414,11 +414,11 @@ bool TabConfigurations::EventFilter(QObject *target, QEvent *event) { this->UpdateUI_Settings(UPDATE_REBUILD_UI); } - return true; + return false; } if (!configurator.layers_override_enabled || !ui->configurations_list->isEnabled()) { - return true; + return false; } else if (target == this->ui->configurations_list) { QContextMenuEvent *right_click = dynamic_cast(event); if (right_click) { From 21554b0bdaffcfcbdddd44f168b6758cdd72f091 Mon Sep 17 00:00:00 2001 From: Christophe Date: Thu, 19 Mar 2026 20:05:46 +0100 Subject: [PATCH 10/14] vkconfig: Clean up dead code Change-Id: I6646a52f9e044d6080f35c30ff9023e6be8eb529 --- vkconfig_core/configurator.cpp | 2 +- vkconfig_core/configurator.h | 3 --- vkconfig_gui/tab_diagnostics.cpp | 6 ------ 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/vkconfig_core/configurator.cpp b/vkconfig_core/configurator.cpp index 88a5b4779a..3e1e6392a6 100644 --- a/vkconfig_core/configurator.cpp +++ b/vkconfig_core/configurator.cpp @@ -196,7 +196,7 @@ QJsonObject Configurator::CreateJsonSettingObject(const Configurator::LoaderSett json_settings.insert("app_keys", json_app_keys); } - if (loader_settings.override_layers) { + if (this->layers_override_enabled) { json_settings.insert("layers", json_layers); } diff --git a/vkconfig_core/configurator.h b/vkconfig_core/configurator.h index 4a5413f827..cbabe37081 100644 --- a/vkconfig_core/configurator.h +++ b/vkconfig_core/configurator.h @@ -68,7 +68,6 @@ class Configurator { struct LoaderSettings { Path executable_path; std::vector layers; - bool override_layers = true; }; static Configurator& Get(); @@ -165,7 +164,6 @@ class Configurator { const ConfiguratorMode& mode; - bool force_full_loader_log = false; bool reset_hard = false; bool has_crashed = false; TabType active_tab = TAB_CONFIGURATIONS; @@ -185,7 +183,6 @@ class Configurator { std::vector driver_override_list; std::map driver_paths; bool driver_paths_enabled = false; - bool loader_log_enabled = false; int loader_log_messages_flags = GetBit(LOG_ERROR); diff --git a/vkconfig_gui/tab_diagnostics.cpp b/vkconfig_gui/tab_diagnostics.cpp index 332824299d..237945d1f2 100644 --- a/vkconfig_gui/tab_diagnostics.cpp +++ b/vkconfig_gui/tab_diagnostics.cpp @@ -131,8 +131,6 @@ std::string TabDiagnostics::BuildStatus(DiagnosticMode selected_mode, std::size_ std::string filename; if (selected_mode == DIAGNOSTIC_VULKAN_LOADER_LOG) { - configurator.force_full_loader_log = true; - this->status.clear(); args += "--summary"; @@ -180,10 +178,6 @@ std::string TabDiagnostics::BuildStatus(DiagnosticMode selected_mode, std::size_ while (this->process->waitForFinished(1000)) { } - if (selected_mode == DIAGNOSTIC_VULKAN_LOADER_LOG) { - configurator.force_full_loader_log = false; - } - configurator.SetExecutableScope(saved_scope); configurator.Override(OVERRIDE_AREA_ALL); From 796d193c8e3a236811e75855f62546b3b2c633b2 Mon Sep 17 00:00:00 2001 From: Christophe Date: Fri, 20 Mar 2026 17:24:59 +0100 Subject: [PATCH 11/14] vkconfig: Fix UUID display in log, following the RFC9562 standard #2423 Change-Id: I7657a8edf8d56a79cfc3515e9ba9b4943c9caa8c --- vkconfig_core/vulkan_util.cpp | 3 +++ vkconfig_gui/CHANGELOG.md | 1 + 2 files changed, 4 insertions(+) diff --git a/vkconfig_core/vulkan_util.cpp b/vkconfig_core/vulkan_util.cpp index 3d66bc3e0b..3215294118 100644 --- a/vkconfig_core/vulkan_util.cpp +++ b/vkconfig_core/vulkan_util.cpp @@ -35,6 +35,9 @@ std::string GetUUIDString(const uint8_t deviceUUID[VK_UUID_SIZE]) { for (std::size_t i = 0, n = VK_UUID_SIZE; i < n; ++i) { result += format("%02X", deviceUUID[i]); + if (i == 3 || i == 5 || i == 7) { + result += "-"; + } } return result; diff --git a/vkconfig_gui/CHANGELOG.md b/vkconfig_gui/CHANGELOG.md index a950384a5b..37c6911b72 100644 --- a/vkconfig_gui/CHANGELOG.md +++ b/vkconfig_gui/CHANGELOG.md @@ -22,6 +22,7 @@ - Fix "discard" layer control tooltip #2595 - Fix "Validation with API Dump log" configuration not loaded - Fix high CPU usage on idle when no layers configuration is active #2603 +- Fix UUID display in log, following the RFC9562 standard ## Vulkan Configurator 3.4.2 - Febuary 2026 [Vulkan SDK 1.4.341.0](https://github.com/LunarG/VulkanTools/tree/vulkan-sdk-1.4.341) From 02acf732d259379c4e4f296e4a6a6b6c8173c878 Mon Sep 17 00:00:00 2001 From: Christophe Date: Tue, 24 Mar 2026 11:40:13 +0100 Subject: [PATCH 12/14] vkconfig: Load all Vulkan drivers from a path --- vkconfig_core/configurator.cpp | 6 +++--- vkconfig_core/configurator.h | 2 +- vkconfig_core/registry.cpp | 4 ++++ vkconfig_gui/CHANGELOG.md | 1 + vkconfig_gui/tab_drivers.cpp | 21 +++++++++++++-------- vkconfig_gui/tab_layers.cpp | 14 +++++++++++--- vkconfig_gui/tab_preferences.cpp | 2 +- 7 files changed, 34 insertions(+), 16 deletions(-) diff --git a/vkconfig_core/configurator.cpp b/vkconfig_core/configurator.cpp index 3e1e6392a6..07541c7d2d 100644 --- a/vkconfig_core/configurator.cpp +++ b/vkconfig_core/configurator.cpp @@ -1160,8 +1160,8 @@ bool Configurator::Load() { } } - if (json_object.value("last_driver_path") != QJsonValue::Undefined) { - this->last_driver_path = json_object.value("last_driver_path").toString().toStdString(); + if (json_object.value("last_driver_dir") != QJsonValue::Undefined) { + this->last_driver_dir = json_object.value("last_driver_dir").toString().toStdString(); } if (json_object.value("driver_paths") != QJsonValue::Undefined) { const QJsonObject& json_object_paths = json_object.value("driver_paths").toObject(); @@ -1349,7 +1349,7 @@ bool Configurator::Save() const { } json_object.insert("driver_override_list", json_driver_override_list_array); - json_object.insert("last_driver_path", this->last_driver_path.RelativePath().c_str()); + json_object.insert("last_driver_dir", this->last_driver_dir.RelativePath().c_str()); QJsonObject json_object_paths; for (auto it = this->driver_paths.begin(); it != this->driver_paths.end(); ++it) { QJsonObject json_object_path; diff --git a/vkconfig_core/configurator.h b/vkconfig_core/configurator.h index cbabe37081..e351320b7c 100644 --- a/vkconfig_core/configurator.h +++ b/vkconfig_core/configurator.h @@ -169,7 +169,7 @@ class Configurator { TabType active_tab = TAB_CONFIGURATIONS; bool advanced = true; Path last_path_status = Path(Path::HOME).AbsolutePath() + "/diagnostics"; - Path last_driver_path = Path(Path::HOME).AbsolutePath() + "/*.json"; + Path last_driver_dir = Path(Path::HOME).AbsolutePath(); Path last_path_launch_log = Path(Path::HOME).AbsolutePath() + "/application_log.txt"; Version online_sdk_version = Version::NONE; Version latest_sdk_version = Version::NONE; diff --git a/vkconfig_core/registry.cpp b/vkconfig_core/registry.cpp index b4dc2ec65d..4ffb93fe31 100644 --- a/vkconfig_core/registry.cpp +++ b/vkconfig_core/registry.cpp @@ -214,6 +214,10 @@ std::vector LoadRegistrySoftwareLayers(const char *path, LayerTy info.type = type; info.path = path.IsFile() ? path.AbsoluteDir() : path.AbsolutePath(); + if (!path.Exists()) { + continue; + } + if (::Found(result, info.path)) { continue; } diff --git a/vkconfig_gui/CHANGELOG.md b/vkconfig_gui/CHANGELOG.md index 37c6911b72..2883004517 100644 --- a/vkconfig_gui/CHANGELOG.md +++ b/vkconfig_gui/CHANGELOG.md @@ -14,6 +14,7 @@ - Add preferences settings to show "Vulkan Executables Scope" - Add `vkconfig.json` backup when doing a "Reset To Default" #2570 - Add "Discard Ordering and Enabling Layers" default configuration #2596 +- Improve Vulkan drivers loading, add all drivers in a part at once ### Fixes: - Fix command line whitespace decoding #2625 diff --git a/vkconfig_gui/tab_drivers.cpp b/vkconfig_gui/tab_drivers.cpp index c00c5a3cb9..bd5ea20060 100644 --- a/vkconfig_gui/tab_drivers.cpp +++ b/vkconfig_gui/tab_drivers.cpp @@ -135,7 +135,7 @@ void TabDrivers::UpdateUI(UpdateUIMode ui_update_mode) { this->ui->driver_group_box_paths->blockSignals(false); this->ui->driver_paths_list->clear(); - this->ui->driver_path_lineedit->setText(configurator.last_driver_path.RelativePath().c_str()); + this->ui->driver_path_lineedit->setText(configurator.last_driver_dir.RelativePath().c_str()); this->ui->driver_paths_list->blockSignals(true); for (auto it = configurator.driver_paths.begin(); it != configurator.driver_paths.end(); ++it) { @@ -252,8 +252,8 @@ void TabDrivers::on_driver_append_pressed() { if (!selected_path.Exists()) { QMessageBox alert; - alert.setWindowTitle("Vulkan Driver Manifest file not found"); - alert.setText("The path"); + alert.setWindowTitle("Vulkan Driver Manifest directory not found"); + alert.setText("The directory:"); alert.setInformativeText(selected_path.AbsolutePath().c_str()); alert.setStandardButtons(QMessageBox::Ok); alert.setDefaultButton(QMessageBox::Ok); @@ -262,8 +262,12 @@ void TabDrivers::on_driver_append_pressed() { return; } - configurator.driver_paths.insert(std::pair(selected_path, true)); - configurator.last_driver_path = selected_path; + configurator.last_driver_dir = selected_path; + + const std::vector drivers_paths = ::CollectFilePaths(selected_path); + for (std::size_t i = 0, n = drivers_paths.size(); i < n; ++i) { + configurator.driver_paths.insert(std::pair(drivers_paths[i], true)); + } configurator.UpdateVulkanSystemInfo(); @@ -273,9 +277,10 @@ void TabDrivers::on_driver_append_pressed() { void TabDrivers::on_driver_browse_pressed() { Configurator &configurator = Configurator::Get(); - const Path &selected_path = QFileDialog::getOpenFileName(this->ui->driver_browse_button, "Adding a Driver Manifests File...", - configurator.last_driver_path.AbsolutePath().c_str(), "*.json") - .toStdString(); + const Path &selected_path = + QFileDialog::getExistingDirectory(this->ui->driver_browse_button, "Adding Driver Manifests Directory...", + configurator.last_driver_dir.AbsolutePath().c_str()) + .toStdString(); if (selected_path.Empty()) { return; diff --git a/vkconfig_gui/tab_layers.cpp b/vkconfig_gui/tab_layers.cpp index f30cc9d253..fefd77001e 100644 --- a/vkconfig_gui/tab_layers.cpp +++ b/vkconfig_gui/tab_layers.cpp @@ -64,6 +64,15 @@ void TabLayers::UpdateUI_LayersPaths(UpdateUIMode ui_update_mode) { std::vector &paths_group = configurator.layers.paths[group_path]; for (std::size_t i = 0, n = paths_group.size(); i < n; ++i) { + const std::string &layer_path = paths_group[i].path.AbsolutePath(); + const std::vector &manifest_paths = CollectFilePaths(layer_path); + /* + if (group_path != LAYERS_PATHS_GUI) { + if (manifest_paths.empty()) { + continue; + } + } + */ QTreeWidgetItem *item_state = new QTreeWidgetItem; item_state->setFlags(item_state->flags() | Qt::ItemIsSelectable); item_state->setSizeHint(0, QSize(0, ITEM_HEIGHT)); @@ -75,9 +84,6 @@ void TabLayers::UpdateUI_LayersPaths(UpdateUIMode ui_update_mode) { ui->layers_paths_tree->addTopLevelItem(item_state); ui->layers_paths_tree->setItemWidget(item_state, 0, layer_path_widget); - const std::string &layer_path = paths_group[i].path.AbsolutePath(); - const std::vector &manifest_paths = CollectFilePaths(layer_path); - for (std::size_t manifest_index = 0, manifest_count = manifest_paths.size(); manifest_index < manifest_count; ++manifest_index) { const Layer *layer = configurator.layers.FindFromManifest(manifest_paths[manifest_index], true); @@ -97,6 +103,8 @@ void TabLayers::UpdateUI_LayersPaths(UpdateUIMode ui_update_mode) { label += format(" (%s)", GetToken(layer->status)); } + // label += " - " + layer->manifest_path.AbsolutePath(); + QTreeWidgetItem *item = new QTreeWidgetItem; item->setText(0, label.c_str()); item->setToolTip(0, layer->manifest_path.AbsolutePath().c_str()); diff --git a/vkconfig_gui/tab_preferences.cpp b/vkconfig_gui/tab_preferences.cpp index a4fb5d44eb..4424fbb397 100644 --- a/vkconfig_gui/tab_preferences.cpp +++ b/vkconfig_gui/tab_preferences.cpp @@ -170,7 +170,7 @@ void TabPreferences::on_theme_mode_changed(int index) { this->ui->configurations_settings_reset->setIcon(::Get(new_theme_mode, ::ICON_RELOAD)); // Drivers - this->ui->driver_browse_button->setIcon(::Get(new_theme_mode, ::ICON_FILE_SEARCH)); + this->ui->driver_browse_button->setIcon(::Get(new_theme_mode, ::ICON_FOLDER_SEARCH)); // Layers this->ui->layers_browse_button->setIcon(::Get(new_theme_mode, ::ICON_FOLDER_SEARCH)); From 9be945a82df81fda32e1fe01a1bfffb1acf2745e Mon Sep 17 00:00:00 2001 From: Christophe Date: Tue, 24 Mar 2026 16:19:34 +0100 Subject: [PATCH 13/14] vkconfig: Refactor layers tab and improve UI consistency --- vkconfig_cmd/main_layers.cpp | 25 +- vkconfig_core/configuration.cpp | 2 +- vkconfig_core/json.cpp | 10 +- vkconfig_core/layer.cpp | 32 +- vkconfig_core/layer.h | 23 +- vkconfig_core/layer_manager.cpp | 473 ++- vkconfig_core/layer_manager.h | 33 +- vkconfig_core/registry.cpp | 26 +- vkconfig_core/registry.h | 4 +- vkconfig_core/test/test_configuration.cpp | 46 +- .../test/test_configuration_built_in.cpp | 10 +- .../test/test_configuration_manager.cpp | 26 +- vkconfig_core/test/test_generate_settings.cpp | 3 +- vkconfig_core/test/test_layer.cpp | 32 +- vkconfig_core/test/test_layer_manager.cpp | 136 +- vkconfig_core/test/test_layer_preset.cpp | 10 +- vkconfig_core/test/test_parameter.cpp | 113 +- vkconfig_core/type_layers_paths.cpp | 18 +- vkconfig_core/type_layers_paths.h | 2 + vkconfig_core/type_tab.cpp | 2 +- vkconfig_gui/CHANGELOG.md | 7 + vkconfig_gui/mainwindow.cpp | 32 + vkconfig_gui/mainwindow.ui | 2748 +++++++++-------- vkconfig_gui/tab_applications.cpp | 12 +- vkconfig_gui/tab_configurations.cpp | 16 +- vkconfig_gui/tab_configurations.h | 1 + vkconfig_gui/tab_diagnostics.cpp | 27 +- vkconfig_gui/tab_diagnostics.h | 1 + vkconfig_gui/tab_drivers.cpp | 107 +- vkconfig_gui/tab_drivers.h | 7 + vkconfig_gui/tab_layers.cpp | 170 +- vkconfig_gui/tab_layers.h | 7 +- vkconfig_gui/tab_preferences.cpp | 15 +- vkconfig_gui/tab_preferences.h | 1 + vkconfig_gui/widget_tab_driver_path.cpp | 4 +- vkconfig_gui/widget_tab_layers_path.cpp | 51 +- vkconfig_gui/widget_tab_layers_path.h | 9 +- 37 files changed, 2207 insertions(+), 2034 deletions(-) diff --git a/vkconfig_cmd/main_layers.cpp b/vkconfig_cmd/main_layers.cpp index ad3ba9995b..674844bed7 100644 --- a/vkconfig_cmd/main_layers.cpp +++ b/vkconfig_cmd/main_layers.cpp @@ -87,22 +87,21 @@ static int RunLayersSurrender(Configurator& configurator, const CommandLine& com } static int RunLayersPath(Configurator& configurator, const CommandLine& command_line) { - printf("vkconfig: [INFO] Paths to find Vulkan Layers\n"); + printf("vkconfig: [INFO] Vulkan Layers paths:\n"); - for (int layers_paths_index = 0, layers_paths_count = LAYERS_PATHS_COUNT; layers_paths_index < layers_paths_count; - ++layers_paths_index) { - const std::vector& paths = configurator.layers.paths[layers_paths_index]; - printf("\n%s:\n", GetLabel(static_cast(layers_paths_index))); + const std::set& layer_display_list = configurator.layers.BuildLayerDisplayList(); - if (paths.empty()) { - printf(" - None\n"); - } else { - for (std::size_t i = 0, n = paths.size(); i < n; ++i) { - if (paths[i].enabled) { - printf(" - %s\n", paths[i].path.AbsolutePath().c_str()); - } - } + for (auto it = layer_display_list.begin(), end = layer_display_list.end(); it != end; ++it) { + const Layer* layer = configurator.layers.FindFromManifest(it->manifest_path, true); + if (layer == nullptr) { + continue; } + + const std::string status = layer->status == STATUS_STABLE ? "" : format(" (%s)", ::GetToken(layer->status)); + const std::string text = format("%s - %s%s, %s layer", layer->key.c_str(), layer->api_version.str().c_str(), status.c_str(), + ::GetToken(layer->type)); + + printf(" - %s\n", text.c_str()); } return 0; diff --git a/vkconfig_core/configuration.cpp b/vkconfig_core/configuration.cpp index 7656778023..2bbb65f16b 100644 --- a/vkconfig_core/configuration.cpp +++ b/vkconfig_core/configuration.cpp @@ -173,7 +173,7 @@ bool Configuration::Load(const Path& full_path, const LayerManager& layers) { if (layer != nullptr) { parameter.manifest = layer->manifest_path; - parameter.type = layer->type; + // parameter.type = layer->type; } if (parameter.api_version != Version::LATEST) { diff --git a/vkconfig_core/json.cpp b/vkconfig_core/json.cpp index 044079cf93..20af9301f7 100644 --- a/vkconfig_core/json.cpp +++ b/vkconfig_core/json.cpp @@ -25,12 +25,12 @@ #include -QJsonDocument ParseJsonFile(const char* file) { - QFile file_schema(file); - const bool result = file_schema.open(QIODevice::ReadOnly | QIODevice::Text); +QJsonDocument ParseJsonFile(const char* path) { + QFile file(path); + const bool result = file.open(QIODevice::ReadOnly | QIODevice::Text); if (result) { - const QString& data = file_schema.readAll(); - file_schema.close(); + const QString& data = file.readAll(); + file.close(); QJsonParseError json_parse_error; const QJsonDocument& json_document = QJsonDocument::fromJson(data.toUtf8(), &json_parse_error); diff --git a/vkconfig_core/layer.cpp b/vkconfig_core/layer.cpp index 919eb811bf..a1cb6238e9 100644 --- a/vkconfig_core/layer.cpp +++ b/vkconfig_core/layer.cpp @@ -49,11 +49,9 @@ #include #include -bool operator<(const LayersPathInfo& a, const LayersPathInfo& b) { return a.path.RelativePath() < b.path.RelativePath(); } - -bool Found(const std::vector& data, const Path& path) { +bool Found(const std::vector& data, const Path& path) { for (std::size_t i = 0, n = data.size(); i < n; ++i) { - if (data[i].path == path) { + if (data[i] == path) { return true; } } @@ -179,7 +177,7 @@ void Layer::FillPresetSettings(SettingDataSet& settings_data, const std::vector< } LayerLoadStatus Layer::Load(const Path& full_path_to_file, LayerType type, bool request_validate_manifest, - const std::map& layers_found, ConfiguratorMode configurator_mode) { + ConfiguratorMode configurator_mode) { this->type = type; // Set layer type, no way to know this from the json file if (full_path_to_file.Empty()) { @@ -197,13 +195,6 @@ LayerLoadStatus Layer::Load(const Path& full_path_to_file, LayerType type, bool this->manifest_path = full_path_to_file; this->last_modified = full_path_to_file.LastModified(); - auto it = layers_found.find(full_path_to_file.AbsolutePath().c_str()); - if (it != layers_found.end()) { - if (it->second.disabled && it->second.last_modified == this->last_modified) { - return LAYER_LOAD_FAILED; - } - } - // Convert the text to a JSON document & validate it. // It does need to be a valid json formatted file. QJsonParseError json_parse_error; @@ -252,7 +243,7 @@ LayerLoadStatus Layer::Load(const Path& full_path_to_file, LayerType type, bool this->key = ReadStringValue(json_layer_object, "name"); - if (this->key == "VK_LAYER_LUNARG_override") { + if (this->key == "VK_LAYER_LUNARG_override" || !(this->key.rfind("VK_", 0) == 0)) { return LAYER_LOAD_IGNORED; } @@ -260,12 +251,7 @@ LayerLoadStatus Layer::Load(const Path& full_path_to_file, LayerType type, bool JsonValidator validator; - std::string cached_last_modified; - if (it != layers_found.end()) { - cached_last_modified = it->second.last_modified; - } - const bool should_validate = request_validate_manifest && ((last_modified != cached_last_modified) || !it->second.validated); - const bool is_valid = should_validate ? validator.Check(json_text) : true; + const bool is_valid = request_validate_manifest ? validator.Check(json_text) : true; if (!is_valid) { switch (configurator_mode) { @@ -407,6 +393,14 @@ LayerLoadStatus Layer::Load(const Path& full_path_to_file, LayerType type, bool return this->IsValid() ? LAYER_LOAD_ADDED : LAYER_LOAD_INVALID; // Not all JSON file are layer JSON valid } +bool operator<(const Layer& layer_a, const Layer& layer_b) { + if (layer_a.key == layer_b.key) { + return layer_a.api_version < layer_b.api_version; + } else { + return layer_a.key < layer_b.key; + } +} + void CollectDefaultSettingData(const SettingMetaSet& meta_set, SettingDataSet& data_set) { for (std::size_t i = 0, n = meta_set.size(); i < n; ++i) { SettingMeta* setting_meta = meta_set[i]; diff --git a/vkconfig_core/layer.h b/vkconfig_core/layer.h index 8380149405..c4b64734b2 100644 --- a/vkconfig_core/layer.h +++ b/vkconfig_core/layer.h @@ -36,21 +36,15 @@ #include #include -struct LayerStatus { +struct LayerDescriptor { + LayerType type = LAYER_TYPE_EXPLICIT; std::string last_modified; bool validated = false; - bool disabled = false; -}; - -struct LayersPathInfo { - Path path; - LayerType type = LAYER_TYPE_EXPLICIT; bool enabled = true; + bool added = false; }; -bool operator<(const LayersPathInfo& a, const LayersPathInfo& b); - -bool Found(const std::vector& data, const Path& path); +bool Found(const std::vector& data, const Path& path); enum LayerLoadStatus { LAYER_LOAD_ADDED = 0, @@ -64,8 +58,8 @@ enum LayerLoadStatus { LAYER_LOAD_LAST = LAYER_LOAD_IGNORED, }; -inline bool IsDisabled(LayerLoadStatus status) { - return status == LAYER_LOAD_FAILED || status == LAYER_LOAD_INVALID || status == LAYER_LOAD_IGNORED; +inline bool IsEnabled(LayerLoadStatus status) { + return !(status == LAYER_LOAD_FAILED || status == LAYER_LOAD_INVALID || status == LAYER_LOAD_IGNORED); } enum { LAYER_LOAD_COUNT = LAYER_LOAD_LAST - LAYER_LOAD_FIRST + 1 }; @@ -115,13 +109,12 @@ class Layer { std::string enable_env; std::string enable_value; bool is_32bits = false; - bool enabled = true; std::vector settings; std::vector presets; LayerLoadStatus Load(const Path& full_path_to_file, LayerType type, bool request_validate_manifest, - const std::map& layers_found, ConfiguratorMode configurator_mode); + ConfiguratorMode configurator_mode); private: Layer& operator=(const Layer&) = delete; @@ -129,4 +122,6 @@ class Layer { std::vector > memory; // Settings are deleted when all layers instances are deleted. }; +bool operator<(const Layer& layer_a, const Layer& layer_b); + void CollectDefaultSettingData(const SettingMetaSet& meta_set, SettingDataSet& data_set); diff --git a/vkconfig_core/layer_manager.cpp b/vkconfig_core/layer_manager.cpp index 84ac360960..8c5e3cdb0b 100644 --- a/vkconfig_core/layer_manager.cpp +++ b/vkconfig_core/layer_manager.cpp @@ -25,36 +25,34 @@ #include -std::vector GetEnvVariablePaths(const char *variable_name, LayerType type) { - std::vector result; +static std::vector GetEnvVariablePaths(const char *variable_name, LayerType type) { + std::vector result; const char *SEPARATOR = GetToken(PARSE_ENV_VAR); const std::vector &paths = UniqueStrings(Split(qgetenv(variable_name).toStdString(), SEPARATOR)); result.resize(paths.size()); for (std::size_t i = 0, n = paths.size(); i < n; ++i) { - result[i].path = paths[i]; - result[i].enabled = true; - result[i].type = type; + result[i] = paths[i]; } return result; } -std::vector GetImplicitLayerPaths() { - std::vector result; +static std::vector GetImplicitLayerPaths() { + std::vector result; #if VKC_ENV == VKC_ENV_WIN32 - const std::vector &admin_registry_paths = + const std::vector &admin_registry_paths = LoadRegistrySoftwareLayers("HKEY_LOCAL_MACHINE\\Software\\Khronos\\Vulkan\\ImplicitLayers", LAYER_TYPE_IMPLICIT); result.insert(result.begin(), admin_registry_paths.begin(), admin_registry_paths.end()); - const std::vector &user_registry_paths = + const std::vector &user_registry_paths = LoadRegistrySoftwareLayers("HKEY_CURRENT_USER\\Software\\Khronos\\Vulkan\\ImplicitLayers", LAYER_TYPE_IMPLICIT); result.insert(result.begin(), user_registry_paths.begin(), user_registry_paths.end()); // Search for drivers specific layers - const std::vector &drivers_registry_paths = + const std::vector &drivers_registry_paths = LoadRegistrySystemLayers("HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Class\\...\\VulkanImplicitLayers"); result.insert(result.begin(), drivers_registry_paths.begin(), drivers_registry_paths.end()); #else @@ -89,32 +87,25 @@ std::vector GetImplicitLayerPaths() { paths.push_back(LAYERS_PATHS[i]); } } - - for (std::size_t i = 0, n = paths.size(); i < n; ++i) { - LayersPathInfo info; - info.type = LAYER_TYPE_IMPLICIT; - info.path = paths[i]; - result.push_back(info); - } #endif return result; } -std::vector GetExplicitLayerPaths() { - std::vector result; +std::vector GetExplicitLayerPaths() { + std::vector result; #if VKC_ENV == VKC_ENV_WIN32 - const std::vector &admin_registry_paths = + const std::vector &admin_registry_paths = LoadRegistrySoftwareLayers("HKEY_LOCAL_MACHINE\\Software\\Khronos\\Vulkan\\ExplicitLayers", LAYER_TYPE_EXPLICIT); result.insert(result.begin(), admin_registry_paths.begin(), admin_registry_paths.end()); - const std::vector &user_registry_paths = + const std::vector &user_registry_paths = LoadRegistrySoftwareLayers("HKEY_CURRENT_USER\\Software\\Khronos\\Vulkan\\ExplicitLayers", LAYER_TYPE_EXPLICIT); result.insert(result.begin(), user_registry_paths.begin(), user_registry_paths.end()); // Search for drivers specific layers - const std::vector &drivers_registry_paths = + const std::vector &drivers_registry_paths = LoadRegistrySystemLayers("HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Class\\...\\VulkanExplicitLayers"); result.insert(result.begin(), drivers_registry_paths.begin(), drivers_registry_paths.end()); #else @@ -149,39 +140,23 @@ std::vector GetExplicitLayerPaths() { paths.push_back(LAYERS_PATHS[i]); } } - - for (std::size_t i = 0, n = paths.size(); i < n; ++i) { - LayersPathInfo info; - info.type = LAYER_TYPE_EXPLICIT; - info.path = paths[i]; - result.push_back(info); - } #endif return result; } -static LayersPathInfo *FindPathInfo(std::array, LAYERS_PATHS_COUNT> &paths, const std::string &path) { - for (int paths_type_index = LAYERS_PATHS_FIRST; paths_type_index <= LAYERS_PATHS_LAST; ++paths_type_index) { - for (std::size_t i = 0, n = paths[paths_type_index].size(); i < n; ++i) { - if (paths[paths_type_index][i].path == path) { - return &paths[paths_type_index][i]; - } - } - } - - return nullptr; -} - -LayerManager::LayerManager() { this->InitSystemPaths(); } +LayerManager::LayerManager() {} bool LayerManager::Load(const QJsonObject &json_root_object, ConfiguratorMode configurator_mode) { + this->available_layers.clear(); + this->layers_found.clear(); + // LAYERS_PATHS_GUI if (json_root_object.value("layers") != QJsonValue::Undefined) { const QJsonObject &json_layers_object = json_root_object.value("layers").toObject(); - if (json_layers_object.value("last_layers_path") != QJsonValue::Undefined) { - this->last_layers_path = json_layers_object.value("last_layers_path").toString().toStdString(); + if (json_layers_object.value("last_layers_dir") != QJsonValue::Undefined) { + this->last_layers_dir = json_layers_object.value("last_layers_dir").toString().toStdString(); } if (json_layers_object.value("validate_manifests") != QJsonValue::Undefined) { @@ -195,26 +170,26 @@ bool LayerManager::Load(const QJsonObject &json_root_object, ConfiguratorMode co for (int i = 0, n = json_layers_found_keys.length(); i < n; ++i) { const QJsonObject &json_status_object = json_layers_found_object.value(json_layers_found_keys[i]).toObject(); - LayerStatus layer_status; - layer_status.last_modified = json_status_object.value("last_modified").toString().toStdString(); - layer_status.validated = json_status_object.value("validated").toBool(); - layer_status.disabled = json_status_object.value("disabled").toBool(); + LayerDescriptor descriptor; + if (json_status_object.value("type") != QJsonValue::Undefined) { + descriptor.type = ::GetLayerType(json_status_object.value("type").toString().toStdString().c_str()); + } + descriptor.last_modified = json_status_object.value("last_modified").toString().toStdString(); + descriptor.validated = json_status_object.value("validated").toBool(); + if (json_status_object.value("enabled") != QJsonValue::Undefined) { + descriptor.enabled = json_status_object.value("enabled").toBool(); + } const Path &manifest_path = json_layers_found_keys[i].toStdString(); - this->layers_found.insert(std::make_pair(manifest_path, layer_status)); + this->layers_found.insert(std::make_pair(manifest_path, descriptor)); } } - if (json_layers_object.value("paths") != QJsonValue::Undefined) { - const QJsonObject &json_paths_object = json_layers_object.value("paths").toObject(); - const QStringList &json_paths_keys = json_paths_object.keys(); - - for (int i = 0, n = json_paths_keys.length(); i < n; ++i) { - LayersPathInfo info; - info.path = json_paths_keys[i].toStdString(); - info.enabled = json_paths_object.value(json_paths_keys[i].toStdString().c_str()).toBool(); - this->AppendPath(info); + if (json_layers_object.value("removed") != QJsonValue::Undefined) { + const QJsonArray &array = json_layers_object.value("removed").toArray(); + for (int i = 0, n = array.size(); i < n; ++i) { + this->layers_removed.insert(array[i].toString().toStdString()); } } } @@ -225,30 +200,26 @@ bool LayerManager::Load(const QJsonObject &json_root_object, ConfiguratorMode co } bool LayerManager::Save(QJsonObject &json_root_object) const { - QJsonObject json_layers_status_object; + QJsonObject json_layers_found_object; for (auto it = this->layers_found.begin(); it != this->layers_found.end(); ++it) { - QJsonObject json_layer_status_object; - json_layer_status_object.insert("last_modified", it->second.last_modified.c_str()); - json_layer_status_object.insert("validated", it->second.validated); - json_layer_status_object.insert("disabled", it->second.disabled); - json_layers_status_object.insert(it->first.AbsolutePath().c_str(), json_layer_status_object); + QJsonObject object; + object.insert("last_modified", it->second.last_modified.c_str()); + object.insert("type", ::GetToken(it->second.type)); + object.insert("validated", it->second.validated); + object.insert("enabled", it->second.enabled); + json_layers_found_object.insert(it->first.AbsolutePath().c_str(), object); } - QJsonObject json_paths_object; - for (int paths_type_index = LAYERS_PATHS_FIRST; paths_type_index <= LAYERS_PATHS_LAST; ++paths_type_index) { - const std::vector &path_infos = this->paths[paths_type_index]; - - for (std::size_t i = 0, n = path_infos.size(); i < n; ++i) { - json_paths_object.insert(path_infos[i].path.RelativePath().c_str(), path_infos[i].enabled); - } + QJsonArray json_layers_removed_array; + for (auto it = this->layers_removed.begin(); it != this->layers_removed.end(); ++it) { + json_layers_removed_array.append(it->AbsolutePath().c_str()); } QJsonObject json_layers_object; json_layers_object.insert("validate_manifests", this->validate_manifests); - json_layers_object.insert("last_layers_path", this->last_layers_path.RelativePath().c_str()); - json_layers_object.insert("found", json_layers_status_object); - json_layers_object.insert("paths", json_paths_object); - + json_layers_object.insert("last_layers_dir", this->last_layers_dir.RelativePath().c_str()); + json_layers_object.insert("found", json_layers_found_object); + json_layers_object.insert("removed", json_layers_removed_array); json_root_object.insert("layers", json_layers_object); return true; @@ -257,48 +228,43 @@ bool LayerManager::Save(QJsonObject &json_root_object) const { std::string LayerManager::Log() const { std::string log; - for (std::size_t group_index = 0, group_count = this->paths.size(); group_index < group_count; ++group_index) { - const std::vector &paths_group = this->paths[group_index]; - if (paths_group.empty()) { - log += format(" %d. %s paths:\n", group_index + 1, ::GetLabel(static_cast(group_index))); - log += format(" - None\n"); + for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { + const Layer *layer = &this->available_layers[i]; + + auto it = this->layers_found.find(layer->manifest_path); + if (it == this->layers_found.end()) { + assert(0); + continue; + } + + const LayerDescriptor &descriptor = it->second; + + if (descriptor.type == LAYER_TYPE_IMPLICIT) { + log += format(" * %s - %s (Auto: %s)", layer->key.c_str(), layer->api_version.str().c_str(), + GetLabel(layer->GetActualControl())); } else { - log += format(" %d. %s paths:\n", group_index + 1, ::GetLabel(static_cast(group_index))); + log += format(" * %s - %s", layer->key.c_str(), layer->api_version.str().c_str()); } - for (std::size_t path_index = 0, path_count = paths_group.size(); path_index < path_count; ++path_index) { - log += format(" - %s (%s)\n", paths_group[path_index].path.AbsolutePath().c_str(), - paths_group[path_index].enabled ? "Enabled" : "Disabled"); + if (layer->status != STATUS_STABLE) { + log += format(" (%s)", GetToken(layer->status)); + } + log += "\n"; - const std::vector layers = this->GatherLayers(paths_group[path_index]); + log += format(" %s\n", layer->manifest_path.AbsolutePath().c_str()); + log += "\n"; - for (std::size_t i = 0, n = layers.size(); i < n; ++i) { - if (layers[i]->type == LAYER_TYPE_IMPLICIT) { - log += format(" * %s - %s (Auto: %s)", layers[i]->key.c_str(), layers[i]->api_version.str().c_str(), - GetLabel(layers[i]->GetActualControl())); + if (descriptor.type == LAYER_TYPE_IMPLICIT) { + if (!layer->disable_env.empty()) { + const std::string &value = qEnvironmentVariableIsSet(layer->disable_env.c_str()) ? "set" : "not set"; + log += format(" '%s' is %s\n", layer->disable_env.c_str(), value.c_str()); + } + if (!layer->enable_env.empty()) { + if (qEnvironmentVariableIsSet(layer->enable_env.c_str())) { + const std::string &value = qgetenv(layer->enable_env.c_str()).toStdString(); + log += format(" '%s' is set to '%s'\n", layer->enable_env.c_str(), value.c_str()); } else { - log += format(" * %s - %s", layers[i]->key.c_str(), layers[i]->api_version.str().c_str()); - } - - if (layers[i]->status != STATUS_STABLE) { - log += format(" (%s)", GetToken(layers[i]->status)); - } - log += "\n"; - - if (layers[i]->type == LAYER_TYPE_IMPLICIT) { - if (!layers[i]->disable_env.empty()) { - const std::string &value = qEnvironmentVariableIsSet(layers[i]->disable_env.c_str()) ? "set" : "not set"; - log += format(" '%s' is %s\n", layers[i]->disable_env.c_str(), value.c_str()); - } - if (!layers[i]->enable_env.empty()) { - if (qEnvironmentVariableIsSet(layers[i]->enable_env.c_str())) { - const std::string &value = qgetenv(layers[i]->enable_env.c_str()).toStdString(); - log += format(" '%s' is set to '%s'\n", layers[i]->enable_env.c_str(), value.c_str()); - } else { - log += format(" '%s' is not set to '%s'\n", layers[i]->enable_env.c_str(), - layers[i]->enable_value.c_str()); - } - } + log += format(" '%s' is not set to '%s'\n", layer->enable_env.c_str(), layer->enable_value.c_str()); } } } @@ -309,57 +275,25 @@ std::string LayerManager::Log() const { return log; } -void LayerManager::InitSystemPaths() { - this->available_layers.clear(); - this->layers_found.clear(); - - this->paths[LAYERS_PATHS_IMPLICIT_SYSTEM] = GetImplicitLayerPaths(); - - // LAYERS_PATHS_IMPLICIT_ENV_SET: VK_IMPLICIT_LAYER_PATH env variables - this->paths[LAYERS_PATHS_IMPLICIT_ENV_SET] = GetEnvVariablePaths("VK_IMPLICIT_LAYER_PATH", LAYER_TYPE_IMPLICIT); - - // LAYERS_PATHS_IMPLICIT_ENV_ADD: VK_ADD_IMPLICIT_LAYER_PATH env variables - this->paths[LAYERS_PATHS_IMPLICIT_ENV_ADD] = GetEnvVariablePaths("VK_ADD_IMPLICIT_LAYER_PATH", LAYER_TYPE_IMPLICIT); - - // LAYERS_PATHS_EXPLICIT_SYSTEM - this->paths[LAYERS_PATHS_EXPLICIT_SYSTEM] = GetExplicitLayerPaths(); - - // LAYERS_PATHS_EXPLICIT_ENV_SET: VK_LAYER_PATH env variables - this->paths[LAYERS_PATHS_EXPLICIT_ENV_SET] = GetEnvVariablePaths("VK_LAYER_PATH", LAYER_TYPE_EXPLICIT); - - // LAYERS_PATHS_EXPLICIT_ENV_ADD: VK_ADD_LAYER_PATH env variables - this->paths[LAYERS_PATHS_EXPLICIT_ENV_ADD] = GetEnvVariablePaths("VK_ADD_LAYER_PATH", LAYER_TYPE_EXPLICIT); - - // LAYERS_PATHS_GUI - this->paths[LAYERS_PATHS_GUI].clear(); - - // LAYERS_PATHS_SDK - this->paths[LAYERS_PATHS_SDK].clear(); - { - LayersPathInfo info; - info.path = Path(Path::SDK_EXPLICIT_LAYERS); - info.enabled = true; - this->paths[LAYERS_PATHS_SDK].push_back(info); - } -} - void LayerManager::Clear() { this->available_layers.clear(); } bool LayerManager::Empty() const { return this->available_layers.empty(); } std::size_t LayerManager::Size() const { return this->available_layers.size(); } -std::vector LayerManager::GatherManifests(const std::string &layer_name) const { +std::vector LayerManager::GatherManifests(const std::string &layer_key) const { std::vector result; for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { - if (!this->available_layers[i].enabled) { + if (this->available_layers[i].key != layer_key) { continue; } - if (this->available_layers[i].key == layer_name) { - result.push_back(this->available_layers[i].manifest_path); + if (!this->IsEnabled(this->available_layers[i].manifest_path)) { + continue; } + + result.push_back(this->available_layers[i].manifest_path); } std::sort(result.rbegin(), result.rend()); @@ -367,17 +301,19 @@ std::vector LayerManager::GatherManifests(const std::string &layer_name) c return result; } -std::vector LayerManager::GatherVersions(const std::string &layer_name) const { +std::vector LayerManager::GatherVersions(const std::string &layer_key) const { std::vector result; for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { - if (!this->available_layers[i].enabled) { + if (this->available_layers[i].key != layer_key) { continue; } - if (this->available_layers[i].key == layer_name) { - result.push_back(this->available_layers[i].api_version); + if (!this->IsEnabled(this->available_layers[i].manifest_path)) { + continue; } + + result.push_back(this->available_layers[i].api_version); } std::sort(result.rbegin(), result.rend()); @@ -422,15 +358,17 @@ const Layer *LayerManager::FindLastModified(const std::string &layer_name, const const Layer *result = nullptr; for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { - if (this->available_layers[i].enabled == false) { - continue; - } if (this->available_layers[i].key != layer_name) { continue; } if (this->available_layers[i].api_version != version) { continue; } + + if (!this->IsEnabled(this->available_layers[i].manifest_path)) { + continue; + } + if (result != nullptr) { if (result->last_modified > this->available_layers[i].last_modified) { continue; @@ -445,8 +383,10 @@ const Layer *LayerManager::FindLastModified(const std::string &layer_name, const const Layer *LayerManager::FindFromManifest(const Path &manifest_path, bool find_disabled_layers) const { for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { - if (!find_disabled_layers && this->available_layers[i].enabled == false) { - continue; + if (!find_disabled_layers) { + if (!this->IsEnabled(this->available_layers[i].manifest_path)) { + continue; + } } if (this->available_layers[i].manifest_path == manifest_path) { @@ -458,8 +398,10 @@ const Layer *LayerManager::FindFromManifest(const Path &manifest_path, bool find Layer *LayerManager::FindFromManifest(const Path &manifest_path, bool find_disabled_layers) { for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { - if (!find_disabled_layers && this->available_layers[i].enabled == false) { - continue; + if (!find_disabled_layers) { + if (!this->IsEnabled(this->available_layers[i].manifest_path)) { + continue; + } } if (this->available_layers[i].manifest_path == manifest_path) { @@ -471,24 +413,44 @@ Layer *LayerManager::FindFromManifest(const Path &manifest_path, bool find_disab // Find all installed layers on the system. void LayerManager::LoadAllInstalledLayers(ConfiguratorMode configurator_mode) { - this->available_layers.clear(); + std::array, LAYERS_PATHS_COUNT> paths; + + // Search new layers + paths[LAYERS_PATHS_IMPLICIT_SYSTEM] = GetImplicitLayerPaths(); + + // LAYERS_PATHS_IMPLICIT_ENV_SET: VK_IMPLICIT_LAYER_PATH env variables + paths[LAYERS_PATHS_IMPLICIT_ENV_SET] = GetEnvVariablePaths("VK_IMPLICIT_LAYER_PATH", LAYER_TYPE_IMPLICIT); + + // LAYERS_PATHS_IMPLICIT_ENV_ADD: VK_ADD_IMPLICIT_LAYER_PATH env variables + paths[LAYERS_PATHS_IMPLICIT_ENV_ADD] = GetEnvVariablePaths("VK_ADD_IMPLICIT_LAYER_PATH", LAYER_TYPE_IMPLICIT); + + // LAYERS_PATHS_EXPLICIT_SYSTEM + paths[LAYERS_PATHS_EXPLICIT_SYSTEM] = GetExplicitLayerPaths(); + + // LAYERS_PATHS_EXPLICIT_ENV_SET: VK_LAYER_PATH env variables + paths[LAYERS_PATHS_EXPLICIT_ENV_SET] = GetEnvVariablePaths("VK_LAYER_PATH", LAYER_TYPE_EXPLICIT); + + // LAYERS_PATHS_EXPLICIT_ENV_ADD: VK_ADD_LAYER_PATH env variables + paths[LAYERS_PATHS_EXPLICIT_ENV_ADD] = GetEnvVariablePaths("VK_ADD_LAYER_PATH", LAYER_TYPE_EXPLICIT); + + // LAYERS_PATHS_SDK + paths[LAYERS_PATHS_SDK].push_back(Path(Path::SDK_EXPLICIT_LAYERS)); - for (std::size_t group_index = 0, group_count = this->paths.size(); group_index < group_count; ++group_index) { + for (std::size_t group_index = 0, group_count = paths.size(); group_index < group_count; ++group_index) { const LayersPaths layers_path = static_cast(group_index); - const std::vector &paths_group = this->paths[group_index]; + const std::vector &paths_group = paths[group_index]; for (std::size_t i = 0, n = paths_group.size(); i < n; ++i) { - this->LoadLayersFromPath(paths_group[i].path, paths_group[i].type, configurator_mode); - this->UpdatePathEnabled(paths_group[i], layers_path); + const std::vector &layers_paths = ::CollectFilePaths(paths_group[i]); + + for (std::size_t p = 0, o = layers_paths.size(); p < o; ++p) { + this->AppendPath(layers_paths[p], ::GetLayerType(layers_path)); + } } } -} - -void LayerManager::LoadLayersFromPath(const Path &layers_path, LayerType type, ConfiguratorMode configurator_mode) { - const std::vector &layers_paths = CollectFilePaths(layers_path); - for (std::size_t i = 0, n = layers_paths.size(); i < n; ++i) { - this->LoadLayer(layers_paths[i], type, configurator_mode); + for (auto it = this->layers_found.begin(); it != this->layers_found.end(); ++it) { + this->LoadLayer(it->first, it->second.type, configurator_mode); } } @@ -506,134 +468,81 @@ LayerLoadStatus LayerManager::LoadLayer(const Path &layer_path, LayerType type, } // Modified to reload - LayerLoadStatus status = - already_loaded_layer->Load(layer_path, type, this->validate_manifests, this->layers_found, configurator_mode); + LayerLoadStatus status = already_loaded_layer->Load(layer_path, type, this->validate_manifests, configurator_mode); if (status == LAYER_LOAD_ADDED) { it->second.last_modified = already_loaded_layer->last_modified; return LAYER_LOAD_RELOADED; } else { - it->second.disabled = IsDisabled(status); + // it->second.enabled = ::IsEnabled(status); return status; } } else { Layer layer; - LayerLoadStatus status = layer.Load(layer_path, type, this->validate_manifests, this->layers_found, configurator_mode); + LayerLoadStatus status = layer.Load(layer_path, type, this->validate_manifests, configurator_mode); if (status == LAYER_LOAD_ADDED) { this->available_layers.push_back(layer); } auto it = this->layers_found.find(layer_path); + // assert(it != this->layers_found.end()); if (it != layers_found.end()) { - it->second.disabled = IsDisabled(status); - it->second.validated = this->validate_manifests && !it->second.disabled; + // it->second.enabled = ::IsEnabled(status); + // it->second.validated = this->validate_manifests && it->second.enabled; it->second.last_modified = layer.last_modified; } else { - LayerStatus found; - found.disabled = IsDisabled(status); - found.validated = this->validate_manifests && !found.disabled; - found.last_modified = layer.last_modified; - this->layers_found.insert(std::make_pair(layer.manifest_path, found)); + LayerDescriptor descriptor; + descriptor.type = layer.type; + descriptor.last_modified = layer.last_modified; + descriptor.validated = this->validate_manifests; + descriptor.enabled = true; + descriptor.added = true; + layers_found.insert(std::make_pair(layer.manifest_path, descriptor)); } return status; } } -bool LayerManager::AreLayersEnabled(const LayersPathInfo &path_info) const { - for (int paths_type_index = LAYERS_PATHS_FIRST; paths_type_index <= LAYERS_PATHS_LAST; ++paths_type_index) { - for (std::size_t i = 0, n = this->paths[paths_type_index].size(); i < n; ++i) { - if (this->paths[paths_type_index][i].path == path_info.path) { - if (this->paths[paths_type_index][i].enabled) { - return true; // If one path is enabled, then the layer remains enable - } - } +void LayerManager::AppendPath(const Path &path, LayerType type, bool added) { + if (added) { + auto it_removed = this->layers_removed.find(path); + if (it_removed != this->layers_removed.end()) { + this->layers_removed.erase(it_removed); } } - return false; -} - -void LayerManager::AppendPath(const LayersPathInfo &info) { - LayersPathInfo *existing_info = FindPathInfo(this->paths, info.path.RelativePath()); - if (existing_info != nullptr) { - existing_info->enabled = info.enabled; - } else { - this->paths[LAYERS_PATHS_GUI].push_back(info); + if (this->layers_removed.find(path) != this->layers_removed.end()) { + return; } - std::sort(this->paths[LAYERS_PATHS_GUI].begin(), this->paths[LAYERS_PATHS_GUI].end()); -} - -void LayerManager::RemovePath(const LayersPathInfo &path_info) { - const std::vector &layers_paths = CollectFilePaths(path_info.path); - - for (std::size_t i = 0, n = layers_paths.size(); i < n; ++i) { - Layer *layer = this->FindFromManifest(layers_paths[i]); - if (layer == nullptr) { - continue; - } - - layer->enabled = false; - } - - for (int paths_type_index = LAYERS_PATHS_FIRST; paths_type_index <= LAYERS_PATHS_LAST; ++paths_type_index) { - std::vector new_path_list; - for (std::size_t i = 0, n = this->paths[paths_type_index].size(); i < n; ++i) { - if (path_info.path == this->paths[paths_type_index][i].path) { - continue; - } - - new_path_list.push_back(this->paths[paths_type_index][i]); - } - this->paths[paths_type_index] = new_path_list; - } -} - -void LayerManager::UpdatePathEnabled(const LayersPathInfo &path_info, LayersPaths paths_type_index) { - for (std::size_t i = 0, n = this->paths[paths_type_index].size(); i < n; ++i) { - if (path_info.path == this->paths[paths_type_index][i].path) { - this->paths[paths_type_index][i].enabled = path_info.enabled; - break; - } - } - - this->UpdateLayersEnabled(path_info); -} - -void LayerManager::UpdateLayersEnabled(const LayersPathInfo &path_info) { - const bool are_enabled = this->AreLayersEnabled(path_info); - - const std::vector &layers_paths = ::CollectFilePaths(path_info.path); - - for (std::size_t i = 0, n = layers_paths.size(); i < n; ++i) { - Layer *layer = this->FindFromManifest(layers_paths[i], true); - if (layer == nullptr) { - continue; - } - - layer->enabled = are_enabled; + auto it = this->layers_found.find(path); + if (it == this->layers_found.end()) { + LayerDescriptor descriptor; + descriptor.type = type; + descriptor.added = added; + descriptor.last_modified = path.LastModified(); + this->layers_found.insert(std::make_pair(path, descriptor)); } } -std::vector LayerManager::CollectManifestPaths() const { - std::vector results; - - for (int paths_type_index = LAYERS_PATHS_FIRST; paths_type_index <= LAYERS_PATHS_LAST; ++paths_type_index) { - for (std::size_t i = 0, n = this->paths[paths_type_index].size(); i < n; ++i) { - const std::vector &layers_paths = ::CollectFilePaths(this->paths[paths_type_index][i].path); - results.insert(results.end(), layers_paths.begin(), layers_paths.end()); - } +void LayerManager::RemovePath(const Path &path) { + auto it_found = this->layers_found.find(path); + if (it_found != this->layers_found.end()) { + this->layers_found.erase(it_found); } - return results; + this->layers_removed.insert(path); } std::vector LayerManager::GatherLayerNames() const { std::vector result; for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { - if (this->available_layers[i].enabled == false) { - continue; + auto it = this->layers_found.find(this->available_layers[i].manifest_path); + if (it != this->layers_found.end()) { + if (!it->second.enabled) { + continue; + } } if (std::find(result.begin(), result.end(), this->available_layers[i].key) != result.end()) { @@ -646,17 +555,45 @@ std::vector LayerManager::GatherLayerNames() const { return result; } -std::vector LayerManager::GatherLayers(const LayersPathInfo &path_info) const { - std::vector result; +bool LayerManager::IsEnabled(const Path &manifest_path) const { + auto it = this->layers_found.find(manifest_path); + if (it != this->layers_found.end()) { + return it->second.enabled; + } + return false; +} - for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { - const std::string &layer_path = path_info.path.AbsolutePath(); - const std::string ¤t_layer_path = this->available_layers[i].manifest_path.AbsolutePath(); - if (current_layer_path.find(layer_path) == std::string::npos) { +void LayerManager::Enable(const Path &manifest_path, bool enabled) { + auto it = this->layers_found.find(manifest_path); + if (it != this->layers_found.end()) { + it->second.enabled = enabled; + } +} + +bool operator<(const LayerDisplay &a, const LayerDisplay &b) { + if (a.key == b.key) { + return a.api_version < b.api_version; + } else { + return a.key < b.key; + } +} + +std::set LayerManager::BuildLayerDisplayList() const { + std::set result; + + for (auto it = this->layers_found.begin(), end = this->layers_found.end(); it != end; ++it) { + const Layer *layer = this->FindFromManifest(it->first, true); + if (layer == nullptr) { continue; } - result.push_back(&this->available_layers[i]); + LayerDisplay layer_display; + layer_display.key = layer->key; + layer_display.manifest_path = it->first; + layer_display.api_version = layer->api_version; + layer_display.descriptor = it->second; + + result.insert(layer_display); } return result; diff --git a/vkconfig_core/layer_manager.h b/vkconfig_core/layer_manager.h index 888c608c15..b0fd537861 100644 --- a/vkconfig_core/layer_manager.h +++ b/vkconfig_core/layer_manager.h @@ -28,6 +28,16 @@ #include #include #include +#include + +struct LayerDisplay { + std::string key; + Path manifest_path; + Version api_version; + LayerDescriptor descriptor; +}; + +bool operator<(const LayerDisplay& a, const LayerDisplay& b); class LayerManager : public Serialize { public: @@ -49,26 +59,23 @@ class LayerManager : public Serialize { Layer* FindFromManifest(const Path& manifest_path, bool find_disabled_layers = false); void LoadAllInstalledLayers(ConfiguratorMode configurator_mode); - void LoadLayersFromPath(const Path& layers_path, LayerType type, ConfiguratorMode configurator_mode); LayerLoadStatus LoadLayer(const Path& layer_path, LayerType type, ConfiguratorMode configurator_mode); - bool AreLayersEnabled(const LayersPathInfo& path_info) const; - void AppendPath(const LayersPathInfo& path_info); - void RemovePath(const LayersPathInfo& path_info); - void UpdatePathEnabled(const LayersPathInfo& path_info, LayersPaths layers_paths); - std::vector CollectManifestPaths() const; + void AppendPath(const Path& path, LayerType type, bool added = false); + void RemovePath(const Path& path); + + bool IsEnabled(const Path& manifest_path) const; + void Enable(const Path& manifest_path, bool enabled); + + std::set BuildLayerDisplayList() const; std::vector GatherLayerNames() const; - std::vector GatherLayers(const LayersPathInfo& path_info) const; std::vector available_layers; - std::array, LAYERS_PATHS_COUNT> paths; - Path last_layers_path = Path(Path::HOME); + Path last_layers_dir = Path(Path::HOME); bool validate_manifests = false; + std::map layers_found; private: - void InitSystemPaths(); - void UpdateLayersEnabled(const LayersPathInfo& path_info); - - std::map layers_found; + std::set layers_removed; }; diff --git a/vkconfig_core/registry.cpp b/vkconfig_core/registry.cpp index 4ffb93fe31..444672860c 100644 --- a/vkconfig_core/registry.cpp +++ b/vkconfig_core/registry.cpp @@ -82,7 +82,7 @@ void RemoveRegistryEntriesForLayers() { } /// Look for device specific layers -static void LoadDeviceRegistry(DEVINST id, const QString &entry, std::vector &layers_paths) { +static void LoadDeviceRegistry(DEVINST id, const QString &entry, std::vector &layers_paths) { HKEY key; if (CM_Open_DevNode_Key(id, KEY_QUERY_VALUE, 0, RegDisposition_OpenExisting, &key, CM_REGISTRY_SOFTWARE) != CR_SUCCESS) return; @@ -102,11 +102,7 @@ static void LoadDeviceRegistry(DEVINST id, const QString &entry, std::vector LoadRegistrySystemLayers(const char *input_path) { - std::vector layers_paths; +std::vector LoadRegistrySystemLayers(const char *input_path) { + std::vector layers_paths; QString path(input_path); @@ -202,27 +198,25 @@ std::vector LoadRegistrySystemLayers(const char *input_path) { return layers_paths; } -std::vector LoadRegistrySoftwareLayers(const char *path, LayerType type) { - std::vector result; +std::vector LoadRegistrySoftwareLayers(const char *path, LayerType type) { + std::vector result; QSettings settings(path, QSettings::NativeFormat); const QStringList &files = settings.allKeys(); for (int i = 0, n = files.size(); i < n; ++i) { Path path(files[i].toStdString()); - LayersPathInfo info; - info.type = type; - info.path = path.IsFile() ? path.AbsoluteDir() : path.AbsolutePath(); + Path manifest_path = path.IsFile() ? path.AbsoluteDir() : path.AbsolutePath(); - if (!path.Exists()) { + if (!manifest_path.Exists()) { continue; } - if (::Found(result, info.path)) { + if (::Found(result, manifest_path)) { continue; } - result.push_back(info); + result.push_back(manifest_path); } return result; diff --git a/vkconfig_core/registry.h b/vkconfig_core/registry.h index 735dd836f4..8a1bdc5810 100644 --- a/vkconfig_core/registry.h +++ b/vkconfig_core/registry.h @@ -33,8 +33,8 @@ void AppendRegistryEntriesForLayers(QString override_file, QString settings_file void RemoveRegistryEntriesForLayers(); -std::vector LoadRegistrySystemLayers(const char* path); +std::vector LoadRegistrySystemLayers(const char* path); -std::vector LoadRegistrySoftwareLayers(const char* path, LayerType type); +std::vector LoadRegistrySoftwareLayers(const char* path, LayerType type); #endif // VKC_ENV == VKC_ENV_WIN32 diff --git a/vkconfig_core/test/test_configuration.cpp b/vkconfig_core/test/test_configuration.cpp index 8008de56f0..5d1c485bb1 100644 --- a/vkconfig_core/test/test_configuration.cpp +++ b/vkconfig_core/test/test_configuration.cpp @@ -27,6 +27,14 @@ #include +static void InitLayer(LayerManager& layer_manager) { + const std::vector& layers_paths = ::CollectFilePaths(":/layers"); + + for (std::size_t i = 0, n = layers_paths.size(); i < n; ++i) { + layer_manager.LoadLayer(layers_paths[i], LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + } +} + static bool operator==(const Configuration& a, const Configuration& b) { if (a.key != b.key) return false; @@ -194,7 +202,7 @@ TEST(test_configuration, make_duplicate_tagged_name_mix) { TEST(test_configuration, create) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); Configuration configuration = Configuration::Create(layer_manager, "New Configuration"); @@ -214,7 +222,7 @@ TEST(test_configuration, create) { TEST(test_configuration, create_disabled) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); Configuration configuration = Configuration::CreateDisabled(layer_manager); @@ -234,7 +242,7 @@ TEST(test_configuration, create_disabled) { TEST(test_configuration, SwitchLayerVersion) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); Configuration configuration = Configuration::Create(layer_manager, "New Configuration"); for (std::size_t i = 0, n = configuration.parameters.size(); i < n; ++i) { @@ -261,7 +269,7 @@ TEST(test_configuration, SwitchLayerVersion) { TEST(test_configuration, gather_parameters_exist) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); Configuration configuration; configuration.key = "New Configuration"; @@ -294,7 +302,7 @@ TEST(test_configuration, gather_parameters_exist) { TEST(test_configuration, gather_parameters_repeat) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); Configuration configuration; configuration.key = "New Configuration"; @@ -324,11 +332,11 @@ TEST(test_configuration, gather_parameters_repeat) { TEST(test_configuration, gather_parameters_missing) { LayerManager layer_manager; + ::InitLayer(layer_manager); Configuration configuration; configuration.key = "New Configuration"; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); configuration.GatherParameters(layer_manager); layer_manager.Clear(); @@ -361,11 +369,11 @@ TEST(test_configuration, gather_parameters_missing) { TEST(test_configuration, HasMissingLayer_UnsupportPlatform) { LayerManager layer_manager; + ::InitLayer(layer_manager); Configuration configuration; configuration.key = "New Configuration"; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); configuration.GatherParameters(layer_manager); layer_manager.Clear(); @@ -381,11 +389,11 @@ TEST(test_configuration, HasMissingLayer_UnsupportPlatform) { TEST(test_configuration, HasMissingLayer_Off) { LayerManager layer_manager; + ::InitLayer(layer_manager); Configuration configuration; configuration.key = "New Configuration"; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); configuration.GatherParameters(layer_manager); layer_manager.Clear(); @@ -401,11 +409,11 @@ TEST(test_configuration, HasMissingLayer_Off) { TEST(test_configuration, gather_parameters_missing_but_unsupported_platform) { LayerManager layer_manager; + ::InitLayer(layer_manager); Configuration configuration; configuration.key = "New Configuration"; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); configuration.GatherParameters(layer_manager); layer_manager.Clear(); @@ -421,7 +429,7 @@ TEST(test_configuration, gather_parameters_missing_but_unsupported_platform) { TEST(test_configuration, Reorder_full) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); Configuration configuration = Configuration::Create(layer_manager, "New Configuration"); @@ -457,7 +465,7 @@ TEST(test_configuration, Reorder_full) { TEST(test_configuration, Reorder_partial) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); Configuration configuration = Configuration::Create(layer_manager, "New Configuration"); @@ -485,7 +493,7 @@ TEST(test_configuration, Reorder_partial) { TEST(test_configuration, Reorder_missing) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); Configuration configuration = Configuration::Create(layer_manager, "New Configuration"); @@ -515,7 +523,7 @@ TEST(test_configuration, Reorder_missing) { TEST(test_configuration, Reorder_empty) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); Configuration configuration = Configuration::Create(layer_manager, "New Configuration"); std::size_t size = configuration.parameters.size(); @@ -527,19 +535,19 @@ TEST(test_configuration, Reorder_empty) { } TEST(test_configuration, IsDefault_True) { - LayerManager layers; - layers.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + LayerManager layer_manager; + ::InitLayer(layer_manager); Configuration configuration; - const bool loaded = configuration.Load(":/configurations/Validation.json", layers); + const bool loaded = configuration.Load(":/configurations/Validation.json", layer_manager); EXPECT_TRUE(loaded); EXPECT_TRUE(configuration.IsDefault()); } TEST(test_configuration, IsDefault_False) { - LayerManager layers; - layers.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + LayerManager layer_manager; + ::InitLayer(layer_manager); - Configuration configuration = Configuration::Create(layers, "New Configuration"); + Configuration configuration = Configuration::Create(layer_manager, "New Configuration"); EXPECT_FALSE(configuration.IsDefault()); } diff --git a/vkconfig_core/test/test_configuration_built_in.cpp b/vkconfig_core/test/test_configuration_built_in.cpp index 94fcc8ab05..a0099f0edf 100644 --- a/vkconfig_core/test/test_configuration_built_in.cpp +++ b/vkconfig_core/test/test_configuration_built_in.cpp @@ -55,11 +55,17 @@ static bool operator==(const Parameter& a, const Parameter& b) { static bool operator!=(const std::vector& a, const std::vector& b) { return !(a == b); } -std::map Dummy() { return std::map(); } +static void InitLayer(LayerManager& layer_manager) { + const std::vector& layers_paths = ::CollectFilePaths(":/sdk"); + + for (std::size_t i = 0, n = layers_paths.size(); i < n; ++i) { + layer_manager.LoadLayer(layers_paths[i], LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + } +} struct TestBuilin { TestBuilin() : layer_manager() { - this->layer_manager.LoadLayersFromPath(":/sdk", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(this->layer_manager); EXPECT_TRUE(!this->layer_manager.available_layers.empty()); } diff --git a/vkconfig_core/test/test_configuration_manager.cpp b/vkconfig_core/test/test_configuration_manager.cpp index d7e9e754ca..94c35bd7a0 100644 --- a/vkconfig_core/test/test_configuration_manager.cpp +++ b/vkconfig_core/test/test_configuration_manager.cpp @@ -22,6 +22,14 @@ #include +static void InitLayer(LayerManager& layer_manager, const char* dir) { + const std::vector& layers_paths = ::CollectFilePaths(dir); + + for (std::size_t i = 0, n = layers_paths.size(); i < n; ++i) { + layer_manager.LoadLayer(layers_paths[i], LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + } +} + TEST(test_configuration_manager, init_default) { ConfigurationManager configuration_manager; @@ -35,7 +43,7 @@ TEST(test_configuration_manager, init_default) { TEST(test_configuration_manager, create_remove) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager, ":/layers"); ConfigurationManager configuration_manager; @@ -67,7 +75,7 @@ TEST(test_configuration_manager, create_remove) { TEST(test_configuration_manager, duplicate_names) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager, ":/layers"); ConfigurationManager configuration_manager; @@ -93,7 +101,7 @@ TEST(test_configuration_manager, duplicate_names) { TEST(test_configuration_manager, duplicate_object) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager, ":/layers"); ConfigurationManager configuration_manager; @@ -117,7 +125,7 @@ TEST(test_configuration_manager, duplicate_object) { TEST(test_configuration_manager, sort) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager, ":/layers"); ConfigurationManager configuration_manager; @@ -138,7 +146,7 @@ TEST(test_configuration_manager, sort) { TEST(test_configuration_manager, default_configuration) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager, ":/layers"); ConfigurationManager configuration_manager; configuration_manager.LoadDefaultConfigurations(layer_manager); @@ -149,7 +157,7 @@ TEST(test_configuration_manager, default_configuration) { TEST(test_configuration_manager, RenameConfiguration) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager, ":/layers"); ConfigurationManager configuration_manager; configuration_manager.LoadDefaultConfigurations(layer_manager); @@ -172,7 +180,7 @@ TEST(test_configuration_manager, RenameConfiguration) { TEST(test_configuration_manager, SaveConfiguration) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager, ":/layers"); ConfigurationManager configuration_manager; EXPECT_TRUE(configuration_manager.Empty()); @@ -202,7 +210,7 @@ TEST(test_configuration_manager, SaveConfiguration) { TEST(test_configuration_manager, ExportImport) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager, ":/layers"); ConfigurationManager configuration_manager; configuration_manager.LoadDefaultConfigurations(layer_manager); @@ -237,7 +245,7 @@ TEST(test_configuration_manager, UpdateConfigurations) { EXPECT_STREQ(missing_layers_init[0].c_str(), "VK_LAYER_KHRONOS_validation"); EXPECT_EQ(2, configuration_init->parameters.size()); - layer_manager.LoadLayersFromPath(":/sdk", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager, ":/sdk"); configuration_manager.UpdateConfigurations(layer_manager); std::size_t count_update = configuration_manager.available_configurations.size(); diff --git a/vkconfig_core/test/test_generate_settings.cpp b/vkconfig_core/test/test_generate_settings.cpp index d8adb545cb..309a709f4d 100644 --- a/vkconfig_core/test/test_generate_settings.cpp +++ b/vkconfig_core/test/test_generate_settings.cpp @@ -42,8 +42,7 @@ Configurator& GetTestConfigurator() { path.Create(); Configurator& configurator = Configurator::Get(); - configurator.layers.LoadLayersFromPath(":/layers/VK_LAYER_LUNARG_reference_1_2_1.json", LAYER_TYPE_EXPLICIT, - CONFIGURATOR_MODE_CMD); + configurator.layers.LoadLayer(":/layers/VK_LAYER_LUNARG_reference_1_2_1.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); configurator.configurations.CreateConfiguration(configurator.layers, "configuration"); configurator.SetActiveConfigurationName("configuration"); return configurator; diff --git a/vkconfig_core/test/test_layer.cpp b/vkconfig_core/test/test_layer.cpp index ccac948d2c..fad75dc56f 100644 --- a/vkconfig_core/test/test_layer.cpp +++ b/vkconfig_core/test/test_layer.cpp @@ -36,8 +36,6 @@ static SettingMetaString* InstantiateString(Layer& layer, const std::string& key return static_cast(layer.Instantiate(layer.settings, key, SETTING_STRING)); } -static std::map Dummy() { return std::map(); } - TEST(test_layer, collect_settings) { Layer layer; @@ -61,7 +59,7 @@ TEST(test_layer, collect_settings) { TEST(test_layer, load_header_overridden) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_00.json", LAYER_TYPE_EXPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_00.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); @@ -76,7 +74,6 @@ TEST(test_layer, load_header_overridden) { EXPECT_EQ(true, layer.enable_env.empty()); EXPECT_EQ(true, layer.enable_value.empty()); EXPECT_EQ(false, layer.is_32bits); - EXPECT_EQ(true, layer.enabled); EXPECT_STREQ("${LUNARG_SDK}/layer_dummy.html", layer.url.RelativePath(false).c_str()); EXPECT_TRUE(layer.settings.empty()); EXPECT_TRUE(layer.presets.empty()); @@ -85,7 +82,7 @@ TEST(test_layer, load_header_overridden) { TEST(test_layer, load_header_default) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_01.json", LAYER_TYPE_EXPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_01.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); @@ -104,7 +101,7 @@ TEST(test_layer, load_header_default) { TEST(test_layer, load_header_override) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_02.json", LAYER_TYPE_EXPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_02.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); @@ -117,7 +114,7 @@ TEST(test_layer, load_header_override) { TEST(test_layer, load_setting_interit) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_03.json", LAYER_TYPE_EXPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_03.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); @@ -140,7 +137,7 @@ TEST(test_layer, load_setting_interit) { TEST(test_layer, load_preset_interit) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); @@ -158,7 +155,7 @@ TEST(test_layer, load_preset_interit) { EXPECT_EQ(STATUS_ALPHA, layer.presets[2].status); const LayerLoadStatus reloaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(reloaded, LAYER_LOAD_ADDED); EXPECT_EQ(1, layer.settings.size()); EXPECT_EQ(3, layer.presets.size()); @@ -167,7 +164,7 @@ TEST(test_layer, load_preset_interit) { TEST(test_layer, load_setting_children_interit) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_05.json", LAYER_TYPE_EXPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_05.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); @@ -191,7 +188,7 @@ TEST(test_layer, load_setting_children_interit) { TEST(test_layer, load_setting_enum_interit) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_06.json", LAYER_TYPE_EXPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_06.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); @@ -234,7 +231,7 @@ TEST(test_layer, load_setting_enum_interit) { TEST(test_layer, load_setting_missing) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_07.json", LAYER_TYPE_IMPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_07.json", LAYER_TYPE_IMPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); @@ -247,7 +244,7 @@ TEST(test_layer, load_setting_missing) { EXPECT_EQ(layer_controlA, LAYER_CONTROL_ON); const LayerLoadStatus reloaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_07.json", LAYER_TYPE_IMPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_07.json", LAYER_TYPE_IMPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(1, layer.settings.size()); EXPECT_EQ(2, layer.presets.size()); } @@ -255,7 +252,7 @@ TEST(test_layer, load_setting_missing) { TEST(test_layer, load_env_variable) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_08.json", LAYER_TYPE_IMPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_08.json", LAYER_TYPE_IMPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); @@ -270,7 +267,6 @@ TEST(test_layer, load_env_variable) { EXPECT_STREQ("VK_LAYER_TEST08_ENABLE", layer.enable_env.c_str()); EXPECT_STREQ("1", layer.enable_value.c_str()); EXPECT_EQ(false, layer.is_32bits); - EXPECT_EQ(true, layer.enabled); EXPECT_STREQ("${LUNARG_SDK}/layer_dummy.html", layer.url.RelativePath(false).c_str()); EXPECT_TRUE(layer.settings.empty()); EXPECT_TRUE(layer.presets.empty()); @@ -304,7 +300,7 @@ TEST(test_layer, load_env_variable) { TEST(test_layer, load_setting_message) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_09.json", LAYER_TYPE_IMPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_09.json", LAYER_TYPE_IMPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); @@ -329,7 +325,7 @@ TEST(test_layer, load_setting_message) { TEST(test_layer, load_1_1_0_header) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_reference_1_1_0.json", LAYER_TYPE_EXPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_reference_1_1_0.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); EXPECT_EQ(Version(1, 1, 0), layer.file_format_version); @@ -348,7 +344,7 @@ TEST(test_layer, load_1_1_0_header) { TEST(test_layer, load_1_2_0_preset_and_setting_type) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_reference_1_2_0.json", LAYER_TYPE_EXPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_reference_1_2_0.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); // Preset Enum diff --git a/vkconfig_core/test/test_layer_manager.cpp b/vkconfig_core/test/test_layer_manager.cpp index 59054267a1..7e76be08e8 100644 --- a/vkconfig_core/test/test_layer_manager.cpp +++ b/vkconfig_core/test/test_layer_manager.cpp @@ -22,6 +22,14 @@ #include +static void InitLayer(LayerManager& layer_manager) { + const std::vector& layers_paths = ::CollectFilePaths(":/layers"); + + for (std::size_t i = 0, n = layers_paths.size(); i < n; ++i) { + layer_manager.LoadLayer(layers_paths[i], LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + } +} + TEST(test_layer_manager, clear) { LayerManager layer_manager; @@ -53,13 +61,12 @@ TEST(test_layer_manager, save_json) { const QJsonObject& json_layers_object = json_root_object.value("layers").toObject(); EXPECT_TRUE(json_layers_object.value("found") != QJsonValue::Undefined); - EXPECT_TRUE(json_layers_object.value("paths") != QJsonValue::Undefined); } } TEST(test_layer_manager, load_all) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); EXPECT_EQ(17, layer_manager.Size()); EXPECT_TRUE(!layer_manager.Empty()); @@ -72,7 +79,7 @@ TEST(test_layer_manager, load_dir) { LayerManager layer_manager; EXPECT_TRUE(layer_manager.Empty()); - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); EXPECT_TRUE(layer_manager.Find("VK_LAYER_LUNARG_reference_1_1_0", Version::LATEST) != nullptr); layer_manager.Clear(); @@ -85,7 +92,7 @@ TEST(test_layer_manager, load_file) { LayerManager layer_manager; EXPECT_TRUE(layer_manager.Empty()); - layer_manager.LoadLayersFromPath(":/layers/VK_LAYER_LUNARG_reference_1_1_0.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayer(":/layers/VK_LAYER_LUNARG_reference_1_1_0.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_TRUE(!layer_manager.Empty()); EXPECT_EQ(1, layer_manager.Size()); @@ -98,8 +105,8 @@ TEST(test_layer_manager, load_file) { TEST(test_layer_manager, reset) { LayerManager layer_manager; + ::InitLayer(layer_manager); - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_FALSE(layer_manager.Empty()); layer_manager.Clear(); @@ -108,7 +115,7 @@ TEST(test_layer_manager, reset) { TEST(test_layer_manager, find_single) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); EXPECT_TRUE(layer_manager.Find("VK_LAYER_LUNARG_test_03", Version::LATEST) != nullptr); @@ -119,7 +126,7 @@ TEST(test_layer_manager, find_single) { TEST(test_layer_manager, reload) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); EXPECT_TRUE(layer_manager.Size() > 1); @@ -130,7 +137,6 @@ TEST(test_layer_manager, reload) { EXPECT_EQ(status1, LAYER_LOAD_UNMODIFIED); Layer* layer1 = layer_manager.FindFromManifest(":/layers/VK_LAYER_LUNARG_test_04.json", false); - layer1->enabled = false; const std::size_t reloaded_size1 = layer_manager.Size(); EXPECT_EQ(initial_size, reloaded_size1); @@ -145,7 +151,7 @@ TEST(test_layer_manager, reload) { TEST(test_layer_manager, find_multiple) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); const Layer* layer135 = layer_manager.Find("VK_LAYER_LUNARG_version", Version(1, 1, 135)); EXPECT_TRUE(layer135 != nullptr); @@ -182,7 +188,8 @@ TEST(test_layer_manager, find_multiple) { TEST(test_layer_manager, FindLastModified) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); + const std::size_t initial_count = layer_manager.Size(); Layer* layer204_modified = layer_manager.FindFromManifest(":/layers/VK_LAYER_LUNARG_version_204.json", false); @@ -190,7 +197,12 @@ TEST(test_layer_manager, FindLastModified) { Path modified_path = layer204_modified->manifest_path; layer204_modified->manifest_path = ":/layers/VK_LAYER_LUNARG_version_204_copy.json"; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + auto it = layer_manager.layers_found.find(":/layers/VK_LAYER_LUNARG_version_204.json"); + assert(it != layer_manager.layers_found.end()); + + layer_manager.layers_found.insert(std::make_pair(":/layers/VK_LAYER_LUNARG_version_204_copy.json", it->second)); + + ::InitLayer(layer_manager); const std::size_t reloaded_count = layer_manager.Size(); EXPECT_EQ(initial_count + 1, reloaded_count); @@ -210,44 +222,41 @@ TEST(test_layer_manager, FindLastModified) { TEST(test_layer_manager, FindFromManifest) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); + const std::size_t initial_count = layer_manager.Size(); Layer* layer204 = layer_manager.FindFromManifest(":/layers/VK_LAYER_LUNARG_version_204.json", false); EXPECT_TRUE(layer204 != nullptr); EXPECT_STREQ(layer204->key.c_str(), "VK_LAYER_LUNARG_version"); EXPECT_EQ(layer204->api_version, Version(1, 3, 204)); - EXPECT_TRUE(layer204->enabled); Layer* layer208 = layer_manager.FindFromManifest(":/layers/VK_LAYER_LUNARG_version_208.json", false); EXPECT_TRUE(layer208 == nullptr); - layer204->enabled = false; + layer_manager.layers_found.find(":/layers/VK_LAYER_LUNARG_version_204.json")->second.enabled = false; + Layer* layer204_disabledA = layer_manager.FindFromManifest(":/layers/VK_LAYER_LUNARG_version_204.json", false); EXPECT_TRUE(layer204_disabledA == nullptr); Layer* layer204_disabledB = layer_manager.FindFromManifest(":/layers/VK_LAYER_LUNARG_version_204.json", true); // find disabled layers anyway EXPECT_TRUE(layer204_disabledB != nullptr); - EXPECT_FALSE(layer204_disabledB->enabled); - layer204_disabledB->enabled = true; - Layer* layer204_disabledC = layer_manager.FindFromManifest(":/layers/VK_LAYER_LUNARG_version_204.json", false); + Layer* layer204_disabledC = layer_manager.FindFromManifest(":/layers/VK_LAYER_LUNARG_version_204.json", true); EXPECT_TRUE(layer204_disabledC != nullptr); - EXPECT_TRUE(layer204_disabledC->enabled); - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); const std::size_t enabled_count = layer_manager.Size(); EXPECT_EQ(initial_count, enabled_count); - layer204->enabled = false; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); const std::size_t disabled_count = layer_manager.Size(); EXPECT_EQ(initial_count, disabled_count); } TEST(test_layer_manager, GatherManifests) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); const std::vector& versions_notfound = layer_manager.GatherManifests("VK_LAYER_LUNARG_version_not_found"); EXPECT_TRUE(versions_notfound.empty()); @@ -265,11 +274,12 @@ TEST(test_layer_manager, GatherManifests) { const Layer* layer3 = layer_manager.FindFromManifest(versions_found[3]); EXPECT_EQ(layer3->api_version, Version(1, 1, 135)); + layer_manager.layers_found.find(versions_found[2])->second.enabled = false; + const Layer* layer193 = layer_manager.Find("VK_LAYER_LUNARG_version", Version(1, 2, 193)); EXPECT_TRUE(layer193 != nullptr); Layer* layer_edit = layer_manager.FindFromManifest(layer193->manifest_path); - layer_edit->enabled = false; const std::vector& versions_found_b = layer_manager.GatherManifests("VK_LAYER_LUNARG_version"); EXPECT_FALSE(versions_found_b.empty()); @@ -284,7 +294,7 @@ TEST(test_layer_manager, GatherManifests) { TEST(test_layer_manager, GatherVersions) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); const std::vector& versions_notfound = layer_manager.GatherVersions("VK_LAYER_LUNARG_version_not_found"); EXPECT_TRUE(versions_notfound.empty()); @@ -300,8 +310,7 @@ TEST(test_layer_manager, GatherVersions) { const Layer* layer193 = layer_manager.Find("VK_LAYER_LUNARG_version", Version(1, 2, 193)); EXPECT_TRUE(layer193 != nullptr); - Layer* layer_edit = layer_manager.FindFromManifest(layer193->manifest_path); - layer_edit->enabled = false; + layer_manager.layers_found.find(layer193->manifest_path)->second.enabled = false; const std::vector& versions_found_b = layer_manager.GatherVersions("VK_LAYER_LUNARG_version"); EXPECT_FALSE(versions_found_b.empty()); @@ -313,7 +322,7 @@ TEST(test_layer_manager, GatherVersions) { TEST(test_layer_manager, BuildLayerNameList) { LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); EXPECT_EQ(layer_manager.GatherLayerNames().size(), 14); } @@ -324,80 +333,11 @@ TEST(test_layer_manager, avoid_duplicate) { LayerManager layer_manager; EXPECT_TRUE(layer_manager.Empty()); - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); std::size_t first_load_count = layer_manager.Size(); - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + ::InitLayer(layer_manager); std::size_t second_load_count = layer_manager.Size(); EXPECT_EQ(first_load_count, second_load_count); } - -TEST(test_layer_manager, custom_path_append_remove) { - LayerManager layer_manager; - - LayersPathInfo infoA; - infoA.path = ":/layers"; - LayersPathInfo infoB; - infoB.path = ":/layersB"; - LayersPathInfo infoC; - infoC.path = ":/layersC"; - - layer_manager.AppendPath(infoA); - layer_manager.AppendPath(infoB); - layer_manager.AppendPath(infoC); - - EXPECT_EQ(layer_manager.paths[LAYERS_PATHS_GUI].size(), 3); - - layer_manager.AppendPath(infoA); - EXPECT_EQ(layer_manager.paths[LAYERS_PATHS_GUI].size(), 3); - - layer_manager.RemovePath(infoA); - EXPECT_EQ(layer_manager.paths[LAYERS_PATHS_GUI].size(), 2); - - layer_manager.AppendPath(infoA); - EXPECT_EQ(layer_manager.paths[LAYERS_PATHS_GUI].size(), 3); - - layer_manager.RemovePath(infoA); - EXPECT_EQ(layer_manager.paths[LAYERS_PATHS_GUI].size(), 2); - - layer_manager.RemovePath(infoA); // Check that removing an already removed path doesn't cause any issue - EXPECT_EQ(layer_manager.paths[LAYERS_PATHS_GUI].size(), 2); - - layer_manager.RemovePath(infoB); - layer_manager.RemovePath(infoC); - - EXPECT_TRUE(layer_manager.paths[LAYERS_PATHS_GUI].empty()); -} - -TEST(test_layer_manager, custom_path_update_layers) { - LayerManager layer_manager; - layer_manager.LoadLayersFromPath(":/layers", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); - - LayersPathInfo info; - info.path = ":/layers"; - // info.enabled = true; default value - - layer_manager.AppendPath(info); - EXPECT_EQ(layer_manager.paths[LAYERS_PATHS_GUI].size(), 1); - EXPECT_EQ(layer_manager.paths[LAYERS_PATHS_GUI][0].enabled, true); - for (std::size_t i = 0, n = layer_manager.available_layers.size(); i < n; ++i) { - EXPECT_TRUE(layer_manager.available_layers[i].enabled); - } - - info.enabled = false; - layer_manager.UpdatePathEnabled(info, LAYERS_PATHS_GUI); - EXPECT_EQ(layer_manager.paths[LAYERS_PATHS_GUI][0].enabled, false); - for (std::size_t i = 0, n = layer_manager.available_layers.size(); i < n; ++i) { - EXPECT_FALSE(layer_manager.available_layers[i].enabled); - } - - info.enabled = true; - layer_manager.UpdatePathEnabled(info, LAYERS_PATHS_GUI); - EXPECT_EQ(layer_manager.paths[LAYERS_PATHS_GUI][0].enabled, true); - for (std::size_t i = 0, n = layer_manager.available_layers.size(); i < n; ++i) { - EXPECT_TRUE(layer_manager.available_layers[i].enabled); - } - - EXPECT_EQ(layer_manager.paths[LAYERS_PATHS_GUI].size(), 1); -} diff --git a/vkconfig_core/test/test_layer_preset.cpp b/vkconfig_core/test/test_layer_preset.cpp index 113e4bc202..8b5f919b49 100644 --- a/vkconfig_core/test/test_layer_preset.cpp +++ b/vkconfig_core/test/test_layer_preset.cpp @@ -26,8 +26,6 @@ #include -static std::map Dummy() { return std::map(); } - static SettingMetaString* InstantiateString(Layer& layer, const std::string& key) { return static_cast(layer.Instantiate(layer.settings, key, SETTING_STRING)); } @@ -68,7 +66,7 @@ TEST(test_layer_preset, has_preset) { TEST(test_layer_preset, find_preset_index_no_preset) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_03.json", LAYER_TYPE_EXPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_03.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); SettingDataSet layer_settings; @@ -81,7 +79,7 @@ TEST(test_layer_preset, find_preset_index_no_preset) { TEST(test_layer_preset, find_preset_index_empty) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); SettingDataSet layer_settings; @@ -92,7 +90,7 @@ TEST(test_layer_preset, find_preset_index_empty) { TEST(test_layer_preset, find_preset_index_found) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); SettingDataSet layer_settings; @@ -118,7 +116,7 @@ TEST(test_layer_preset, find_preset_index_found) { TEST(test_layer_preset, find_preset_index_missing_value) { Layer layer; const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_07.json", LAYER_TYPE_EXPLICIT, false, Dummy(), CONFIGURATOR_MODE_CMD); + layer.Load(":/layers/VK_LAYER_LUNARG_test_07.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); SettingDataSet layer_settings; diff --git a/vkconfig_core/test/test_parameter.cpp b/vkconfig_core/test/test_parameter.cpp index 25a9dfe883..2e8acb1691 100644 --- a/vkconfig_core/test/test_parameter.cpp +++ b/vkconfig_core/test/test_parameter.cpp @@ -25,10 +25,33 @@ #include -inline SettingMetaString* InstantiateString(Layer& layer, const std::string& key) { +static SettingMetaString* InstantiateString(Layer& layer, const std::string& key) { return static_cast(layer.Instantiate(layer.settings, key, SETTING_STRING)); } +static void AddLayer(LayerManager& layers, const char* key, LayerType type) { + std::string path = format("./%s.json", key); + + layers.available_layers.push_back(Layer(key, Version(1, 0, 0), Version(1, 2, 148), "1", path.c_str())); + layers.available_layers[layers.available_layers.size() - 1].manifest_path = path; + layers.available_layers[layers.available_layers.size() - 1].type = type; + + LayerDescriptor descriptor; + descriptor.type = type; + layers.layers_found.insert(std::make_pair(path, descriptor)); +} + +static void InitLayers(LayerManager& layers) { + AddLayer(layers, "VK_LAYER_KHRONOS_implicit", LAYER_TYPE_IMPLICIT); + AddLayer(layers, "VK_LAYER_KHRONOS_explicit", LAYER_TYPE_EXPLICIT); + AddLayer(layers, "VK_LAYER_KHRONOS_validation", LAYER_TYPE_EXPLICIT); + AddLayer(layers, "VK_LAYER_KHRONOS_profiles", LAYER_TYPE_EXPLICIT); + AddLayer(layers, "VK_LAYER_KHRONOS_timeline_semaphore", LAYER_TYPE_EXPLICIT); + AddLayer(layers, "VK_LAYER_KHRONOS_synchronization2", LAYER_TYPE_EXPLICIT); + AddLayer(layers, "VK_LAYER_KHRONOS_shader_object", LAYER_TYPE_EXPLICIT); + AddLayer(layers, "VK_LAYER_KHRONOS_memory_decompression", LAYER_TYPE_EXPLICIT); +} + TEST(test_parameter, apply_settings) { Layer layer; @@ -65,47 +88,40 @@ TEST(test_parameter, apply_settings) { TEST(test_parameter, ordering_found_parameter_rank) { LayerManager layers; - layers.available_layers.push_back(Layer("VK_LAYER_KHRONOS_implicit", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back(Layer("VK_LAYER_KHRONOS_explicit", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_validation", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back(Layer("VK_LAYER_KHRONOS_profiles", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_timeline_semaphore", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_synchronization2", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_shader_object", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_memory_decompression", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); + ::InitLayers(layers); + + Parameter parameter_validation("VK_LAYER_KHRONOS_validation", LAYER_CONTROL_AUTO); + EXPECT_EQ(PARAMETER_RANK_VALIDATION_LAYER, GetParameterOrdering(layers, parameter_validation)); + + Parameter parameter_profile("VK_LAYER_KHRONOS_profiles", LAYER_CONTROL_ON); + EXPECT_EQ(PARAMETER_RANK_PROFILES_LAYER, GetParameterOrdering(layers, parameter_profile)); + + Parameter parameter_timeline_semaphore("VK_LAYER_KHRONOS_timeline_semaphore", LAYER_CONTROL_OFF); + EXPECT_EQ(PARAMETER_RANK_EXTENSION_LAYER, GetParameterOrdering(layers, parameter_timeline_semaphore)); - layers.available_layers[0].type = LAYER_TYPE_IMPLICIT; + Parameter parameter_synchronization2("VK_LAYER_KHRONOS_synchronization2", LAYER_CONTROL_AUTO); + EXPECT_EQ(PARAMETER_RANK_EXTENSION_LAYER, GetParameterOrdering(layers, parameter_synchronization2)); + + Parameter parameter_shader_object("VK_LAYER_KHRONOS_shader_object", LAYER_CONTROL_ON); + EXPECT_EQ(PARAMETER_RANK_EXTENSION_LAYER, GetParameterOrdering(layers, parameter_shader_object)); + + Parameter parameter_memory_decompression("VK_LAYER_KHRONOS_memory_decompression", LAYER_CONTROL_OFF); + EXPECT_EQ(PARAMETER_RANK_EXTENSION_LAYER, GetParameterOrdering(layers, parameter_memory_decompression)); + + Parameter parameter_explicit("VK_LAYER_KHRONOS_explicit", LAYER_CONTROL_ON); + EXPECT_EQ(PARAMETER_RANK_EXPLICIT_LAYER, GetParameterOrdering(layers, parameter_explicit)); Parameter parameter_implicit("VK_LAYER_KHRONOS_implicit", LAYER_CONTROL_OFF); parameter_implicit.type = LAYER_TYPE_IMPLICIT; - - EXPECT_EQ(PARAMETER_RANK_VALIDATION_LAYER, - GetParameterOrdering(layers, Parameter("VK_LAYER_KHRONOS_validation", LAYER_CONTROL_AUTO))); - EXPECT_EQ(PARAMETER_RANK_PROFILES_LAYER, - GetParameterOrdering(layers, Parameter("VK_LAYER_KHRONOS_profiles", LAYER_CONTROL_ON))); - EXPECT_EQ(PARAMETER_RANK_EXTENSION_LAYER, - GetParameterOrdering(layers, Parameter("VK_LAYER_KHRONOS_timeline_semaphore", LAYER_CONTROL_OFF))); - EXPECT_EQ(PARAMETER_RANK_EXTENSION_LAYER, - GetParameterOrdering(layers, Parameter("VK_LAYER_KHRONOS_synchronization2", LAYER_CONTROL_AUTO))); - EXPECT_EQ(PARAMETER_RANK_EXTENSION_LAYER, - GetParameterOrdering(layers, Parameter("VK_LAYER_KHRONOS_shader_object", LAYER_CONTROL_ON))); - EXPECT_EQ(PARAMETER_RANK_EXTENSION_LAYER, - GetParameterOrdering(layers, Parameter("VK_LAYER_KHRONOS_memory_decompression", LAYER_CONTROL_OFF))); - EXPECT_EQ(PARAMETER_RANK_EXPLICIT_LAYER, - GetParameterOrdering(layers, Parameter("VK_LAYER_KHRONOS_explicit", LAYER_CONTROL_ON))); EXPECT_EQ(PARAMETER_RANK_IMPLICIT_LAYER, GetParameterOrdering(layers, parameter_implicit)); - EXPECT_EQ(PARAMETER_RANK_MISSING_LAYER, GetParameterOrdering(layers, Parameter("VK_LAYER_KHRONOS_missing", LAYER_CONTROL_OFF))); + + Parameter parameter_missing("VK_LAYER_KHRONOS_missing", LAYER_CONTROL_OFF); + EXPECT_EQ(PARAMETER_RANK_MISSING_LAYER, GetParameterOrdering(layers, parameter_missing)); } TEST(test_parameter, has_missing_layer) { LayerManager layers; - layers.available_layers.push_back(Layer("VK_LAYER_KHRONOS_implicit", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back(Layer("VK_LAYER_KHRONOS_explicit", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); + ::InitLayers(layers); std::vector parameters; parameters.push_back(Parameter("VK_LAYER_KHRONOS_implicit", LAYER_CONTROL_AUTO)); @@ -118,8 +134,7 @@ TEST(test_parameter, has_missing_layer) { TEST(test_parameter, no_missing_layer) { LayerManager layers; - layers.available_layers.push_back(Layer("VK_LAYER_KHRONOS_implicit", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back(Layer("VK_LAYER_KHRONOS_explicit", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); + ::InitLayers(layers); std::vector parameters; parameters.push_back(Parameter("VK_LAYER_KHRONOS_implicit", LAYER_CONTROL_AUTO)); @@ -132,20 +147,7 @@ TEST(test_parameter, no_missing_layer) { TEST(test_parameter, order_parameter_automatic) { LayerManager layers; - layers.available_layers.push_back(Layer("VK_LAYER_KHRONOS_implicit", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back(Layer("VK_LAYER_KHRONOS_explicit", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_validation", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back(Layer("VK_LAYER_KHRONOS_profiles", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_timeline_semaphore", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_synchronization2", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_shader_object", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_memory_decompression", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers[0].type = LAYER_TYPE_IMPLICIT; + ::InitLayers(layers); Parameter unordered_layers(::GetToken(LAYER_BUILTIN_UNORDERED), LAYER_CONTROL_AUTO); unordered_layers.builtin = LAYER_BUILTIN_UNORDERED; @@ -193,18 +195,7 @@ TEST(test_parameter, order_parameter_automatic) { TEST(test_parameter, order_parameter_manual_partial) { LayerManager layers; - layers.available_layers.push_back(Layer("VK_LAYER_KHRONOS_implicit", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back(Layer("VK_LAYER_KHRONOS_explicit", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_validation", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back(Layer("VK_LAYER_KHRONOS_profiles", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_timeline_semaphore", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_synchronization2", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_memory_decompression", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); - layers.available_layers[0].type = LAYER_TYPE_IMPLICIT; + ::InitLayers(layers); std::vector parameters; parameters.push_back(Parameter("VK_LAYER_KHRONOS_implicit", LAYER_CONTROL_AUTO)); diff --git a/vkconfig_core/type_layers_paths.cpp b/vkconfig_core/type_layers_paths.cpp index a0f607536c..11ee9a9195 100644 --- a/vkconfig_core/type_layers_paths.cpp +++ b/vkconfig_core/type_layers_paths.cpp @@ -33,7 +33,23 @@ const char* GetLabel(LayersPaths Layers_paths_type) { "Vulkan Configurator", // LAYERS_PATHS_GUI "${VULKAN_SDK}", // LAYERS_PATHS_SDK }; - static_assert(std::size(TABLE) == LAYERS_PATHS_COUNT, "The tranlation table size doesn't match the enum number of elements"); + static_assert(std::size(TABLE) == LAYERS_PATHS_COUNT); + + return TABLE[Layers_paths_type]; +} + +LayerType GetLayerType(LayersPaths Layers_paths_type) { + static LayerType TABLE[] = { + LAYER_TYPE_IMPLICIT, // LAYERS_PATHS_IMPLICIT_SYSTEM + LAYER_TYPE_IMPLICIT, // LAYERS_PATHS_IMPLICIT_ENV_SET + LAYER_TYPE_IMPLICIT, // LAYERS_PATHS_IMPLICIT_ENV_ADD + LAYER_TYPE_EXPLICIT, // LAYERS_PATHS_EXPLICIT_SYSTEM + LAYER_TYPE_EXPLICIT, // LAYERS_PATHS_EXPLICIT_ENV_SET + LAYER_TYPE_EXPLICIT, // LAYERS_PATHS_EXPLICIT_ENV_ADD + LAYER_TYPE_EXPLICIT, // LAYERS_PATHS_GUI + LAYER_TYPE_EXPLICIT, // LAYERS_PATHS_SDK + }; + static_assert(std::size(TABLE) == LAYERS_PATHS_COUNT); return TABLE[Layers_paths_type]; } diff --git a/vkconfig_core/type_layers_paths.h b/vkconfig_core/type_layers_paths.h index 2b43cfaf90..6aa990639a 100644 --- a/vkconfig_core/type_layers_paths.h +++ b/vkconfig_core/type_layers_paths.h @@ -39,3 +39,5 @@ enum LayersPaths { enum { LAYERS_PATHS_COUNT = LAYERS_PATHS_LAST - LAYERS_PATHS_FIRST + 1 }; const char* GetLabel(LayersPaths Layers_paths_type); + +LayerType GetLayerType(LayersPaths Layers_paths_type); diff --git a/vkconfig_core/type_tab.cpp b/vkconfig_core/type_tab.cpp index b7f0371080..fbde0f0fc2 100644 --- a/vkconfig_core/type_tab.cpp +++ b/vkconfig_core/type_tab.cpp @@ -26,7 +26,7 @@ const char* GetLabel(TabType type) { static const char* TOKENS[]{ "Vulkan Layers Configuration", // TAB_CONFIGURATIONS - "Vulkan Layers Paths", // TAB_LAYERS_PATHS + "Vulkan Layers Available", // TAB_LAYERS_PATHS "Vulkan Drivers", // TAB_DRIVERS "Application Launcher", // TAB_APPLICATIONS "Diagnostics", // TAB_DIAGNOSTIC diff --git a/vkconfig_gui/CHANGELOG.md b/vkconfig_gui/CHANGELOG.md index 2883004517..4bf29248e5 100644 --- a/vkconfig_gui/CHANGELOG.md +++ b/vkconfig_gui/CHANGELOG.md @@ -15,6 +15,11 @@ - Add `vkconfig.json` backup when doing a "Reset To Default" #2570 - Add "Discard Ordering and Enabling Layers" default configuration #2596 - Improve Vulkan drivers loading, add all drivers in a part at once +- Refactor layers tab to display layer sorted by name and enabling them individually +- Add layer search bar in layer tab +- Show paths instead of Vulkan Configurator variables +- Improve UI consistency +- Move 'Validate Layer Manifest' settings to the preference tab ### Fixes: - Fix command line whitespace decoding #2625 @@ -24,6 +29,8 @@ - Fix "Validation with API Dump log" configuration not loaded - Fix high CPU usage on idle when no layers configuration is active #2603 - Fix UUID display in log, following the RFC9562 standard +- Fix icon to remove a Vulkan driver +- Fix key binding shortcuts (Eg: CTRL+F to search things on various tabs) ## Vulkan Configurator 3.4.2 - Febuary 2026 [Vulkan SDK 1.4.341.0](https://github.com/LunarG/VulkanTools/tree/vulkan-sdk-1.4.341) diff --git a/vkconfig_gui/mainwindow.cpp b/vkconfig_gui/mainwindow.cpp index 224ae30588..99dd15f7a5 100644 --- a/vkconfig_gui/mainwindow.cpp +++ b/vkconfig_gui/mainwindow.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include @@ -72,6 +73,9 @@ MainWindow::MainWindow(QApplication &app, QWidget *parent) } this->ui->tab_widget->setCurrentIndex(configurator.active_tab); + this->ui->tab_widget->installEventFilter(this); + + this->connect(ui->tab_widget, SIGNAL(currentChanged(int)), this, SLOT(on_tab_widget_currentChanged(int))); this->UpdateUI(UPDATE_REBUILD_UI); @@ -384,5 +388,33 @@ void MainWindow::on_tab_widget_currentChanged(int index) { Configurator &configurator = Configurator::Get(); configurator.active_tab = static_cast(index); + switch (configurator.active_tab) { + case TAB_CONFIGURATIONS: { + } break; + case TAB_LAYERS_PATHS: { + // QShortcut *shortcut_search = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F), this->ui->tab_widget); + // this->connect(shortcut_search, SIGNAL(activated()), this, SLOT(on_focus_search())); + + // QShortcut *shortcut_open = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_O), this->ui->layers_list); + // this->connect(shortcut_open, SIGNAL(activated()), this, SLOT(on_layers_browse_pressed())); + } break; + case TAB_DRIVERS: { + // QShortcut *shortcut_search = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F), this->ui->tab_widget); + // this->connect(shortcut_search, SIGNAL(activated()), this, SLOT(on_focus_search())); + } break; + case TAB_APPLICATIONS: { + // QShortcut *shortcut_search = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F), this->ui->tab_widget); + // this->connect(shortcut_search, SIGNAL(activated()), this, SLOT(on_focus_search())); + } break; + case TAB_DIAGNOSTIC: { + } break; + case TAB_DOCUMENTATION: { + } break; + case TAB_PREFERENCES: { + } break; + case TAB_ABOUT: { + } break; + } + this->tabs[index]->UpdateUI(UPDATE_REBUILD_UI); } diff --git a/vkconfig_gui/mainwindow.ui b/vkconfig_gui/mainwindow.ui index 734d35eff6..4d5af1af73 100644 --- a/vkconfig_gui/mainwindow.ui +++ b/vkconfig_gui/mainwindow.ui @@ -128,8 +128,11 @@ true + + Check to control the Vulkan Layers used by running Vulkan Executables (Ctrl+Space) + - Control the Vulkan Layers used by running Vulkan applications + Configure System Vulkan Layers @@ -904,6 +907,13 @@ + + + Arial + 10 + true + + false @@ -913,9 +923,9 @@ Locate Vulkan Layers versions - + - 0 + 7 5 @@ -938,8 +948,11 @@ true + + List of Vulkan Layers found on the system + - System Vulkan Layers Paths + Vulkan Layers available on the system false @@ -975,7 +988,7 @@ 0 - + 16777215 @@ -989,11 +1002,31 @@ false + + Enter search text to filter layers in the list... (Ctrl+F) + + + + + + + + 24 + 24 + + + + + Arial + 10 + false + + - Check to validate the layer manifests wheen adding a user path. This may take some time... + Clear layer filter - Validate Layer Manifests + @@ -1060,7 +1093,7 @@ - Enter a Vulkan layers directory to control them in Vulkan Configurator + Add a Vulkan Layer manifests path... (Ctrl+O) @@ -1092,7 +1125,7 @@ - Append a user-defined layers path + Add Additional Layers (CTRL+O) @@ -1133,7 +1166,7 @@ - Reload all modified layer manifest + Reload all modified layer manifest (CTRL+R) @@ -1149,13 +1182,7 @@ - - - - 0 - 0 - - + Arial @@ -1166,29 +1193,9 @@ QFrame::NoFrame - - Qt::ScrollBarAlwaysOn - - - QAbstractScrollArea::AdjustToContents - true - - false - - - false - - - false - - - - 1 - - @@ -1231,8 +1238,11 @@ true + + Check to control Vulkan Physical Device used by all running Vulkan executables (Ctrl+Space) + - Control Vulkan Physical Device used by all running Vulkan applications + Configure System Vulkan Devices @@ -1245,7 +1255,7 @@ - 0 + 7 5 @@ -1349,25 +1359,6 @@ - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - @@ -1481,17 +1472,196 @@ + + + + + 0 + 0 + + + + + Arial + 10 + true + + + + Load Additional Vulkan Drivers + + + true + + + + 7 + + + 5 + + + 5 + + + 5 + + + 5 + + + + + 0 + + + 0 + + + + + + 16777215 + 24 + + + + + Arial + 10 + false + + + + Enter search text to filter drivers in the list... (Ctrl+F) + + + + + + + + 24 + 24 + + + + + + + + + + + + 16777215 + 24 + + + + + Arial + 10 + false + + + + Add Vulkan Driver manifests path... (Ctrl+O) + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + + 24 + 24 + + + + Append a user-defined driver path + + + + + + + + + + + + + Arial + 10 + false + + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOn + + + true + + + + + + + + + + + + 0 + 0 + + + + false + + + Tab 4 + + + Vulkan executable launcher + + + + 11 + + + 5 + + + 5 + + + 5 + + + 5 + - - - - 0 - 0 - - + Arial @@ -1499,15 +1669,15 @@ true - - Add Vulkan Driver Paths + + Optional use to launch executables and store launch option - - true + + Optional Vulkan executables launcher - + - 7 + 0 5 @@ -1522,165 +1692,25 @@ 5 - + 0 + + 0 + 0 + + 0 + + + 0 + - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - Enter a Vulkan Driver manifest path to make it visible to Vulkan application - - - - - - - - 0 - 0 - - - - - 24 - 24 - - - - - 24 - 24 - - - - Append a user-defined driver path - - - - - - - - - - - - - Arial - 10 - false - - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOn - - - - - - - - - - - - 0 - 0 - - - - false - - - Tab 4 - - - Vulkan executable launcher - - - - 11 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - - Arial - 10 - true - - - - - - - - 0 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - + + 0 24 @@ -1817,7 +1847,7 @@ - Options: + List of Executable Launch Options: @@ -1951,12 +1981,9 @@ 0 - + 7 - - 0 - @@ -1992,6 +2019,9 @@ false + + Enter executable arguments passed at launch... + @@ -2020,6 +2050,9 @@ false + + Enter the Vulkan executable working directory... + @@ -2121,6 +2154,9 @@ false + + Enter environment variables set at executable launch... + @@ -2149,6 +2185,9 @@ false + + Enter log file path where standard outputs is captured... + @@ -2218,7 +2257,7 @@ - 0 + 7 0 @@ -2369,6 +2408,9 @@ 24 + + Export the application output log + @@ -2388,6 +2430,9 @@ 24 + + Enter search text in the current log... (Ctrl+F) + @@ -2410,6 +2455,9 @@ 24 + + Clear the Search Text + @@ -2435,6 +2483,12 @@ 24 + + Find next (F3) + + + + @@ -2460,6 +2514,12 @@ 24 + + Find previous (Shift+F3) + + + + @@ -2485,6 +2545,12 @@ 24 + + Match case (Alt+C) + + + + @@ -2513,6 +2579,12 @@ 24 + + Match while world (Alt+W) + + + + @@ -2541,6 +2613,12 @@ 24 + + Use regular expressions (Alt+R) + + + + @@ -2645,8 +2723,11 @@ true + + Check to produce Vulkan Loader Log to all running Vulkan executables (Ctrl+Space) + - Produce Vulkan Loader Log to all running Vulkan applications + Configure System Vulkan Loader Log @@ -2659,16 +2740,16 @@ - 11 + 5 - 0 + 5 - 0 + 5 - 0 + 5 @@ -2825,16 +2906,16 @@ 0 - 0 + 5 - 0 + 5 - 0 + 5 - 0 + 5 @@ -2961,23 +3042,23 @@ false - Diagnostic Logs + Vulkan System Diagnostic Logs - 10 + 7 - 0 + 5 - 0 + 5 - 0 + 5 - 0 + 5 @@ -3226,6 +3307,9 @@ false + + Enter search text in the current log... (Ctrl+F) + @@ -3480,16 +3564,16 @@ 11 - 0 + 5 - 0 + 5 - 0 + 5 - 0 + 5 @@ -3553,7 +3637,7 @@ Tab 7 - + 11 @@ -3570,16 +3654,32 @@ 5 - + + + + 0 + 0 + + + + + Arial + 10 + true + + false - + Vulkan Configurator Settings + + + false - + - 11 + 7 5 @@ -3594,832 +3694,862 @@ 5 - - - - 0 - 0 - + + + + 16777215 + 24 + Arial 10 - true + false - - false + + Keep Vulkan Configurator running in system tray when closing the main window - - Vulkan Configurator Settings: + + + + + + 0 - - false + + 0 - - - 0 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - Keep Vulkan Configurator running in system tray when closing the main window - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - ${VULKAN_HOME} is the default environment variable for Vulkan SDK tools outputs implementing it. - + + 0 + + + 0 + + + 0 + + + + + + 16777215 + 24 + + + + + Arial + 10 + false + + + + ${VULKAN_HOME} is the default environment variable for Vulkan SDK tools outputs implementing it. + + + ${VULKAN_HOME}: + + + + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + + Arial + 10 + false + + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + Arial + 10 + false + + + + + + + + + + + + + 0 + + + 0 + + + + + + Arial + 10 + false + + + + Allows overriding Vulkan Layers only for selected Vulkan executable + + + Show "Vulkan Executables Scope" in Vulkan Layers tab + + + + + + + 0 + + + 0 + + + 0 + + + + + + 24 + 0 + + + + + + + + + + + + Arial + 10 + false + + + + All Enabled Vulkan Executables behavior: + + + + + + + + Arial + 10 + false + + + + QComboBox::AdjustToContents + + - ${VULKAN_HOME}: - - - - - - - - 0 - 24 - - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - Arial - 10 - false - + Write vk_layer_settings.txt file in the global path (visible to all Vulkan executables) + + - + Write vk_layer_settings.txt file in the application launcher working directory - - - - - - - - - Arial - 10 - false - - - - Allows overriding Vulkan Layers only for selected Vulkan executable - + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + Arial + 10 + true + + + + Vulkan Configurator Appearence + + + + 0 + + + 5 + + + 5 + + + 5 + + + 5 + + + + + 0 + + + 0 + + + 0 + + + + + + 16777215 + 24 + + + + + Arial + 10 + false + + + + Theme Mode: + + + + + + + + 0 + 0 + + + + + 16777215 + 24 + + + + + Arial + 10 + false + + + + QComboBox::AdjustToContents + + - Show "Vulkan Executables Scope" in Vulkan Layers tab - - - - - - - 0 - - - 0 - - - 0 + Use Desktop Theme - - - - - - - - - - - - Arial - 10 - false - - - - All Enabled Vulkan Executables behavior: - - - - - - - - Arial - 10 - false - - - - QComboBox::AdjustToContents - - - - Write vk_layer_settings.txt file in the global path (visible to all Vulkan executables) - - - - - Write vk_layer_settings.txt file in the application launcher working directory - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - Show debug layer settings, for layer development + + + + Force Light Theme + + - Show Debug Layer Settings + Force Dark Theme - - - - + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 24 + 24 + + + + + Arial + 10 + false + + + + + + + + + + + + 16777215 + 24 + + + + + Arial + 10 + false + + + + Use custom Dark mode alternate rows color + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 24 + 24 + + + + + Arial + 10 + false + + + + + + + + + + + + 16777215 + 24 + + + + + Arial + 10 + false + + + + Use custom Light mode alternate rows color + + + + + + + + 24 + 0 + + + + + + + + + + + + + + + + Arial + 10 + true + + + + This could be useful to check a layer manifest was edited correctly + + + Vulkan Layers Developer Settings + + + + 7 + + + 5 + + + 5 + + + 5 + + + 5 + - + Arial 10 - true + false - - Vulkan Configurator Appearence + + Check to validate the layer manifests wheen adding a user path. This may take some time... + + + Validate added layer manifests against Vulkan layer manifest schema (slow) - - - 0 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - 0 - - - 0 - - - 0 - - - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - Theme Mode: - - - - - - - - 0 - 0 - - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - QComboBox::AdjustToContents - - - - Use Desktop Theme - - - - - Force Light Theme - - - - - Force Dark Theme - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 0 - - - 0 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 24 - 24 - - - - - Arial - 10 - false - - - - - - - - - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - Use custom Dark mode alternate rows color - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 24 - 24 - - - - - Arial - 10 - false - - - - - - - - - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - Use custom Light mode alternate rows color - - - - - - - - - - - - - - - - - 0 - 0 - + + + + 16777215 + 24 + Arial 10 - true + false - - false + + Show debug layer settings, for layer development - - Vulkan SDK Releases: + + Show debug layer settings - - false + + + + + + + + + + 0 + 0 + + + + + Arial + 10 + true + + + + false + + + Vulkan SDK Releases + + + false + + + false + + + + 7 + + + 5 + + + 5 + + + 5 + + + 5 + + + + + 0 - - false + + 0 - - - 0 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - 0 - - - 0 - - - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - ${VULKAN_DOWNLOAD}: - - - - - - - - 0 - 24 - - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - 0 - - - - - - - - 0 - 24 - - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - Arial - 10 - false - - - - - - - - - - - - - - 0 - 24 - - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - Open Vulkan SDK download web page... - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - Notify new Vulkan SDK release at Vulkan Configurator launch - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 0 - - - 0 - - - - - - 0 - 24 - - - - - 16777215 - 24 - - - - - Arial - 10 - false - - - - Download last Vulkan SDK - - - - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - Arial - 10 - false - - - - Open Vulkan SDK download folder - - - - - - - - - - - - + + 7 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 16777215 + 24 + + + + + Arial + 10 + false + + + + ${VULKAN_DOWNLOAD}: + + + + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + + Arial + 10 + false + + + + 0 + + + + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + + Arial + 10 + false + + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + Arial + 10 + false + + + + + + + + + + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + + Arial + 10 + false + + + + Open Vulkan SDK download web page... + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 16777215 + 24 + + + + + Arial + 10 + false + + + + Notify new Vulkan SDK release at Vulkan Configurator launch + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + + + 0 + + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + + Arial + 10 + false + + + + Download last Vulkan SDK + + + + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + Arial + 10 + false + + + + Open Vulkan SDK download folder + + + + + + + + + @@ -4515,297 +4645,279 @@ 5 - + + + + 800 + 270 + + - false + true - - - 0 + + false + + + false + + + + + 650 + 0 + 141 + 61 + - - 5 + + - - 5 + + :/resourcefiles/lunarg_logo.png - - 5 + + Qt::NoTextInteraction - - 5 + + + + + 640 + 190 + 91 + 81 + - - - - - 800 - 270 - - - - true - - - - - - false - - - false - - - - - 640 - 20 - 141 - 61 - - - - - - - :/resourcefiles/lunarg_logo.png - - - Qt::NoTextInteraction - - - - - - 640 - 190 - 91 - 81 - - - - - - - :/resourcefiles/qt_logo.png - - - - - - 760 - 70 - 201 - 41 - - - - - Arial - 10 - false - - - - Vulkan Configurator licensed under Apache 2.0 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - 680 - 100 - 281 - 41 - - - - - Arial - 10 - false - - - - Qt::LeftToRight - - - Copyright (c) 2020-2026 LunarG, Inc. - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - 880 - 200 - 81 - 24 - - - - - 0 - 24 - - - - - 16777215 - 24 - - - - About Qt - - - - - - 730 - 230 - 231 - 41 - - - - - Arial - 10 - false - - - - Qt licensed under LGPL 3.0 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - 10 - 10 - 600 - 245 - - - - - 0 - 0 - - - - - 600 - 245 - - - - - - - :/resourcefiles/vulkan_configurator.png - - - true - - - Qt::NoTextInteraction - - - - - - 840 - 30 - 121 - 24 - - - - - 0 - 24 - - - - - 16777215 - 24 - - - - About LunarG - - - - - - 420 - 20 - 141 - 16 - - - - - Arial - 14 - true - - - - Qt::LeftToRight - - - - - - - - - - - false - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOn - - - QAbstractScrollArea::AdjustToContents - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse - - - true - - - - + + + + + :/resourcefiles/qt_logo.png + + + + + + 730 + 70 + 231 + 41 + + + + + Arial + 10 + false + + + + Licensed under Apache 2.0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + Qt::NoTextInteraction + + + + + + 660 + 100 + 301 + 41 + + + + + Arial + 10 + false + + + + Qt::LeftToRight + + + Copyright (c) 2020-2026 LunarG, Inc. + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + Qt::NoTextInteraction + + + + + + 880 + 200 + 81 + 24 + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + About Qt + + + + + + 730 + 230 + 231 + 41 + + + + + Arial + 10 + false + + + + Qt licensed under LGPL 3.0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + Qt::NoTextInteraction + + + + + + 10 + 10 + 600 + 245 + + + + + 0 + 0 + + + + + 600 + 245 + + + + + + + :/resourcefiles/vulkan_configurator.png + + + true + + + Qt::NoTextInteraction + + + + + + 840 + 30 + 121 + 24 + + + + + 0 + 24 + + + + + 16777215 + 24 + + + + About LunarG + + + + + + 420 + 20 + 141 + 16 + + + + + Arial + 14 + true + + + + Qt::LeftToRight + + + + + + + + + + + false + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOn + + + QAbstractScrollArea::AdjustToContents + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse + + + true + diff --git a/vkconfig_gui/tab_applications.cpp b/vkconfig_gui/tab_applications.cpp index e40fb1bd71..636daaa938 100644 --- a/vkconfig_gui/tab_applications.cpp +++ b/vkconfig_gui/tab_applications.cpp @@ -93,11 +93,11 @@ TabApplications::TabApplications(MainWindow &window, std::shared_ptrui->launch_log_text); this->connect(shortcut_prev, SIGNAL(activated()), this, SLOT(on_search_prev_pressed())); - QShortcut *shortcut_case = new QShortcut(QKeySequence(Qt::ALT | Qt::Key_C), this->ui->launch_log_text); + QShortcut *shortcut_case = new QShortcut(QKeySequence(Qt::ALT | Qt::Key_C), this->ui->launch_search_case); this->connect(shortcut_case, SIGNAL(activated()), this, SLOT(on_search_case_activated())); - QShortcut *shortcut_whole = new QShortcut(QKeySequence(Qt::ALT | Qt::Key_W), this->ui->launch_log_text); + QShortcut *shortcut_whole = new QShortcut(QKeySequence(Qt::ALT | Qt::Key_W), this->ui->launch_search_whole); this->connect(shortcut_whole, SIGNAL(activated()), this, SLOT(on_search_whole_activated())); - QShortcut *shortcut_regex = new QShortcut(QKeySequence(Qt::ALT | Qt::Key_R), this->ui->launch_log_text); + QShortcut *shortcut_regex = new QShortcut(QKeySequence(Qt::ALT | Qt::Key_R), this->ui->launch_search_regex); this->connect(shortcut_regex, SIGNAL(activated()), this, SLOT(on_search_regex_activated())); this->on_search_clear_pressed(); @@ -152,7 +152,7 @@ void TabApplications::UpdateUI(UpdateUIMode mode) { ui->launch_executable_list->blockSignals(true); ui->launch_executable_list->clear(); for (std::size_t i = 0, n = executables.size(); i < n; ++i) { - ui->launch_executable_list->addItem(executables[i].path.RelativePath().c_str()); + ui->launch_executable_list->addItem(executables[i].path.AbsolutePath().c_str()); } ui->launch_executable_list->setCurrentIndex(configurator.executables.GetActiveExecutableIndex()); ui->launch_executable_list->blockSignals(false); @@ -320,11 +320,11 @@ void TabApplications::on_launch_options_list_activated(int index) { const ExecutableOptions *options = executable->GetActiveOptions(); - ui->launch_options_dir_edit->setText(options->working_folder.RelativePath().c_str()); + ui->launch_options_dir_edit->setText(options->working_folder.AbsolutePath().c_str()); ui->launch_options_dir_edit->setToolTip(options->working_folder.AbsolutePath().c_str()); ui->launch_options_args_edit->setText(Merge(options->args, " ").c_str()); ui->launch_options_envs_edit->setText(Merge(options->envs, " ").c_str()); - ui->launch_options_log_edit->setText(options->log_file.RelativePath().c_str()); + ui->launch_options_log_edit->setText(options->log_file.AbsolutePath().c_str()); ui->launch_options_log_edit->setToolTip(options->log_file.AbsolutePath().c_str()); } diff --git a/vkconfig_gui/tab_configurations.cpp b/vkconfig_gui/tab_configurations.cpp index 8740e6122e..40e75bac23 100644 --- a/vkconfig_gui/tab_configurations.cpp +++ b/vkconfig_gui/tab_configurations.cpp @@ -35,6 +35,7 @@ #include #include #include +#include static std::string BuildPlatformsLog(int platforms) { std::string log; @@ -145,6 +146,10 @@ TabConfigurations::TabConfigurations(MainWindow &window, std::shared_ptrconnect(this->advanced_mode, SIGNAL(pressed()), this, SLOT(on_configurations_advanced_toggle_pressed())); + QShortcut *shortcut_override = + new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Space), this->ui->configurations_group_box_override); + this->connect(shortcut_override, SIGNAL(activated()), this, SLOT(on_configurations_override_toggled())); + this->UpdateUI(UPDATE_REBUILD_UI); } @@ -313,12 +318,17 @@ void TabConfigurations::UpdateUI_Settings(UpdateUIMode mode) { } void TabConfigurations::UpdateUI(UpdateUIMode ui_update_mode) { + const Configurator &configurator = Configurator::Get(); + + this->ui->configurations_group_box_override->blockSignals(true); + this->ui->configurations_group_box_override->setChecked(configurator.layers_override_enabled); + this->ui->configurations_group_box_override->blockSignals(false); + this->UpdateUI_Configurations(ui_update_mode); this->UpdateUI_Applications(ui_update_mode); this->UpdateUI_Layers(ui_update_mode); this->UpdateUI_Settings(ui_update_mode); - const Configurator &configurator = Configurator::Get(); const ExecutableScope scope = configurator.GetExecutableScope(); const bool enabled_executable = ::EnabledExecutables(scope); @@ -1111,6 +1121,10 @@ void TabConfigurations::on_configurations_advanced_toggle_pressed() { this->UpdateUI(UPDATE_REBUILD_UI); } +void TabConfigurations::on_configurations_override_toggled() { + this->ui->configurations_group_box_override->setChecked(!this->ui->configurations_group_box_override->isChecked()); +} + void TabConfigurations::on_configurations_override_toggled(bool checked) { Configurator &configurator = Configurator::Get(); configurator.layers_override_enabled = checked; diff --git a/vkconfig_gui/tab_configurations.h b/vkconfig_gui/tab_configurations.h index 9af22ad6ca..d6f3e984b3 100644 --- a/vkconfig_gui/tab_configurations.h +++ b/vkconfig_gui/tab_configurations.h @@ -50,6 +50,7 @@ class TabConfigurations : public Tab { public Q_SLOTS: void on_configurations_advanced_toggle_pressed(); + void on_configurations_override_toggled(); void on_configurations_override_toggled(bool checked); void on_configurations_executable_scope_currentIndexChanged(int index); void on_configurations_executable_list_currentIndexChanged(int index); diff --git a/vkconfig_gui/tab_diagnostics.cpp b/vkconfig_gui/tab_diagnostics.cpp index 237945d1f2..c26da9971c 100644 --- a/vkconfig_gui/tab_diagnostics.cpp +++ b/vkconfig_gui/tab_diagnostics.cpp @@ -60,6 +60,9 @@ TabDiagnostics::TabDiagnostics(MainWindow &window, std::shared_ptrconnect(this->ui->diagnostic_dir_system, SIGNAL(clicked()), this, SLOT(on_diagnostic_dir_system_pressed())); this->connect(this->ui->diagnostic_dir_info, SIGNAL(clicked()), this, SLOT(on_diagnostic_dir_info_pressed())); + QShortcut *shortcut_override = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Space), this->ui->diagnostic_group_box_loader_log); + this->connect(shortcut_override, SIGNAL(activated()), this, SLOT(on_diagnostic_loader_messages_toggled())); + QShortcut *shortcut_search = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F), this->ui->diagnostic_status_text); this->connect(shortcut_search, SIGNAL(activated()), this, SLOT(on_focus_search())); QShortcut *shortcut_next = new QShortcut(QKeySequence(Qt::Key_F3), this->ui->diagnostic_status_text); @@ -67,11 +70,11 @@ TabDiagnostics::TabDiagnostics(MainWindow &window, std::shared_ptrui->diagnostic_status_text); this->connect(shortcut_prev, SIGNAL(activated()), this, SLOT(on_search_prev_pressed())); - QShortcut *shortcut_case = new QShortcut(QKeySequence(Qt::ALT | Qt::Key_C), this->ui->diagnostic_status_text); + QShortcut *shortcut_case = new QShortcut(QKeySequence(Qt::ALT | Qt::Key_C), this->ui->diagnostic_search_case); this->connect(shortcut_case, SIGNAL(activated()), this, SLOT(on_search_case_activated())); - QShortcut *shortcut_whole = new QShortcut(QKeySequence(Qt::ALT | Qt::Key_W), this->ui->diagnostic_status_text); + QShortcut *shortcut_whole = new QShortcut(QKeySequence(Qt::ALT | Qt::Key_W), this->ui->diagnostic_search_whole); this->connect(shortcut_whole, SIGNAL(activated()), this, SLOT(on_search_whole_activated())); - QShortcut *shortcut_regex = new QShortcut(QKeySequence(Qt::ALT | Qt::Key_R), this->ui->diagnostic_status_text); + QShortcut *shortcut_regex = new QShortcut(QKeySequence(Qt::ALT | Qt::Key_R), this->ui->diagnostic_search_regex); this->connect(shortcut_regex, SIGNAL(activated()), this, SLOT(on_search_regex_activated())); this->ui->diagnostic_search_next->setEnabled(false); @@ -309,6 +312,10 @@ bool TabDiagnostics::EventFilter(QObject *target, QEvent *event) { return false; } +void TabDiagnostics::on_diagnostic_loader_messages_toggled() { + this->ui->diagnostic_group_box_loader_log->setChecked(!this->ui->diagnostic_group_box_loader_log->isChecked()); +} + void TabDiagnostics::on_diagnostic_loader_messages_toggled(bool checked) { Configurator &configurator = Configurator::Get(); configurator.loader_log_enabled = checked; @@ -596,9 +603,16 @@ void TabDiagnostics::on_export_file() { } } -void TabDiagnostics::on_focus_search() { this->ui->diagnostic_search_edit->setFocus(); } +void TabDiagnostics::on_focus_search() { + this->ui->diagnostic_search_edit->setFocus(); + this->ui->diagnostic_status_text->moveCursor(QTextCursor::Start); +} void TabDiagnostics::on_search_textEdited(const QString &text) { + if (!this->ui->diagnostic_search_clear->isEnabled()) { + this->ui->diagnostic_status_text->moveCursor(QTextCursor::Start); + } + this->ui->diagnostic_search_next->setEnabled(!this->ui->diagnostic_search_edit->text().isEmpty()); this->ui->diagnostic_search_prev->setEnabled(!this->ui->diagnostic_search_edit->text().isEmpty()); @@ -608,7 +622,10 @@ void TabDiagnostics::on_search_textEdited(const QString &text) { void TabDiagnostics::on_search_clear_pressed() { this->diagnostic_search_text.clear(); + this->ui->diagnostic_export_file->setEnabled(false); this->ui->diagnostic_search_edit->clear(); + this->ui->diagnostic_search_next->setEnabled(false); + this->ui->diagnostic_search_prev->setEnabled(false); this->ui->diagnostic_search_clear->setEnabled(false); } @@ -667,7 +684,7 @@ void TabDiagnostics::on_context_menu(const QPoint &pos) { menu->addSeparator(); QAction *action_search = new QAction("Search...", nullptr); - action_search->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_F)); + // action_search->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_F)); action_search->setEnabled(true); menu->addAction(action_search); diff --git a/vkconfig_gui/tab_diagnostics.h b/vkconfig_gui/tab_diagnostics.h index 811a03a2b4..244eaab6cd 100644 --- a/vkconfig_gui/tab_diagnostics.h +++ b/vkconfig_gui/tab_diagnostics.h @@ -59,6 +59,7 @@ class TabDiagnostics : public Tab { void on_search_whole_activated(); void on_search_regex_activated(); + void on_diagnostic_loader_messages_toggled(); void on_diagnostic_loader_messages_toggled(bool checked); void on_diagnostic_loader_errors_toggled(bool checked); void on_diagnostic_loader_warns_toggled(bool checked); diff --git a/vkconfig_gui/tab_drivers.cpp b/vkconfig_gui/tab_drivers.cpp index bd5ea20060..a8895afed4 100644 --- a/vkconfig_gui/tab_drivers.cpp +++ b/vkconfig_gui/tab_drivers.cpp @@ -25,12 +25,12 @@ #include "style.h" #include "../vkconfig_core/configurator.h" +#include "../vkconfig_core/json.h" #include +#include TabDrivers::TabDrivers(MainWindow &window, std::shared_ptr ui) : Tab(TAB_DRIVERS, window, ui) { - this->ui->drivers_device_list->installEventFilter(&window); - Configurator &configurator = Configurator::Get(); if (configurator.vulkan_system_info.loaderVersion < Version(1, 4, 322) && false) { @@ -43,8 +43,24 @@ TabDrivers::TabDrivers(MainWindow &window, std::shared_ptr ui) : this->connect(this->ui->driver_forced_name, SIGNAL(currentIndexChanged(int)), this, SLOT(on_driver_name_changed(int))); this->connect(this->ui->driver_group_box_paths, SIGNAL(toggled(bool)), this, SLOT(on_driver_paths_toggled(bool))); - this->connect(this->ui->driver_browse_button, SIGNAL(clicked()), this, SLOT(on_driver_browse_pressed())); - this->connect(this->ui->driver_path_lineedit, SIGNAL(returnPressed()), this, SLOT(on_driver_append_pressed())); + this->connect(this->ui->driver_browse, SIGNAL(clicked()), this, SLOT(on_driver_browse_pressed())); + this->connect(this->ui->driver_path, SIGNAL(returnPressed()), this, SLOT(on_driver_append_pressed())); + + this->connect(this->ui->driver_search, SIGNAL(textEdited(QString)), this, SLOT(on_search_textEdited(QString))); + this->connect(this->ui->driver_search, SIGNAL(returnPressed()), this, SLOT(on_search_next_pressed())); + this->connect(this->ui->driver_search_clear, SIGNAL(clicked()), this, SLOT(on_search_clear_pressed())); + + QShortcut *shortcut_override = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Space), this->ui->driver_group_box_override); + this->connect(shortcut_override, SIGNAL(activated()), this, SLOT(on_driver_override_toggled())); + + QShortcut *shortcut_search = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F), this->ui->driver_paths_list); + this->connect(shortcut_search, SIGNAL(activated()), this, SLOT(on_focus_search())); + QShortcut *shortcut_browse = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_O), this->ui->driver_paths_list); + this->connect(shortcut_browse, SIGNAL(activated()), this, SLOT(on_driver_browse_pressed())); + + // this->ui->driver_group_box_override->installEventFilter(&window); + this->ui->drivers_device_list->installEventFilter(&window); + this->ui->driver_paths_list->installEventFilter(&window); this->UpdateUI(UPDATE_REBUILD_UI); } @@ -54,6 +70,9 @@ TabDrivers::~TabDrivers() {} void TabDrivers::UpdateUI(UpdateUIMode ui_update_mode) { Configurator &configurator = Configurator::Get(); + this->ui->driver_search_clear->setEnabled(!this->ui->driver_search->text().isEmpty()); + this->ui->driver_search->setFocus(); + switch (ui_update_mode) { case UPDATE_REFRESH_UI: case UPDATE_REBUILD_UI: { @@ -131,14 +150,23 @@ void TabDrivers::UpdateUI(UpdateUIMode ui_update_mode) { } this->ui->driver_group_box_paths->blockSignals(true); - this->ui->driver_group_box_paths->setChecked(configurator.driver_paths_enabled); + this->ui->driver_group_box_paths->setChecked(configurator.driver_paths_enabled && configurator.driver_override_enabled); this->ui->driver_group_box_paths->blockSignals(false); this->ui->driver_paths_list->clear(); - this->ui->driver_path_lineedit->setText(configurator.last_driver_dir.RelativePath().c_str()); this->ui->driver_paths_list->blockSignals(true); for (auto it = configurator.driver_paths.begin(); it != configurator.driver_paths.end(); ++it) { + if (!this->driver_filter.empty()) { + const std::string text = it->first.AbsolutePath(); + + std::string lower_text = ::ToLowerCase(text); + std::string driver_filter_search = ::ToLowerCase(this->driver_filter); + if (lower_text.find(driver_filter_search.c_str()) == std::string::npos) { + continue; + } + } + QListWidgetItem *item_state = new QListWidgetItem; item_state->setFlags(item_state->flags() | Qt::ItemIsSelectable); item_state->setSizeHint(QSize(0, ITEM_HEIGHT)); @@ -190,12 +218,38 @@ bool TabDrivers::EventFilter(QObject *target, QEvent *event) { return false; } +void TabDrivers::on_focus_search() { this->ui->driver_search->setFocus(); } + +void TabDrivers::on_search_textEdited(const QString &text) { + this->driver_filter = text.toStdString(); + + this->ui->driver_search_clear->setEnabled(!text.isEmpty()); + + this->UpdateUI(UPDATE_REBUILD_UI); +} + +void TabDrivers::on_search_clear_pressed() { + this->driver_filter.clear(); + + this->ui->driver_search->clear(); + this->ui->driver_search_clear->setEnabled(false); + + this->UpdateUI(UPDATE_REBUILD_UI); +} + +void TabDrivers::on_search_next_pressed() {} + +void TabDrivers::on_driver_override_toggled() { + this->ui->driver_group_box_override->setChecked(!this->ui->driver_group_box_override->isChecked()); +} + void TabDrivers::on_driver_override_toggled(bool checked) { Configurator &configurator = Configurator::Get(); + int index = std::max(this->ui->driver_forced_name->currentIndex(), 0); + configurator.driver_override_enabled = checked; - configurator.driver_override_info = - ::GetDeviceInfo(configurator.vulkan_system_info.physicalDevices[this->ui->driver_forced_name->currentIndex()]); + configurator.driver_override_info = ::GetDeviceInfo(configurator.vulkan_system_info.physicalDevices[index]); configurator.Override(OVERRIDE_AREA_LOADER_SETTINGS_BIT); this->UpdateUI(UPDATE_REBUILD_UI); @@ -244,7 +298,7 @@ void TabDrivers::on_paths_toggled() { void TabDrivers::on_driver_append_pressed() { Configurator &configurator = Configurator::Get(); - const Path &selected_path = this->ui->driver_path_lineedit->text().toStdString(); + const Path &selected_path = this->ui->driver_path->text().toStdString(); if (selected_path.Empty()) { return; @@ -277,16 +331,41 @@ void TabDrivers::on_driver_append_pressed() { void TabDrivers::on_driver_browse_pressed() { Configurator &configurator = Configurator::Get(); - const Path &selected_path = - QFileDialog::getExistingDirectory(this->ui->driver_browse_button, "Adding Driver Manifests Directory...", - configurator.last_driver_dir.AbsolutePath().c_str()) - .toStdString(); + const Path &selected_path = QFileDialog::getExistingDirectory(this->ui->driver_browse, "Adding Driver Manifests Directory...", + configurator.last_driver_dir.AbsolutePath().c_str()) + .toStdString(); if (selected_path.Empty()) { return; } + /* + QJsonDocument document = ParseJsonFile(selected_path.AbsolutePath().c_str()); + if (document.isNull() || document.isEmpty()) { + QMessageBox alert; + alert.setWindowTitle("Could not open the JSON file"); + alert.setText("The path"); + alert.setInformativeText(selected_path.AbsolutePath().c_str()); + alert.setStandardButtons(QMessageBox::Ok); + alert.setDefaultButton(QMessageBox::Ok); + alert.setIcon(QMessageBox::Warning); + alert.exec(); + return; + } - this->ui->driver_path_lineedit->setText(selected_path.AbsolutePath().c_str()); + const QJsonObject& json_root_object = document.object(); + if (json_root_object.value("ICD") == QJsonValue::Undefined) { + QMessageBox alert; + alert.setWindowTitle("Could not open the JSON file"); + alert.setText("The path"); + alert.setInformativeText(selected_path.AbsolutePath().c_str()); + alert.setStandardButtons(QMessageBox::Ok); + alert.setDefaultButton(QMessageBox::Ok); + alert.setIcon(QMessageBox::Warning); + alert.exec(); + return; + } + */ + this->ui->driver_path->setText(selected_path.AbsolutePath().c_str()); this->on_driver_append_pressed(); } diff --git a/vkconfig_gui/tab_drivers.h b/vkconfig_gui/tab_drivers.h index 5b3d0078c3..f2372e6a11 100644 --- a/vkconfig_gui/tab_drivers.h +++ b/vkconfig_gui/tab_drivers.h @@ -38,12 +38,19 @@ class TabDrivers : public Tab { void on_driver_mode_changed(int index); void on_driver_name_changed(int index); + void on_driver_override_toggled(); void on_driver_paths_toggled(bool checked); void on_paths_changed(); void on_paths_toggled(); void on_driver_append_pressed(); void on_driver_browse_pressed(); + void on_focus_search(); + void on_search_textEdited(const QString &text); + void on_search_clear_pressed(); + void on_search_next_pressed(); + private: std::string new_path; + std::string driver_filter; }; diff --git a/vkconfig_gui/tab_layers.cpp b/vkconfig_gui/tab_layers.cpp index fefd77001e..cc1fdc751c 100644 --- a/vkconfig_gui/tab_layers.cpp +++ b/vkconfig_gui/tab_layers.cpp @@ -28,6 +28,8 @@ #include #include +#include +#include #include #include @@ -38,13 +40,25 @@ TabLayers::TabLayers(MainWindow &window, std::shared_ptr ui) : T this->ui->layers_progress->setValue(0); this->ui->layers_progress->setVisible(false); this->ui->layers_path_lineedit->setVisible(true); - this->ui->layers_path_lineedit->setText(configurator.layers.last_layers_path.RelativePath().c_str()); - this->ui->layers_validate_checkBox->setChecked(configurator.layers.validate_manifests); + this->ui->layers_search_clear->setEnabled(false); this->connect(this->ui->layers_browse_button, SIGNAL(clicked()), this, SLOT(on_layers_browse_pressed())); this->connect(this->ui->layers_reload_button, SIGNAL(clicked()), this, SLOT(on_layers_reload_pressed())); this->connect(this->ui->layers_path_lineedit, SIGNAL(returnPressed()), this, SLOT(on_layers_append_pressed())); - this->connect(this->ui->layers_validate_checkBox, SIGNAL(toggled(bool)), this, SLOT(on_layers_validate_checkBox_toggled(bool))); + + this->connect(this->ui->layers_search, SIGNAL(textEdited(QString)), this, SLOT(on_search_textEdited(QString))); + this->connect(this->ui->layers_search_clear, SIGNAL(clicked()), this, SLOT(on_search_clear_pressed())); + + QShortcut *shortcut_search = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F), this->ui->layers_list); + this->connect(shortcut_search, SIGNAL(activated()), this, SLOT(on_focus_search())); + QShortcut *shortcut_browse = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_O), this->ui->layers_list); + this->connect(shortcut_browse, SIGNAL(activated()), this, SLOT(on_layers_browse_pressed())); + QShortcut *shortcut_reload = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_R), this->ui->layers_list); + this->connect(shortcut_reload, SIGNAL(activated()), this, SLOT(on_layers_reload_pressed())); + + // this->ui->layers_browse_button->installEventFilter(&window); + // this->ui->layers_reload_button->installEventFilter(&window); + this->ui->layers_list->installEventFilter(&window); } TabLayers::~TabLayers() {} @@ -54,87 +68,63 @@ void TabLayers::UpdateUI_LayersPaths(UpdateUIMode ui_update_mode) { Configurator &configurator = Configurator::Get(); - this->ui->layers_paths_tree->blockSignals(true); + this->ui->layers_list->blockSignals(true); switch (ui_update_mode) { case UPDATE_REBUILD_UI: { - this->ui->layers_paths_tree->clear(); - for (std::size_t group_index = configurator.layers.paths.size(); group_index > 0; --group_index) { - const LayersPaths group_path = static_cast(group_index - 1); - - std::vector &paths_group = configurator.layers.paths[group_path]; - for (std::size_t i = 0, n = paths_group.size(); i < n; ++i) { - const std::string &layer_path = paths_group[i].path.AbsolutePath(); - const std::vector &manifest_paths = CollectFilePaths(layer_path); - /* - if (group_path != LAYERS_PATHS_GUI) { - if (manifest_paths.empty()) { - continue; - } - } - */ - QTreeWidgetItem *item_state = new QTreeWidgetItem; - item_state->setFlags(item_state->flags() | Qt::ItemIsSelectable); - item_state->setSizeHint(0, QSize(0, ITEM_HEIGHT)); - LayersPathWidget *layer_path_widget = - new LayersPathWidget(paths_group[i], group_path, group_path == LAYERS_PATHS_GUI); - this->connect(layer_path_widget, SIGNAL(itemChanged()), this, SLOT(on_paths_changed())); - this->connect(layer_path_widget, SIGNAL(itemToggled()), this, SLOT(on_paths_toggled())); - - ui->layers_paths_tree->addTopLevelItem(item_state); - ui->layers_paths_tree->setItemWidget(item_state, 0, layer_path_widget); - - for (std::size_t manifest_index = 0, manifest_count = manifest_paths.size(); manifest_index < manifest_count; - ++manifest_index) { - const Layer *layer = configurator.layers.FindFromManifest(manifest_paths[manifest_index], true); - if (layer == nullptr) { - continue; // When the directory has JSON files that are not layer manifest - } - - std::string label = layer->key; - - if (layer->is_32bits) { - label += " (32 bits)"; - } - - label += " - " + layer->api_version.str(); - - if (layer->status != STATUS_STABLE) { - label += format(" (%s)", GetToken(layer->status)); - } - - // label += " - " + layer->manifest_path.AbsolutePath(); - - QTreeWidgetItem *item = new QTreeWidgetItem; - item->setText(0, label.c_str()); - item->setToolTip(0, layer->manifest_path.AbsolutePath().c_str()); - item->setDisabled(!paths_group[i].enabled); - item_state->addChild(item); + this->ui->layers_list->clear(); + + const std::set &layer_display_list = configurator.layers.BuildLayerDisplayList(); + + for (auto it = layer_display_list.begin(), end = layer_display_list.end(); it != end; ++it) { + const Layer *layer = configurator.layers.FindFromManifest(it->manifest_path, true); + if (layer == nullptr) { + continue; + } + + if (!this->layer_filter.empty()) { + const std::string status = layer->status == STATUS_STABLE ? "" : format(" (%s)", ::GetToken(layer->status)); + const std::string text = format("%s - %s%s, %s layer", layer->key.c_str(), layer->api_version.str().c_str(), + status.c_str(), ::GetToken(layer->type)); + + std::string lower_text = ::ToLowerCase(text); + std::string layer_filter_search = ::ToLowerCase(this->layer_filter); + if (lower_text.find(layer_filter_search.c_str()) == std::string::npos) { + continue; } } - } - this->ui->layers_paths_tree->expandAll(); - } break; - case UPDATE_REFRESH_UI: { - for (int i = 0; i < this->ui->layers_paths_tree->topLevelItemCount(); ++i) { - QTreeWidgetItem *item = this->ui->layers_paths_tree->topLevelItem(i); - LayersPathWidget *widget = static_cast(ui->layers_paths_tree->itemWidget(item, 0)); - - for (int i = 0; i < item->childCount(); ++i) { - QTreeWidgetItem *child_item = item->child(i); - child_item->setDisabled(!widget->isChecked()); + QListWidgetItem *item = new QListWidgetItem; + item->setFlags(item->flags() | Qt::ItemIsSelectable); + item->setSizeHint(QSize(0, ITEM_HEIGHT)); + + LayerWidget *layer_widget = new LayerWidget(layer); + layer_widget->setChecked(it->descriptor.enabled); + if (it->descriptor.added) { + QPalette palette = layer_widget->palette(); + palette.setColor(QPalette::Active, QPalette::WindowText, QColor(255, 0, 0)); + layer_widget->setPalette(palette); } + + this->connect(layer_widget, SIGNAL(itemChanged()), this, SLOT(on_paths_changed())); + this->connect(layer_widget, SIGNAL(itemToggled()), this, SLOT(on_paths_toggled())); + + ui->layers_list->addItem(item); + ui->layers_list->setItemWidget(item, layer_widget); } } break; + default: { + } break; } - this->ui->layers_paths_tree->blockSignals(false); + this->ui->layers_list->blockSignals(false); } void TabLayers::UpdateUI(UpdateUIMode ui_update_mode) { const Configurator &configurator = Configurator::Get(); + this->ui->layers_search_clear->setEnabled(!this->ui->layers_search->text().isEmpty()); + this->ui->layers_search->setFocus(); this->ui->layers_progress->resetFormat(); this->ui->layers_progress->setValue(0); @@ -168,11 +158,6 @@ void TabLayers::on_paths_toggled() { this->UpdateUI_LayersPaths(UPDATE_REFRESH_UI); } -void TabLayers::on_layers_validate_checkBox_toggled(bool checked) { - Configurator &configurator = Configurator::Get(); - configurator.layers.validate_manifests = checked; -} - void TabLayers::on_layers_append_pressed() { this->LoadLayersManifest(this->ui->layers_path_lineedit->text()); } void TabLayers::on_layers_browse_pressed() { @@ -180,11 +165,30 @@ void TabLayers::on_layers_browse_pressed() { const QString selected_path = QFileDialog::getExistingDirectory(this->ui->layers_browse_button, "Select Layer Manifests Folder...", - configurator.layers.last_layers_path.AbsolutePath().c_str()); + configurator.layers.last_layers_dir.AbsolutePath().c_str()); this->LoadLayersManifest(selected_path); } +void TabLayers::on_focus_search() { this->ui->layers_search->setFocus(); } + +void TabLayers::on_search_textEdited(const QString &text) { + this->layer_filter = text.toStdString(); + + this->ui->layers_search_clear->setEnabled(!text.isEmpty()); + + this->UpdateUI_LayersPaths(UPDATE_REBUILD_UI); +} + +void TabLayers::on_search_clear_pressed() { + this->layer_filter.clear(); + + this->ui->layers_search->clear(); + this->ui->layers_search_clear->setEnabled(false); + + this->UpdateUI_LayersPaths(UPDATE_REBUILD_UI); +} + void TabLayers::on_layers_reload_pressed() { this->ui->layers_path_lineedit->setVisible(false); this->ui->layers_browse_button->setVisible(false); @@ -196,13 +200,11 @@ void TabLayers::on_layers_reload_pressed() { std::vector layers_count(LAYER_LOAD_COUNT, 0); - LayersPathInfo info; - info.path = new_path; - configurator.layers.AppendPath(info); - configurator.layers.UpdatePathEnabled(info, LAYERS_PATHS_GUI); + const std::vector &layers_paths = ::CollectFilePaths(new_path); - const std::vector layers_paths = - new_path.Empty() ? configurator.layers.CollectManifestPaths() : ::CollectFilePaths(new_path); + for (std::size_t i = 0, n = layers_paths.size(); i < n; ++i) { + configurator.layers.AppendPath(layers_paths[i], LAYER_TYPE_EXPLICIT, true); + } this->ui->layers_progress->setMaximum(static_cast(layers_paths.size())); this->ui->layers_progress->setValue(0); @@ -224,7 +226,7 @@ void TabLayers::on_layers_reload_pressed() { configurator.UpdateConfigurations(); configurator.Override(OVERRIDE_AREA_ALL); - std::string last_layers_path = configurator.layers.last_layers_path.AbsolutePath(); + std::string last_layers_path = configurator.layers.last_layers_dir.AbsolutePath(); if (!configurator.Get(HIDE_MESSAGE_NOTIFICATION_LAYERS_LOADED)) { std::string text = "Loading and reloading all located layers manifests:\n"; @@ -255,8 +257,10 @@ void TabLayers::LoadLayersManifest(const QString &selected_path) { Configurator &configurator = Configurator::Get(); if (!selected_path.isEmpty()) { - configurator.layers.last_layers_path = selected_path.toStdString(); - this->ui->layers_path_lineedit->setText(configurator.layers.last_layers_path.AbsolutePath().c_str()); + configurator.layers.last_layers_dir = selected_path.toStdString(); + if (!configurator.layers.last_layers_dir.Empty()) { + this->ui->layers_path_lineedit->setText(configurator.layers.last_layers_dir.AbsolutePath().c_str()); + } this->on_layers_reload_pressed(); diff --git a/vkconfig_gui/tab_layers.h b/vkconfig_gui/tab_layers.h index 7513a62b6f..aa55c1b3b8 100644 --- a/vkconfig_gui/tab_layers.h +++ b/vkconfig_gui/tab_layers.h @@ -38,11 +38,16 @@ class TabLayers : public Tab { public Q_SLOTS: void on_paths_changed(); void on_paths_toggled(); - void on_layers_validate_checkBox_toggled(bool checked); void on_layers_append_pressed(); void on_layers_browse_pressed(); void on_layers_reload_pressed(); + void on_focus_search(); + void on_search_textEdited(const QString &text); + void on_search_clear_pressed(); + private: void LoadLayersManifest(const QString &selected_path); + + std::string layer_filter; }; diff --git a/vkconfig_gui/tab_preferences.cpp b/vkconfig_gui/tab_preferences.cpp index 4424fbb397..e9cb33fa8b 100644 --- a/vkconfig_gui/tab_preferences.cpp +++ b/vkconfig_gui/tab_preferences.cpp @@ -48,6 +48,7 @@ TabPreferences::TabPreferences(MainWindow &window, std::shared_ptrconnect(this->ui->preferences_vk_download_open, SIGNAL(clicked()), this, SLOT(on_vk_download_open_pressed())); this->connect(this->ui->preferences_reset, SIGNAL(clicked()), this, SLOT(on_reset_hard_pressed())); this->connect(this->ui->preferences_show_debug_settings, SIGNAL(toggled(bool)), this, SLOT(on_layer_debug_mode_toggled(bool))); + this->connect(this->ui->preferences_validate_layer, SIGNAL(toggled(bool)), this, SLOT(on_layer_validate_toggled(bool))); this->connect(this->ui->preferences_open_page, SIGNAL(clicked()), this, SLOT(on_open_page_pressed())); this->connect(this->ui->preferences_notify_releases, SIGNAL(toggled(bool)), this, SLOT(on_notify_releases_toggled(bool))); this->connect(this->ui->preferences_download, SIGNAL(clicked()), this, SLOT(on_download_pressed())); @@ -85,8 +86,8 @@ TabPreferences::TabPreferences(MainWindow &window, std::shared_ptrui->preferences_progress->setVisible(false); this->ui->preferences_notify_releases->setChecked(configurator.GetUseNotifyReleases()); - this->ui->preferences_download->setText("Searching Latest Vulkan SDK..."); + this->ui->preferences_validate_layer->setChecked(configurator.layers.validate_manifests); #if WORKAROUND_WINARM_RELEASE_NOTIFICATION_BUG // Windows ARM crash, it looks like a Qt bug in 6.8.2... @@ -170,11 +171,13 @@ void TabPreferences::on_theme_mode_changed(int index) { this->ui->configurations_settings_reset->setIcon(::Get(new_theme_mode, ::ICON_RELOAD)); // Drivers - this->ui->driver_browse_button->setIcon(::Get(new_theme_mode, ::ICON_FOLDER_SEARCH)); + this->ui->driver_browse->setIcon(::Get(new_theme_mode, ::ICON_FOLDER_SEARCH)); + this->ui->driver_search_clear->setIcon(::Get(new_theme_mode, ::ICON_EXIT)); // Layers this->ui->layers_browse_button->setIcon(::Get(new_theme_mode, ::ICON_FOLDER_SEARCH)); this->ui->layers_reload_button->setIcon(::Get(new_theme_mode, ::ICON_FOLDER_RELOAD)); + this->ui->layers_search_clear->setIcon(::Get(new_theme_mode, ::ICON_EXIT)); // Applications this->ui->launch_executable_search->setIcon(::Get(new_theme_mode, ::ICON_FILE_SEARCH)); @@ -259,7 +262,8 @@ void TabPreferences::on_theme_mode_changed(int index) { this->ui->configurations_list->setPalette(palette); this->ui->configurations_settings->setPalette(palette); this->ui->configurations_layers_list->setPalette(palette); - this->ui->layers_paths_tree->setPalette(palette); + this->ui->layers_list->setPalette(palette); + this->ui->driver_paths_list->setPalette(palette); delete dummy_widget; } @@ -431,6 +435,11 @@ void TabPreferences::on_notify_releases_toggled(bool checked) { configurator.SetUseNotifyReleases(checked); } +void TabPreferences::on_layer_validate_toggled(bool checked) { + Configurator &configurator = Configurator::Get(); + configurator.layers.validate_manifests = checked; +} + void TabPreferences::on_layer_debug_mode_toggled(bool checked) { Configurator &configurator = Configurator::Get(); configurator.SetUseLayerDebugMode(checked); diff --git a/vkconfig_gui/tab_preferences.h b/vkconfig_gui/tab_preferences.h index 62431c434a..7bfa93543a 100644 --- a/vkconfig_gui/tab_preferences.h +++ b/vkconfig_gui/tab_preferences.h @@ -45,6 +45,7 @@ class TabPreferences : public Tab { void on_vk_download_browse_pressed(); void on_vk_download_open_pressed(); void on_reset_hard_pressed(); + void on_layer_validate_toggled(bool checked); void on_layer_debug_mode_toggled(bool checked); void on_open_page_pressed(); void on_download_pressed(); diff --git a/vkconfig_gui/widget_tab_driver_path.cpp b/vkconfig_gui/widget_tab_driver_path.cpp index 650bba6866..7d5e4b97b9 100644 --- a/vkconfig_gui/widget_tab_driver_path.cpp +++ b/vkconfig_gui/widget_tab_driver_path.cpp @@ -32,10 +32,10 @@ DriverPathWidget::DriverPathWidget(const Path& path, bool enabled) : path(path), const Configurator& configurator = Configurator::Get(); this->buttom_remove = new QPushButton(this); - this->buttom_remove->setIcon(::Get(configurator.current_theme_mode, ::ICON_FOLDER_REMOVE)); + this->buttom_remove->setIcon(::Get(configurator.current_theme_mode, ::ICON_FILE_REMOVE)); this->buttom_remove->setFixedSize(24, 24); - this->setText(format("%s", this->path.RelativePath().c_str()).c_str()); + this->setText(format("%s", this->path.AbsolutePath().c_str()).c_str()); this->setToolTip(format("%s", this->path.AbsolutePath().c_str()).c_str()); this->connect(this, SIGNAL(toggled(bool)), this, SLOT(on_toggled(bool))); diff --git a/vkconfig_gui/widget_tab_layers_path.cpp b/vkconfig_gui/widget_tab_layers_path.cpp index 8b3503e4da..d4b84eea4d 100644 --- a/vkconfig_gui/widget_tab_layers_path.cpp +++ b/vkconfig_gui/widget_tab_layers_path.cpp @@ -26,29 +26,27 @@ #include #include -LayersPathWidget::LayersPathWidget(const LayersPathInfo& path_info, LayersPaths layers_path, bool removabled) - : layers_path(layers_path), path_info(path_info) { - this->setChecked(this->path_info.enabled); - +LayerWidget::LayerWidget(const Layer* layer) + : layer_key(layer->key), api_version(layer->api_version), manifest_path(layer->manifest_path) { const Configurator& configurator = Configurator::Get(); + const std::string status = layer->status == STATUS_STABLE ? "" : format(" (%s)", ::GetToken(layer->status)); + const std::string text = format("%s - %s%s, %s layer", layer->key.c_str(), layer->api_version.str().c_str(), status.c_str(), + ::GetToken(layer->type)); + + this->setText(text.c_str()); + this->setToolTip(format("%s", manifest_path.AbsolutePath().c_str()).c_str()); + this->buttom_remove = new QPushButton(this); this->buttom_remove->setIcon(::Get(configurator.current_theme_mode, ::ICON_FOLDER_REMOVE)); - this->buttom_remove->setToolTip("Only layer paths manually added with Vulkan Configurator can be removed."); + this->buttom_remove->setToolTip("Remove the Vulkan layer from Vulkan Configurator"); this->buttom_remove->setFixedSize(24, 24); - this->buttom_remove->setEnabled(layers_path == LAYERS_PATHS_GUI); - - if (!removabled) { - this->buttom_remove->hide(); - } - - this->setText(format("[%s] %s", GetLabel(layers_path), path_info.path.AbsolutePath().c_str()).c_str()); this->connect(this, SIGNAL(toggled(bool)), this, SLOT(on_toggled(bool))); this->connect(this->buttom_remove, SIGNAL(clicked(bool)), this, SLOT(on_buttom_remove_clicked(bool))); } -void LayersPathWidget::resizeEvent(QResizeEvent* event) { +void LayerWidget::resizeEvent(QResizeEvent* event) { QSize size = event->size(); const QFontMetrics fm = this->buttom_remove->fontMetrics(); @@ -58,20 +56,22 @@ void LayersPathWidget::resizeEvent(QResizeEvent* event) { this->buttom_remove->setGeometry(remove_button_rect); } -void LayersPathWidget::on_buttom_remove_clicked(bool checked) { +void LayerWidget::on_buttom_remove_clicked(bool checked) { (void)checked; Configurator& configurator = Configurator::Get(); if (!(configurator.Get(HIDE_MESSAGE_QUESTION_REMOVING_LAYERS_PATH))) { QMessageBox alert; - alert.setWindowTitle("Removing a layers path..."); + alert.setWindowTitle(format("Removing %s %s layer...", this->layer_key.c_str(), this->api_version.str().c_str()).c_str()); alert.setIcon(QMessageBox::Question); alert.setDefaultButton(QMessageBox::No); alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No); alert.setCheckBox(new QCheckBox("Do not show again.")); - alert.setText(format("Are you sure you want to remove the following path from %s?", VKCONFIG_NAME).c_str()); - alert.setInformativeText(this->path_info.path.AbsolutePath().c_str()); + alert.setText(format("Are you sure you want to remove %s %s from %s?", this->layer_key.c_str(), + this->api_version.str().c_str(), VKCONFIG_NAME) + .c_str()); + alert.setInformativeText(format("The layer is located: %s", this->manifest_path.AbsolutePath().c_str()).c_str()); int ret_val = alert.exec(); if (alert.checkBox()->isChecked()) { configurator.Set(HIDE_MESSAGE_QUESTION_REMOVING_LAYERS_PATH); @@ -81,21 +81,14 @@ void LayersPathWidget::on_buttom_remove_clicked(bool checked) { } } - configurator.layers.RemovePath(this->path_info); - - this->path_info.path.Clear(); + configurator.layers.RemovePath(this->manifest_path); emit itemChanged(); } -void LayersPathWidget::on_toggled(bool checked) { - // Check the path is not removed - if (!this->path_info.path.Empty()) { - this->path_info.enabled = checked; - - Configurator& configurator = Configurator::Get(); - configurator.layers.UpdatePathEnabled(this->path_info, this->layers_path); +void LayerWidget::on_toggled(bool checked) { + Configurator& configurator = Configurator::Get(); + configurator.layers.Enable(this->manifest_path, checked); - emit itemToggled(); - } + emit itemToggled(); } diff --git a/vkconfig_gui/widget_tab_layers_path.h b/vkconfig_gui/widget_tab_layers_path.h index 83f20332b2..d91da0f0e3 100644 --- a/vkconfig_gui/widget_tab_layers_path.h +++ b/vkconfig_gui/widget_tab_layers_path.h @@ -27,11 +27,11 @@ #include #include -class LayersPathWidget : public QCheckBox { +class LayerWidget : public QCheckBox { Q_OBJECT public: - LayersPathWidget(const LayersPathInfo &path_info, LayersPaths layers_path, bool removabled); + LayerWidget(const Layer *layer); protected: void resizeEvent(QResizeEvent *event) override; @@ -45,7 +45,8 @@ class LayersPathWidget : public QCheckBox { void itemToggled(); public: - LayersPaths layers_path; - LayersPathInfo path_info; + std::string layer_key; + Version api_version; + Path manifest_path; QPushButton *buttom_remove = nullptr; }; From 907ed5a91f40a9bf3585d4087bc6c53b51b4ae16 Mon Sep 17 00:00:00 2001 From: Christophe Date: Tue, 31 Mar 2026 13:46:26 +0200 Subject: [PATCH 14/14] vkconfig: Fix mix layer and icd manifest --- vkconfig_cmd/main_layers.cpp | 2 +- vkconfig_core/configuration.h | 5 - vkconfig_core/configurator.cpp | 90 +++- vkconfig_core/layer.cpp | 261 +++++----- vkconfig_core/layer.h | 37 +- vkconfig_core/layer_manager.cpp | 446 ++++++++++++------ vkconfig_core/layer_manager.h | 41 +- vkconfig_core/path.cpp | 60 +++ vkconfig_core/path.h | 6 + vkconfig_core/test/test_configuration.cpp | 2 +- .../test/test_configuration_built_in.cpp | 2 +- .../test/test_configuration_manager.cpp | 2 +- vkconfig_core/test/test_generate_settings.cpp | 2 +- vkconfig_core/test/test_layer.cpp | 91 ++-- vkconfig_core/test/test_layer_manager.cpp | 33 +- vkconfig_core/test/test_layer_preset.cpp | 29 +- vkconfig_core/test/test_parameter.cpp | 24 +- vkconfig_gui/CHANGELOG.md | 2 + vkconfig_gui/mainwindow.ui | 56 ++- vkconfig_gui/tab_configurations.cpp | 15 +- vkconfig_gui/tab_drivers.cpp | 14 +- vkconfig_gui/tab_layers.cpp | 70 ++- vkconfig_gui/tab_layers.h | 1 + vkconfig_gui/widget_tab_layers_path.cpp | 31 +- vkconfig_gui/widget_tab_layers_path.h | 6 +- 25 files changed, 886 insertions(+), 442 deletions(-) diff --git a/vkconfig_cmd/main_layers.cpp b/vkconfig_cmd/main_layers.cpp index 674844bed7..d1daeccfcf 100644 --- a/vkconfig_cmd/main_layers.cpp +++ b/vkconfig_cmd/main_layers.cpp @@ -92,7 +92,7 @@ static int RunLayersPath(Configurator& configurator, const CommandLine& command_ const std::set& layer_display_list = configurator.layers.BuildLayerDisplayList(); for (auto it = layer_display_list.begin(), end = layer_display_list.end(); it != end; ++it) { - const Layer* layer = configurator.layers.FindFromManifest(it->manifest_path, true); + const Layer* layer = configurator.layers.FindFromManifest(it->id.manifest_path, true); if (layer == nullptr) { continue; } diff --git a/vkconfig_core/configuration.h b/vkconfig_core/configuration.h index 9a17aeae39..eb29465b7a 100644 --- a/vkconfig_core/configuration.h +++ b/vkconfig_core/configuration.h @@ -62,12 +62,7 @@ class Configuration { LayerControl default_control = LAYER_CONTROL_AUTO; bool override_settings = false; Path override_settings_path; - // bool override_layers = true; // Keep or not ? std::string selected_layer_name; - // bool override_driver = false; - // std::string override_driver_name = DEFAULT_PHYSICAL_DEVICE; - // bool override_loader = true; - // int loader_log_messages_flags = GetBit(LOG_ERROR); std::vector parameters; diff --git a/vkconfig_core/configurator.cpp b/vkconfig_core/configurator.cpp index 07541c7d2d..23ac737beb 100644 --- a/vkconfig_core/configurator.cpp +++ b/vkconfig_core/configurator.cpp @@ -1116,7 +1116,41 @@ bool Configurator::Load() { // TAB_LAYERS_PATHS if (json_interface_object.value(GetToken(TAB_LAYERS_PATHS)) != QJsonValue::Undefined) { const QJsonObject& json_object = json_interface_object.value(GetToken(TAB_LAYERS_PATHS)).toObject(); - (void)json_object; + if (json_object.value("last_driver_dir") != QJsonValue::Undefined) { + this->layers.last_layers_dir = json_object.value("last_driver_dir").toString().toStdString(); + } + if (json_object.value("validate_manifests") != QJsonValue::Undefined) { + this->layers.validate_manifests = json_object.value("validate_manifests").toBool(); + } + if (json_object.value("layers") != QJsonValue::Undefined) { + const QJsonObject& json_object_paths = json_object.value("layers").toObject(); + QStringList keys = json_object_paths.keys(); + for (std::size_t i = 0, n = keys.size(); i < n; ++i) { + const QJsonArray& json_descriptors = json_object_paths.value(keys[i]).toArray(); + + std::vector descriptors; + for (std::size_t j = 0, o = json_descriptors.size(); j < o; ++j) { + const QJsonObject& json_descriptor_object = json_descriptors[j].toObject(); + + LayerDisplay display; + display.id.key = json_descriptor_object.value("key").toString().toStdString(); + display.id.manifest_path = keys[i].toStdString(); + display.id.api_version = Version::NONE; + display.descriptor.enabled = json_descriptor_object.value("enabled").toBool(); + display.descriptor.removed = json_descriptor_object.value("removed").toBool(); + display.descriptor.validated = json_descriptor_object.value("validated").toBool(); + descriptors.push_back(display); + } + + this->layers.AppendInit(Path(keys[i].toStdString()), descriptors); + } + } + if (json_object.value("paths") != QJsonValue::Undefined) { + const QJsonArray& json_paths = json_object.value("paths").toArray(); + for (std::size_t i = 0, n = json_paths.size(); i < n; ++i) { + this->layers.gui_added_layers_paths.insert(json_paths[i].toString().toStdString()); + } + } } // TAB_DRIVERS @@ -1199,6 +1233,10 @@ bool Configurator::Load() { if (json_interface_object.value(GetToken(TAB_PREFERENCES)) != QJsonValue::Undefined) { const QJsonObject& json_object = json_interface_object.value(GetToken(TAB_PREFERENCES)).toObject(); + if (json_object.value("validate_manifests") != QJsonValue::Undefined) { + this->layers.validate_manifests = json_object.value("validate_manifests").toBool(); + } + if (json_object.value("use_notify_releases") != QJsonValue::Undefined) { this->use_notify_releases = json_object.value("use_notify_releases").toBool(); } @@ -1311,7 +1349,55 @@ bool Configurator::Save() const { } // TAB_LAYERS_PATHS - {} + { + std::map> data = this->layers.BuildLayerStoreList(); + + QJsonObject json_layers; + for (auto it = data.begin(); it != data.end(); ++it) { + std::map descriptors = it->second; + + QJsonArray json_layer_descriptors; + + bool is_user_added_path = + this->layers.gui_added_layers_paths.find(it->first.AbsoluteDir()) != this->layers.gui_added_layers_paths.end(); + + bool keep = false; // Only remember paths that don't have all layer removed + + for (auto jt = it->second.begin(); jt != it->second.end(); ++jt) { + if (!jt->second.descriptor.removed) { + keep = true; + } + + QJsonObject json_descriptor; + json_descriptor.insert("key", jt->first.c_str()); + json_descriptor.insert("validated", jt->second.descriptor.validated); + json_descriptor.insert("enabled", jt->second.descriptor.enabled); + json_descriptor.insert("removed", jt->second.descriptor.removed); + + json_layer_descriptors.append(json_descriptor); + } + + if (is_user_added_path) { + if (keep) { + json_layers.insert(it->first.AbsolutePath().c_str(), json_layer_descriptors); + } + } else { + json_layers.insert(it->first.AbsolutePath().c_str(), json_layer_descriptors); + } + } + + QJsonArray json_paths; + for (auto it = this->layers.gui_added_layers_paths.begin(); it != this->layers.gui_added_layers_paths.end(); ++it) { + json_paths.append(it->AbsolutePath().c_str()); + } + + QJsonObject json_object; + json_object.insert("paths", json_paths); + json_object.insert("layers", json_layers); + json_object.insert("validate_manifests", this->layers.validate_manifests); + json_object.insert("last_driver_dir", this->layers.last_layers_dir.AbsolutePath().c_str()); + json_interface_object.insert(::GetToken(TAB_LAYERS_PATHS), json_object); + } // TAB_DRIVER { diff --git a/vkconfig_core/layer.cpp b/vkconfig_core/layer.cpp index a1cb6238e9..8d7c89c2cc 100644 --- a/vkconfig_core/layer.cpp +++ b/vkconfig_core/layer.cpp @@ -33,7 +33,6 @@ #include "util.h" #include "path.h" #include "json.h" -#include "json_validator.h" #include "is_dll_32.h" #include "configurator.h" @@ -42,36 +41,22 @@ #include #include #include -#include -#include #include #include #include -bool Found(const std::vector& data, const Path& path) { - for (std::size_t i = 0, n = data.size(); i < n; ++i) { - if (data[i] == path) { - return true; - } - } - - return false; -} - Layer::Layer() : status(STATUS_STABLE), platforms(PLATFORM_DESKTOP_BIT) {} Layer::Layer(const std::string& key) : key(key), status(STATUS_STABLE), platforms(PLATFORM_DESKTOP_BIT) {} -Layer::Layer(const std::string& key, const Version& file_format_version, const Version& api_version, - const std::string& implementation_version, const std::string& library_path) - : key(key), - file_format_version(file_format_version), - binary_path(library_path), - api_version(api_version), - implementation_version(implementation_version), - status(STATUS_STABLE), - platforms(PLATFORM_DESKTOP_BIT) {} +LayerId Layer::GetId() const { + LayerId id; + id.manifest_path = this->manifest_path; + id.key = this->key; + id.api_version = this->api_version; + return id; +} bool Layer::IsValid() const { return file_format_version != Version::NONE && !key.empty() && !binary_path.Empty() && api_version != Version::NONE && @@ -176,71 +161,7 @@ void Layer::FillPresetSettings(SettingDataSet& settings_data, const std::vector< } } -LayerLoadStatus Layer::Load(const Path& full_path_to_file, LayerType type, bool request_validate_manifest, - ConfiguratorMode configurator_mode) { - this->type = type; // Set layer type, no way to know this from the json file - - if (full_path_to_file.Empty()) { - return LAYER_LOAD_IGNORED; - } - - QFile file(full_path_to_file.AbsolutePath().c_str()); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - return LAYER_LOAD_FAILED; - } - - QString json_text = file.readAll(); - file.close(); - - this->manifest_path = full_path_to_file; - this->last_modified = full_path_to_file.LastModified(); - - // Convert the text to a JSON document & validate it. - // It does need to be a valid json formatted file. - QJsonParseError json_parse_error; - const QJsonDocument& json_document = QJsonDocument::fromJson(json_text.toUtf8(), &json_parse_error); - if (json_parse_error.error != QJsonParseError::NoError) { - return LAYER_LOAD_FAILED; - } - - // Make sure it's not empty - if (json_document.isNull() || json_document.isEmpty()) { - return LAYER_LOAD_FAILED; - } - - // First check it's a layer manifest, ignore otherwise. - const QJsonObject& json_root_object = json_document.object(); - if (json_root_object.value("file_format_version") == QJsonValue::Undefined) { - return LAYER_LOAD_IGNORED; // Not a layer JSON file - } - if (json_root_object.value("layer") == QJsonValue::Undefined) { - return LAYER_LOAD_IGNORED; // Not a layer JSON file - } - - this->file_format_version = ReadVersionValue(json_root_object, "file_format_version"); - if (this->file_format_version.GetMajor() > 1) { - switch (configurator_mode) { - default: { - } break; - case CONFIGURATOR_MODE_GUI: { - QMessageBox alert; - alert.setWindowTitle("Failed to load a layer manifest..."); - alert.setText(format("Unsupported layer file format: %s.", this->file_format_version.str().c_str()).c_str()); - alert.setInformativeText( - format("The %s layer is being ignored.", full_path_to_file.AbsolutePath().c_str()).c_str()); - alert.setIcon(QMessageBox::Critical); - alert.exec(); - } break; - case CONFIGURATOR_MODE_CMD: { - fprintf(stderr, "vkconfig: [ERROR] Unsupported layer file format: %s\n", this->file_format_version.str().c_str()); - fprintf(stderr, "\n (%s layer is ignored\n)", full_path_to_file.AbsolutePath().c_str()); - } break; - } - return LAYER_LOAD_INVALID; - } - - const QJsonObject& json_layer_object = ReadObject(json_root_object, "layer"); - +LayerLoadStatus Layer::Load(const QJsonObject& json_layer_object) { this->key = ReadStringValue(json_layer_object, "name"); if (this->key == "VK_LAYER_LUNARG_override" || !(this->key.rfind("VK_", 0) == 0)) { @@ -249,50 +170,6 @@ LayerLoadStatus Layer::Load(const Path& full_path_to_file, LayerType type, bool this->api_version = ReadVersionValue(json_layer_object, "api_version"); - JsonValidator validator; - - const bool is_valid = request_validate_manifest ? validator.Check(json_text) : true; - - if (!is_valid) { - switch (configurator_mode) { - default: { - } break; - case CONFIGURATOR_MODE_GUI: { - QMessageBox alert; - alert.setWindowTitle("Failed to load a layer manifest..."); - alert.setText(format("%s is not a valid layer file", full_path_to_file.AbsolutePath().c_str()).c_str()); - alert.setInformativeText("Do you want to save the validation log?"); - alert.setIcon(QMessageBox::Critical); - alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - alert.setDefaultButton(QMessageBox::Yes); - int result = alert.exec(); - if (result == QMessageBox::Yes) { - const QString& selected_path = QFileDialog::getSaveFileName( - nullptr, format("Export %s validation log", full_path_to_file.AbsolutePath().c_str()).c_str(), - (AbsolutePath(Path::HOME) + "/" + full_path_to_file.Basename() + "_log.txt").c_str(), "Log(*.txt)"); - QFile log_file(selected_path); - const bool result = log_file.open(QIODevice::WriteOnly | QIODevice::Text); - if (result) { - QDesktopServices::openUrl(QUrl::fromLocalFile(selected_path)); - log_file.write(validator.message.toStdString().c_str()); - log_file.close(); - } else { - QMessageBox alert; - alert.setWindowTitle("Failed to save layer manifest log..."); - alert.setText(format("Couldn't not open %s file...", selected_path.toStdString().c_str()).c_str()); - alert.setIcon(QMessageBox::Critical); - alert.exec(); - } - } - } break; - case CONFIGURATOR_MODE_CMD: { - fprintf(stderr, "vkconfig: [ERROR] Couldn't validate layer file: %s\n", full_path_to_file.AbsolutePath().c_str()); - fprintf(stderr, "\n%s\n)", validator.message.toStdString().c_str()); - } break; - } - return LAYER_LOAD_INVALID; - } - const QJsonValue& json_library_path_value = json_layer_object.value("library_path"); if (json_library_path_value != QJsonValue::Undefined) { this->binary_path = json_library_path_value.toString().toStdString(); @@ -301,7 +178,7 @@ LayerLoadStatus Layer::Load(const Path& full_path_to_file, LayerType type, bool const Path& binary = this->manifest_path.AbsoluteDir() + "/" + this->binary_path.AbsolutePath(); if (::IsDLL32Bit(binary.AbsolutePath())) { this->is_32bits = true; - return LAYER_LOAD_INVALID; + return LAYER_LOAD_IGNORED; } if (json_layer_object.value("prefix") != QJsonValue::Undefined) { @@ -390,9 +267,127 @@ LayerLoadStatus Layer::Load(const Path& full_path_to_file, LayerType type, bool } } - return this->IsValid() ? LAYER_LOAD_ADDED : LAYER_LOAD_INVALID; // Not all JSON file are layer JSON valid + return this->IsValid() ? LAYER_LOAD_ADDED : LAYER_LOAD_INVALID; } +/* +LayerLoadStatus Layer::Load(const Path& full_path_to_file, LayerType type, ConfiguratorMode configurator_mode) { + this->type = type; // Set layer type, no way to know this from the json file + + if (full_path_to_file.Empty()) { + return LAYER_LOAD_IGNORED; + } + + QFile file(full_path_to_file.AbsolutePath().c_str()); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + return LAYER_LOAD_FAILED; + } + + QString json_text = file.readAll(); + file.close(); + + this->manifest_path = full_path_to_file; + this->last_modified = full_path_to_file.LastModified(); + + // Convert the text to a JSON document & validate it. + // It does need to be a valid json formatted file. + QJsonParseError json_parse_error; + const QJsonDocument& json_document = QJsonDocument::fromJson(json_text.toUtf8(), &json_parse_error); + if (json_parse_error.error != QJsonParseError::NoError) { + return LAYER_LOAD_FAILED; + } + + // Make sure it's not empty + if (json_document.isNull() || json_document.isEmpty()) { + return LAYER_LOAD_FAILED; + } + + // First check it's a layer manifest, ignore otherwise. + const QJsonObject& json_root_object = json_document.object(); + if (json_root_object.value("file_format_version") == QJsonValue::Undefined) { + return LAYER_LOAD_IGNORED; // Not a layer JSON file + } + if (json_root_object.value("layer") == QJsonValue::Undefined && json_root_object.value("layers") == QJsonValue::Undefined) { + return LAYER_LOAD_IGNORED; // Not a layer JSON file + } + + this->file_format_version = ReadVersionValue(json_root_object, "file_format_version"); + if (this->file_format_version.GetMajor() > 1) { + switch (configurator_mode) { + default: { + } break; + case CONFIGURATOR_MODE_GUI: { + QMessageBox alert; + alert.setWindowTitle("Failed to load a layer manifest..."); + alert.setText(format("Unsupported layer file format: %s.", this->file_format_version.str().c_str()).c_str()); + alert.setInformativeText( + format("The %s layer is being ignored.", full_path_to_file.AbsolutePath().c_str()).c_str()); + alert.setIcon(QMessageBox::Critical); + alert.exec(); + } break; + case CONFIGURATOR_MODE_CMD: { + fprintf(stderr, "vkconfig: [ERROR] Unsupported layer file format: %s\n", this->file_format_version.str().c_str()); + fprintf(stderr, "\n (%s layer is ignored\n)", full_path_to_file.AbsolutePath().c_str()); + } break; + } + return LAYER_LOAD_INVALID; + } + + JsonValidator validator; + + const bool is_valid = request_validate_manifest ? validator.Check(json_text) : true; + if (!is_valid) { + switch (configurator_mode) { + default: { + } break; + case CONFIGURATOR_MODE_GUI: { + QMessageBox alert; + alert.setWindowTitle("Failed to load a layer manifest..."); + alert.setText(format("%s is not a valid layer file", full_path_to_file.AbsolutePath().c_str()).c_str()); + alert.setInformativeText("Do you want to save the validation log?"); + alert.setIcon(QMessageBox::Critical); + alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No); + alert.setDefaultButton(QMessageBox::Yes); + int result = alert.exec(); + if (result == QMessageBox::Yes) { + const QString& selected_path = QFileDialog::getSaveFileName( + nullptr, format("Export %s validation log", full_path_to_file.AbsolutePath().c_str()).c_str(), + (AbsolutePath(Path::HOME) + "/" + full_path_to_file.Basename() + "_log.txt").c_str(), "Log(*.txt)"); + QFile log_file(selected_path); + const bool result = log_file.open(QIODevice::WriteOnly | QIODevice::Text); + if (result) { + QDesktopServices::openUrl(QUrl::fromLocalFile(selected_path)); + log_file.write(validator.message.toStdString().c_str()); + log_file.close(); + } else { + QMessageBox alert; + alert.setWindowTitle("Failed to save layer manifest log..."); + alert.setText(format("Couldn't not open %s file...", selected_path.toStdString().c_str()).c_str()); + alert.setIcon(QMessageBox::Critical); + alert.exec(); + } + } + } break; + case CONFIGURATOR_MODE_CMD: { + fprintf(stderr, "vkconfig: [ERROR] Couldn't validate layer file: %s\n", full_path_to_file.AbsolutePath().c_str()); + fprintf(stderr, "\n%s\n)", validator.message.toStdString().c_str()); + } break; + } + return LAYER_LOAD_INVALID; + } + + if (json_root_object.value("layers") == QJsonValue::Undefined) { + const QJsonArray& json_layers_array = json_root_object.value("layers").toArray(); + for (int i = 0, n = json_layers_array.size(); i < n; ++i) { + const QJsonObject& json_layer_object = json_layers_array[i].toObject(); + return this->LoadLayer(json_layer_object); + } + } else { + const QJsonObject& json_layer_object = ReadObject(json_root_object, "layer"); + return this->LoadLayer(json_layer_object); + } +} +*/ bool operator<(const Layer& layer_a, const Layer& layer_b) { if (layer_a.key == layer_b.key) { return layer_a.api_version < layer_b.api_version; diff --git a/vkconfig_core/layer.h b/vkconfig_core/layer.h index c4b64734b2..cf50a1f12c 100644 --- a/vkconfig_core/layer.h +++ b/vkconfig_core/layer.h @@ -36,21 +36,10 @@ #include #include -struct LayerDescriptor { - LayerType type = LAYER_TYPE_EXPLICIT; - std::string last_modified; - bool validated = false; - bool enabled = true; - bool added = false; -}; - -bool Found(const std::vector& data, const Path& path); - enum LayerLoadStatus { LAYER_LOAD_ADDED = 0, LAYER_LOAD_RELOADED, LAYER_LOAD_UNMODIFIED, - LAYER_LOAD_FAILED, LAYER_LOAD_INVALID, LAYER_LOAD_IGNORED, @@ -58,20 +47,29 @@ enum LayerLoadStatus { LAYER_LOAD_LAST = LAYER_LOAD_IGNORED, }; -inline bool IsEnabled(LayerLoadStatus status) { - return !(status == LAYER_LOAD_FAILED || status == LAYER_LOAD_INVALID || status == LAYER_LOAD_IGNORED); -} - enum { LAYER_LOAD_COUNT = LAYER_LOAD_LAST - LAYER_LOAD_FIRST + 1 }; +struct LayerId { + Path manifest_path; + std::string key; + Version api_version; +}; + +struct LayerDescriptor { + bool validated = false; + bool enabled = true; + bool removed = false; + bool recent = false; +}; + class Layer { public: enum { NO_PRESET = -1, DEFAULT_PRESET = 0 }; Layer(); Layer(const std::string& key); - Layer(const std::string& key, const Version& file_format_version, const Version& api_version, - const std::string& implementation_version, const std::string& library_path); + + LayerId GetId() const; bool IsValid() const; @@ -113,8 +111,9 @@ class Layer { std::vector settings; std::vector presets; - LayerLoadStatus Load(const Path& full_path_to_file, LayerType type, bool request_validate_manifest, - ConfiguratorMode configurator_mode); + LayerLoadStatus Load(const QJsonObject& json_layer_object); + + LayerDescriptor descriptor; private: Layer& operator=(const Layer&) = delete; diff --git a/vkconfig_core/layer_manager.cpp b/vkconfig_core/layer_manager.cpp index 8c5e3cdb0b..1750a56522 100644 --- a/vkconfig_core/layer_manager.cpp +++ b/vkconfig_core/layer_manager.cpp @@ -22,8 +22,11 @@ #include "util.h" #include "type_platform.h" #include "registry.h" +#include "json_validator.h" #include +#include +#include static std::vector GetEnvVariablePaths(const char *variable_name, LayerType type) { std::vector result; @@ -149,7 +152,6 @@ LayerManager::LayerManager() {} bool LayerManager::Load(const QJsonObject &json_root_object, ConfiguratorMode configurator_mode) { this->available_layers.clear(); - this->layers_found.clear(); // LAYERS_PATHS_GUI if (json_root_object.value("layers") != QJsonValue::Undefined) { @@ -170,26 +172,14 @@ bool LayerManager::Load(const QJsonObject &json_root_object, ConfiguratorMode co for (int i = 0, n = json_layers_found_keys.length(); i < n; ++i) { const QJsonObject &json_status_object = json_layers_found_object.value(json_layers_found_keys[i]).toObject(); - LayerDescriptor descriptor; - if (json_status_object.value("type") != QJsonValue::Undefined) { - descriptor.type = ::GetLayerType(json_status_object.value("type").toString().toStdString().c_str()); - } - descriptor.last_modified = json_status_object.value("last_modified").toString().toStdString(); - descriptor.validated = json_status_object.value("validated").toBool(); - if (json_status_object.value("enabled") != QJsonValue::Undefined) { - descriptor.enabled = json_status_object.value("enabled").toBool(); - } - - const Path &manifest_path = json_layers_found_keys[i].toStdString(); + LayerDisplay layer; + layer.id.manifest_path = json_layers_found_keys[i].toStdString(); + layer.descriptor.enabled = !json_status_object.value("disabled").toBool(); + layer.descriptor.validated = json_status_object.value("validated").toBool(); - this->layers_found.insert(std::make_pair(manifest_path, descriptor)); - } - } - - if (json_layers_object.value("removed") != QJsonValue::Undefined) { - const QJsonArray &array = json_layers_object.value("removed").toArray(); - for (int i = 0, n = array.size(); i < n; ++i) { - this->layers_removed.insert(array[i].toString().toStdString()); + std::vector layers; + layers.push_back(layer); + this->AppendInit(layer.id.manifest_path, layers); } } } @@ -200,27 +190,12 @@ bool LayerManager::Load(const QJsonObject &json_root_object, ConfiguratorMode co } bool LayerManager::Save(QJsonObject &json_root_object) const { - QJsonObject json_layers_found_object; - for (auto it = this->layers_found.begin(); it != this->layers_found.end(); ++it) { - QJsonObject object; - object.insert("last_modified", it->second.last_modified.c_str()); - object.insert("type", ::GetToken(it->second.type)); - object.insert("validated", it->second.validated); - object.insert("enabled", it->second.enabled); - json_layers_found_object.insert(it->first.AbsolutePath().c_str(), object); - } - - QJsonArray json_layers_removed_array; - for (auto it = this->layers_removed.begin(); it != this->layers_removed.end(); ++it) { - json_layers_removed_array.append(it->AbsolutePath().c_str()); - } - QJsonObject json_layers_object; json_layers_object.insert("validate_manifests", this->validate_manifests); json_layers_object.insert("last_layers_dir", this->last_layers_dir.RelativePath().c_str()); - json_layers_object.insert("found", json_layers_found_object); - json_layers_object.insert("removed", json_layers_removed_array); - json_root_object.insert("layers", json_layers_object); + // json_layers_object.insert("found", json_layers_found_object); + // json_layers_object.insert("removed", json_layers_removed_array); + // json_root_object.insert("layers", json_layers_object); return true; } @@ -231,15 +206,7 @@ std::string LayerManager::Log() const { for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { const Layer *layer = &this->available_layers[i]; - auto it = this->layers_found.find(layer->manifest_path); - if (it == this->layers_found.end()) { - assert(0); - continue; - } - - const LayerDescriptor &descriptor = it->second; - - if (descriptor.type == LAYER_TYPE_IMPLICIT) { + if (layer->type == LAYER_TYPE_IMPLICIT) { log += format(" * %s - %s (Auto: %s)", layer->key.c_str(), layer->api_version.str().c_str(), GetLabel(layer->GetActualControl())); } else { @@ -254,7 +221,7 @@ std::string LayerManager::Log() const { log += format(" %s\n", layer->manifest_path.AbsolutePath().c_str()); log += "\n"; - if (descriptor.type == LAYER_TYPE_IMPLICIT) { + if (layer->type == LAYER_TYPE_IMPLICIT) { if (!layer->disable_env.empty()) { const std::string &value = qEnvironmentVariableIsSet(layer->disable_env.c_str()) ? "set" : "not set"; log += format(" '%s' is %s\n", layer->disable_env.c_str(), value.c_str()); @@ -285,11 +252,11 @@ std::vector LayerManager::GatherManifests(const std::string &layer_key) co std::vector result; for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { - if (this->available_layers[i].key != layer_key) { + if (!this->available_layers[i].descriptor.enabled) { continue; } - if (!this->IsEnabled(this->available_layers[i].manifest_path)) { + if (this->available_layers[i].key != layer_key) { continue; } @@ -305,11 +272,11 @@ std::vector LayerManager::GatherVersions(const std::string &layer_key) std::vector result; for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { - if (this->available_layers[i].key != layer_key) { + if (!this->available_layers[i].descriptor.enabled) { continue; } - if (!this->IsEnabled(this->available_layers[i].manifest_path)) { + if (this->available_layers[i].key != layer_key) { continue; } @@ -321,8 +288,63 @@ std::vector LayerManager::GatherVersions(const std::string &layer_key) return result; } +const Layer *LayerManager::Find(LayerId id, bool enable_only) const { + for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { + const Layer &layer = this->available_layers[i]; + + if (!layer.descriptor.enabled && enable_only) { + continue; + } + + if (layer.manifest_path != id.manifest_path) { + continue; + } + + if (layer.key != id.key) { + continue; + } + + if (layer.api_version != Version::LATEST) { + if (layer.api_version != id.api_version) { + continue; + } + } + + return &this->available_layers[i]; + } + + return nullptr; +} + +Layer *LayerManager::Find(LayerId id, bool enable_only) { + for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { + Layer &layer = this->available_layers[i]; + + if (!layer.descriptor.enabled && enable_only) { + continue; + } + + if (layer.manifest_path != id.manifest_path) { + continue; + } + + if (layer.key != id.key) { + continue; + } + + if (layer.api_version != Version::LATEST) { + if (layer.api_version != id.api_version) { + continue; + } + } + + return &this->available_layers[i]; + } + + return nullptr; +} + const Layer *LayerManager::Find(const std::string &layer_name, const Version &layer_version) const { - // Version::VERSION_NULL refer to latest version if (layer_version == Version::LATEST) { const std::vector &version = this->GatherVersions(layer_name); if (version.empty()) { @@ -358,14 +380,13 @@ const Layer *LayerManager::FindLastModified(const std::string &layer_name, const const Layer *result = nullptr; for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { - if (this->available_layers[i].key != layer_name) { + if (!this->available_layers[i].descriptor.enabled) { continue; } - if (this->available_layers[i].api_version != version) { + if (this->available_layers[i].key != layer_name) { continue; } - - if (!this->IsEnabled(this->available_layers[i].manifest_path)) { + if (this->available_layers[i].api_version != version) { continue; } @@ -384,7 +405,7 @@ const Layer *LayerManager::FindLastModified(const std::string &layer_name, const const Layer *LayerManager::FindFromManifest(const Path &manifest_path, bool find_disabled_layers) const { for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { if (!find_disabled_layers) { - if (!this->IsEnabled(this->available_layers[i].manifest_path)) { + if (!this->available_layers[i].descriptor.enabled) { continue; } } @@ -399,7 +420,7 @@ const Layer *LayerManager::FindFromManifest(const Path &manifest_path, bool find Layer *LayerManager::FindFromManifest(const Path &manifest_path, bool find_disabled_layers) { for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { if (!find_disabled_layers) { - if (!this->IsEnabled(this->available_layers[i].manifest_path)) { + if (!this->available_layers[i].descriptor.enabled) { continue; } } @@ -411,6 +432,29 @@ Layer *LayerManager::FindFromManifest(const Path &manifest_path, bool find_disab return nullptr; } +void LayerManager::ApplyLayerDescriptor() { + for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { + Layer &layer = this->available_layers[i]; + + auto it = this->layer_init.find(layer.manifest_path); + if (it == this->layer_init.end()) { + continue; + } + + for (std::size_t j = 0, o = it->second.size(); j < o; ++j) { + const LayerDisplay &init = it->second[j]; + + if (!init.id.key.empty()) { + if (init.id.key != layer.key) { + continue; + } + } + + layer.descriptor = init.descriptor; + } + } +} + // Find all installed layers on the system. void LayerManager::LoadAllInstalledLayers(ConfiguratorMode configurator_mode) { std::array, LAYERS_PATHS_COUNT> paths; @@ -436,113 +480,176 @@ void LayerManager::LoadAllInstalledLayers(ConfiguratorMode configurator_mode) { // LAYERS_PATHS_SDK paths[LAYERS_PATHS_SDK].push_back(Path(Path::SDK_EXPLICIT_LAYERS)); + // LAYERS_PATHS_GUI + std::vector added_paths = this->BuildLayerPaths(); + paths[LAYERS_PATHS_GUI].insert(paths[LAYERS_PATHS_GUI].begin(), added_paths.begin(), added_paths.end()); + for (std::size_t group_index = 0, group_count = paths.size(); group_index < group_count; ++group_index) { const LayersPaths layers_path = static_cast(group_index); const std::vector &paths_group = paths[group_index]; for (std::size_t i = 0, n = paths_group.size(); i < n; ++i) { - const std::vector &layers_paths = ::CollectFilePaths(paths_group[i]); + const std::vector &layers_paths = ::CollectLayersPaths(paths_group[i]); for (std::size_t p = 0, o = layers_paths.size(); p < o; ++p) { - this->AppendPath(layers_paths[p], ::GetLayerType(layers_path)); + this->LoadLayers(layers_paths[p], ::GetLayerType(layers_path), configurator_mode); } } } - for (auto it = this->layers_found.begin(); it != this->layers_found.end(); ++it) { - this->LoadLayer(it->first, it->second.type, configurator_mode); - } + this->ApplyLayerDescriptor(); } -LayerLoadStatus LayerManager::LoadLayer(const Path &layer_path, LayerType type, ConfiguratorMode configurator_mode) { +LayerLoadStatus LayerManager::LoadLayers(const Path &layer_path, LayerType type, ConfiguratorMode configurator_mode) { const std::string &last_modified = layer_path.LastModified(); + LayerDescriptor descriptor; + + QFile file(layer_path.AbsolutePath().c_str()); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + assert(0); + return LAYER_LOAD_INVALID; + } - Layer *already_loaded_layer = this->FindFromManifest(layer_path, true); - if (already_loaded_layer != nullptr) { - // Already loaded - auto it = this->layers_found.find(layer_path); - if (it != layers_found.end()) { - if (last_modified == it->second.last_modified) { - return LAYER_LOAD_UNMODIFIED; + QString json_text = file.readAll(); + file.close(); + + if (this->validate_manifests) { + JsonValidator validator; + descriptor.validated = validator.Check(json_text); + + if (descriptor.validated) { + switch (configurator_mode) { + default: { + } break; + case CONFIGURATOR_MODE_GUI: { + QMessageBox alert; + alert.setWindowTitle("Failed to load a layer manifest..."); + alert.setText(format("%s is not a valid layer file", layer_path.AbsolutePath().c_str()).c_str()); + alert.setInformativeText("Do you want to save the validation log?"); + alert.setIcon(QMessageBox::Critical); + alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No); + alert.setDefaultButton(QMessageBox::Yes); + int result = alert.exec(); + if (result == QMessageBox::Yes) { + const QString &selected_path = QFileDialog::getSaveFileName( + nullptr, format("Export %s validation log", layer_path.AbsolutePath().c_str()).c_str(), + (AbsolutePath(Path::HOME) + "/" + layer_path.Basename() + "_log.txt").c_str(), "Log(*.txt)"); + QFile log_file(selected_path); + const bool result = log_file.open(QIODevice::WriteOnly | QIODevice::Text); + if (result) { + QDesktopServices::openUrl(QUrl::fromLocalFile(selected_path)); + log_file.write(validator.message.toStdString().c_str()); + log_file.close(); + } else { + QMessageBox alert; + alert.setWindowTitle("Failed to save layer manifest log..."); + alert.setText(format("Couldn't not open %s file...", selected_path.toStdString().c_str()).c_str()); + alert.setIcon(QMessageBox::Critical); + alert.exec(); + } + } + } break; + case CONFIGURATOR_MODE_CMD: { + fprintf(stderr, "vkconfig: [ERROR] Couldn't validate layer file: %s\n", layer_path.AbsolutePath().c_str()); + fprintf(stderr, "\n%s\n)", validator.message.toStdString().c_str()); + } break; } } - // Modified to reload - LayerLoadStatus status = already_loaded_layer->Load(layer_path, type, this->validate_manifests, configurator_mode); - if (status == LAYER_LOAD_ADDED) { - it->second.last_modified = already_loaded_layer->last_modified; - return LAYER_LOAD_RELOADED; - } else { - // it->second.enabled = ::IsEnabled(status); - return status; - } - } else { - Layer layer; - LayerLoadStatus status = layer.Load(layer_path, type, this->validate_manifests, configurator_mode); - if (status == LAYER_LOAD_ADDED) { - this->available_layers.push_back(layer); - } - - auto it = this->layers_found.find(layer_path); - // assert(it != this->layers_found.end()); - if (it != layers_found.end()) { - // it->second.enabled = ::IsEnabled(status); - // it->second.validated = this->validate_manifests && it->second.enabled; - it->second.last_modified = layer.last_modified; - } else { - LayerDescriptor descriptor; - descriptor.type = layer.type; - descriptor.last_modified = layer.last_modified; - descriptor.validated = this->validate_manifests; - descriptor.enabled = true; - descriptor.added = true; - layers_found.insert(std::make_pair(layer.manifest_path, descriptor)); - } + return LAYER_LOAD_INVALID; + } - return status; + // Convert the text to a JSON document & validate it. + // It does need to be a valid json formatted file. + QJsonParseError json_parse_error; + const QJsonDocument &json_document = QJsonDocument::fromJson(json_text.toUtf8(), &json_parse_error); + if (json_parse_error.error != QJsonParseError::NoError) { + return LAYER_LOAD_INVALID; } -} -void LayerManager::AppendPath(const Path &path, LayerType type, bool added) { - if (added) { - auto it_removed = this->layers_removed.find(path); - if (it_removed != this->layers_removed.end()) { - this->layers_removed.erase(it_removed); - } + // Make sure it's not empty + if (json_document.isNull() || json_document.isEmpty()) { + return LAYER_LOAD_INVALID; } - if (this->layers_removed.find(path) != this->layers_removed.end()) { - return; + Version file_format_version; + const QJsonObject &json_root_object = json_document.object(); + if (json_root_object.value("file_format_version") != QJsonValue::Undefined) { + file_format_version = Version(json_root_object.value("file_format_version").toString().toStdString().c_str()); } - auto it = this->layers_found.find(path); - if (it == this->layers_found.end()) { - LayerDescriptor descriptor; - descriptor.type = type; - descriptor.added = added; - descriptor.last_modified = path.LastModified(); - this->layers_found.insert(std::make_pair(path, descriptor)); + LayerLoadStatus status = LAYER_LOAD_ADDED; + + if (json_root_object.value("layers") != QJsonValue::Undefined) { + const QJsonArray &json_layers_array = json_root_object.value("layers").toArray(); + for (int i = 0, n = json_layers_array.size(); i < n; ++i) { + const QJsonObject &json_layer_object = json_layers_array[i].toObject(); + status = this->LoadLayer(json_layer_object, layer_path, type, last_modified, file_format_version, descriptor); + } + } else if (json_root_object.value("layer") != QJsonValue::Undefined) { + const QJsonObject &json_layer_object = json_root_object.value("layer").toObject(); + status = this->LoadLayer(json_layer_object, layer_path, type, last_modified, file_format_version, descriptor); + } else { + assert(0); } + + return status; } -void LayerManager::RemovePath(const Path &path) { - auto it_found = this->layers_found.find(path); - if (it_found != this->layers_found.end()) { - this->layers_found.erase(it_found); +LayerLoadStatus LayerManager::LoadLayer(const QJsonObject &json_layer_object, const Path &layer_path, LayerType type, + const std::string &last_modified, Version file_format_version, LayerDescriptor descriptor) { + Layer layer; + layer.type = type; + layer.manifest_path = layer_path; + layer.last_modified = last_modified; + layer.file_format_version = file_format_version; + layer.descriptor = descriptor; + + LayerLoadStatus status = layer.Load(json_layer_object); + if (status == LAYER_LOAD_INVALID || status == LAYER_LOAD_IGNORED) { + return status; } - this->layers_removed.insert(path); + Layer *duplicated_layer = this->Find(layer.GetId(), false); + if (duplicated_layer != nullptr) { + if (duplicated_layer->descriptor.removed) { + duplicated_layer->descriptor.removed = false; + duplicated_layer->descriptor.enabled = true; + } else if (duplicated_layer->last_modified != layer.last_modified) { + // Reload when the manifest was updated + LayerLoadStatus reloaded_status = duplicated_layer->Load(json_layer_object); + status = reloaded_status == LAYER_LOAD_ADDED ? LAYER_LOAD_RELOADED : reloaded_status; + } else { + status = LAYER_LOAD_UNMODIFIED; + } + } else { + this->available_layers.push_back(layer); + } + + return status; +} + +void LayerManager::RemoveLayer(LayerId id) { + Layer *layer = this->Find(id, false); + assert(layer); + + layer->descriptor.enabled = false; + layer->descriptor.removed = true; +} + +void LayerManager::EnableLayer(LayerId id, bool enable) { + Layer *layer = this->Find(id, false); + assert(layer); + + layer->descriptor.enabled = enable; } std::vector LayerManager::GatherLayerNames() const { std::vector result; for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { - auto it = this->layers_found.find(this->available_layers[i].manifest_path); - if (it != this->layers_found.end()) { - if (!it->second.enabled) { - continue; - } + if (!this->available_layers[i].descriptor.enabled) { + continue; } if (std::find(result.begin(), result.end(), this->available_layers[i].key) != result.end()) { @@ -555,46 +662,79 @@ std::vector LayerManager::GatherLayerNames() const { return result; } -bool LayerManager::IsEnabled(const Path &manifest_path) const { - auto it = this->layers_found.find(manifest_path); - if (it != this->layers_found.end()) { - return it->second.enabled; +bool operator<(const LayerDisplay &a, const LayerDisplay &b) { + if (a.id.key == b.id.key) { + return a.id.api_version < b.id.api_version; + } else { + return a.id.key < b.id.key; } - return false; } -void LayerManager::Enable(const Path &manifest_path, bool enabled) { - auto it = this->layers_found.find(manifest_path); - if (it != this->layers_found.end()) { - it->second.enabled = enabled; - } -} +std::map> LayerManager::BuildLayerStoreList() const { + std::map> result; -bool operator<(const LayerDisplay &a, const LayerDisplay &b) { - if (a.key == b.key) { - return a.api_version < b.api_version; - } else { - return a.key < b.key; + for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { + const Layer *layer = &this->available_layers[i]; + if (layer == nullptr) { + continue; + } + if (layer->descriptor.removed) { + continue; + } + + LayerDisplay layer_display; + layer_display.id.manifest_path = layer->manifest_path; + layer_display.id.key = layer->key; + layer_display.id.api_version = layer->api_version; + layer_display.descriptor = layer->descriptor; + + auto it = result.find(layer->manifest_path); + if (it == result.end()) { + std::map entry; + entry.insert(std::make_pair(layer->key, layer_display)); + result.insert(std::make_pair(layer->manifest_path, entry)); + } else { + auto jt = it->second.find(layer->key); + if (jt == it->second.end()) { + it->second.insert(std::make_pair(layer->key, layer_display)); + } else { + assert(0); + } + } } + + return result; } std::set LayerManager::BuildLayerDisplayList() const { std::set result; - for (auto it = this->layers_found.begin(), end = this->layers_found.end(); it != end; ++it) { - const Layer *layer = this->FindFromManifest(it->first, true); + for (std::size_t i = 0, n = this->available_layers.size(); i < n; ++i) { + const Layer *layer = &this->available_layers[i]; if (layer == nullptr) { continue; } + if (layer->descriptor.removed) { + continue; + } LayerDisplay layer_display; - layer_display.key = layer->key; - layer_display.manifest_path = it->first; - layer_display.api_version = layer->api_version; - layer_display.descriptor = it->second; - + layer_display.id.manifest_path = layer->manifest_path; + layer_display.id.key = layer->key; + layer_display.id.api_version = layer->api_version; + layer_display.descriptor = layer->descriptor; result.insert(layer_display); } return result; } + +std::vector LayerManager::BuildLayerPaths() const { + std::vector result; + + for (auto it = this->layer_init.begin(); it != this->layer_init.end(); ++it) { + result.push_back(it->first); + } + + return result; +} diff --git a/vkconfig_core/layer_manager.h b/vkconfig_core/layer_manager.h index b0fd537861..4d5d3d9b38 100644 --- a/vkconfig_core/layer_manager.h +++ b/vkconfig_core/layer_manager.h @@ -31,9 +31,7 @@ #include struct LayerDisplay { - std::string key; - Path manifest_path; - Version api_version; + LayerId id; LayerDescriptor descriptor; }; @@ -51,31 +49,44 @@ class LayerManager : public Serialize { bool Empty() const; std::size_t Size() const; - std::vector GatherManifests(const std::string& layer_name) const; - std::vector GatherVersions(const std::string& layer_name) const; - const Layer* Find(const std::string& layer_name, const Version& version = Version::LATEST) const; - const Layer* FindLastModified(const std::string& layer_name, const Version& version) const; + std::vector GatherManifests(const std::string& layer_key) const; + std::vector GatherVersions(const std::string& layer_key) const; + + const Layer* Find(LayerId id, bool enable_only = true) const; + Layer* Find(LayerId id, bool enable_only = true); + + const Layer* Find(const std::string& layer_key, const Version& version = Version::LATEST) const; + const Layer* FindLastModified(const std::string& layer_key, const Version& version) const; const Layer* FindFromManifest(const Path& manifest_path, bool find_disabled_layers = false) const; Layer* FindFromManifest(const Path& manifest_path, bool find_disabled_layers = false); void LoadAllInstalledLayers(ConfiguratorMode configurator_mode); - LayerLoadStatus LoadLayer(const Path& layer_path, LayerType type, ConfiguratorMode configurator_mode); + LayerLoadStatus LoadLayers(const Path& layer_path, LayerType type, ConfiguratorMode configurator_mode); - void AppendPath(const Path& path, LayerType type, bool added = false); - void RemovePath(const Path& path); - - bool IsEnabled(const Path& manifest_path) const; - void Enable(const Path& manifest_path, bool enabled); + void RemoveLayer(LayerId id); + void EnableLayer(LayerId id, bool enable); std::set BuildLayerDisplayList() const; + std::map> BuildLayerStoreList() const; + std::vector BuildLayerPaths() const; std::vector GatherLayerNames() const; + std::set gui_added_layers_paths; + std::vector available_layers; Path last_layers_dir = Path(Path::HOME); bool validate_manifests = false; - std::map layers_found; + + void AppendInit(const Path& path, const std::vector& layers) { + this->layer_init.insert(std::make_pair(path, layers)); + } private: - std::set layers_removed; + LayerLoadStatus LoadLayer(const QJsonObject& json_layer_object, const Path& layer_path, LayerType type, + const std::string& last_modified, Version file_format_version, LayerDescriptor descriptor); + + void ApplyLayerDescriptor(); + + std::map> layer_init; }; diff --git a/vkconfig_core/path.cpp b/vkconfig_core/path.cpp index 3f620e004c..dc1e0f75de 100644 --- a/vkconfig_core/path.cpp +++ b/vkconfig_core/path.cpp @@ -568,6 +568,16 @@ std::string AbsolutePath(Path::Builtin path, bool native_separator) { return Pat std::string RelativePath(Path::Builtin path) { return Path(path).RelativePath(); } +bool Found(const std::vector& data, const Path& path) { + for (std::size_t i = 0, n = data.size(); i < n; ++i) { + if (data[i] == path) { + return true; + } + } + + return false; +} + std::vector CollectFilePaths(const Path& path, const char* filter) { std::vector result; @@ -587,6 +597,56 @@ std::vector CollectFilePaths(const Path& path, const char* filter) { return result; } +std::vector CollectLayersPaths(const Path& directory) { + std::vector paths = CollectFilePaths(directory, "*json"); + + std::vector results; + for (std::size_t i = 0, n = paths.size(); i < n; ++i) { + const QJsonDocument& document = ::ParseJsonFile(paths[i].AbsolutePath().c_str()); + if (document.isNull() || document.isEmpty()) { + continue; + } + + const QJsonObject& json_root_object = document.object(); + if (json_root_object.value("file_format_version") == QJsonValue::Undefined) { + continue; // Not a layer JSON file + } + + if (json_root_object.value("layer") == QJsonValue::Undefined && json_root_object.value("layers") == QJsonValue::Undefined) { + continue; + } + + results.push_back(paths[i]); + } + + return results; +} + +std::vector CollectDriversPaths(const Path& directory) { + std::vector paths = CollectFilePaths(directory, "*json"); + + std::vector results; + for (std::size_t i = 0, n = paths.size(); i < n; ++i) { + const QJsonDocument& document = ::ParseJsonFile(paths[i].AbsolutePath().c_str()); + if (document.isNull() || document.isEmpty()) { + continue; + } + + const QJsonObject& json_root_object = document.object(); + if (json_root_object.value("file_format_version") == QJsonValue::Undefined) { + continue; // Not a driver JSON file + } + + if (json_root_object.value("ICD") == QJsonValue::Undefined) { + continue; + } + + results.push_back(paths[i]); + } + + return results; +} + static std::vector LoadProfiles(const QJsonDocument& doc) { assert(!doc.isNull() && !doc.isEmpty()); diff --git a/vkconfig_core/path.h b/vkconfig_core/path.h index a10f34e06b..51b5ffd78d 100644 --- a/vkconfig_core/path.h +++ b/vkconfig_core/path.h @@ -81,6 +81,8 @@ class Path { friend bool operator!=(const Path& a, const Path& b); }; +bool Found(const std::vector& data, const Path& path); + std::string AbsolutePath(Path::Builtin path, bool native_separator = true); std::string RelativePath(Path::Builtin path); @@ -98,6 +100,10 @@ void SetDownloadPath(const std::string& path); std::vector CollectFilePaths(const Path& directory, const char* filter = "*json"); +std::vector CollectLayersPaths(const Path& directory); + +std::vector CollectDriversPaths(const Path& directory); + std::vector CollectProfileNamesFromFile(const Path& profile_path); std::vector CollectProfileNamesFromDir(const Path& profile_path); diff --git a/vkconfig_core/test/test_configuration.cpp b/vkconfig_core/test/test_configuration.cpp index 5d1c485bb1..af9bc81187 100644 --- a/vkconfig_core/test/test_configuration.cpp +++ b/vkconfig_core/test/test_configuration.cpp @@ -31,7 +31,7 @@ static void InitLayer(LayerManager& layer_manager) { const std::vector& layers_paths = ::CollectFilePaths(":/layers"); for (std::size_t i = 0, n = layers_paths.size(); i < n; ++i) { - layer_manager.LoadLayer(layers_paths[i], LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(layers_paths[i], LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); } } diff --git a/vkconfig_core/test/test_configuration_built_in.cpp b/vkconfig_core/test/test_configuration_built_in.cpp index a0099f0edf..182eb4b8a4 100644 --- a/vkconfig_core/test/test_configuration_built_in.cpp +++ b/vkconfig_core/test/test_configuration_built_in.cpp @@ -59,7 +59,7 @@ static void InitLayer(LayerManager& layer_manager) { const std::vector& layers_paths = ::CollectFilePaths(":/sdk"); for (std::size_t i = 0, n = layers_paths.size(); i < n; ++i) { - layer_manager.LoadLayer(layers_paths[i], LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(layers_paths[i], LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); } } diff --git a/vkconfig_core/test/test_configuration_manager.cpp b/vkconfig_core/test/test_configuration_manager.cpp index 94c35bd7a0..724e25c753 100644 --- a/vkconfig_core/test/test_configuration_manager.cpp +++ b/vkconfig_core/test/test_configuration_manager.cpp @@ -26,7 +26,7 @@ static void InitLayer(LayerManager& layer_manager, const char* dir) { const std::vector& layers_paths = ::CollectFilePaths(dir); for (std::size_t i = 0, n = layers_paths.size(); i < n; ++i) { - layer_manager.LoadLayer(layers_paths[i], LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(layers_paths[i], LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); } } diff --git a/vkconfig_core/test/test_generate_settings.cpp b/vkconfig_core/test/test_generate_settings.cpp index 309a709f4d..559ac5a72c 100644 --- a/vkconfig_core/test/test_generate_settings.cpp +++ b/vkconfig_core/test/test_generate_settings.cpp @@ -42,7 +42,7 @@ Configurator& GetTestConfigurator() { path.Create(); Configurator& configurator = Configurator::Get(); - configurator.layers.LoadLayer(":/layers/VK_LAYER_LUNARG_reference_1_2_1.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + configurator.layers.LoadLayers(":/layers/VK_LAYER_LUNARG_reference_1_2_1.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); configurator.configurations.CreateConfiguration(configurator.layers, "configuration"); configurator.SetActiveConfigurationName("configuration"); return configurator; diff --git a/vkconfig_core/test/test_layer.cpp b/vkconfig_core/test/test_layer.cpp index fad75dc56f..13a82a9a1d 100644 --- a/vkconfig_core/test/test_layer.cpp +++ b/vkconfig_core/test/test_layer.cpp @@ -19,6 +19,7 @@ */ #include "../layer.h" +#include "../layer_manager.h" #include "../util.h" #include "../setting_string.h" #include "../setting_filesystem.h" @@ -57,11 +58,14 @@ TEST(test_layer, collect_settings) { } TEST(test_layer, load_header_overridden) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_00.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_00.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); EXPECT_STREQ("VK_LAYER_LUNARG_test_00", layer.key.c_str()); EXPECT_STREQ(Path(".\\VkLayer_test.dll").RelativePath().c_str(), layer.binary_path.RelativePath().c_str()); @@ -80,11 +84,14 @@ TEST(test_layer, load_header_overridden) { } TEST(test_layer, load_header_default) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_01.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_01.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); EXPECT_STREQ("VK_LAYER_LUNARG_test_01", layer.key.c_str()); EXPECT_STREQ(Path(".\\VkLayer_test.dll").RelativePath().c_str(), layer.binary_path.RelativePath().c_str()); @@ -99,11 +106,14 @@ TEST(test_layer, load_header_default) { } TEST(test_layer, load_header_override) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_02.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_02.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); EXPECT_EQ(PLATFORM_WINDOWS_BIT | PLATFORM_LINUX_BIT, layer.platforms); EXPECT_EQ(STATUS_BETA, layer.status); @@ -112,11 +122,14 @@ TEST(test_layer, load_header_override) { } TEST(test_layer, load_setting_interit) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_03.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_03.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); EXPECT_EQ(PLATFORM_WINDOWS_BIT | PLATFORM_LINUX_BIT, layer.platforms); EXPECT_EQ(STATUS_BETA, layer.status); @@ -135,11 +148,14 @@ TEST(test_layer, load_setting_interit) { } TEST(test_layer, load_preset_interit) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); EXPECT_EQ(PLATFORM_WINDOWS_BIT | PLATFORM_LINUX_BIT, layer.platforms); EXPECT_EQ(STATUS_BETA, layer.status); @@ -155,18 +171,21 @@ TEST(test_layer, load_preset_interit) { EXPECT_EQ(STATUS_ALPHA, layer.presets[2].status); const LayerLoadStatus reloaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); - EXPECT_EQ(reloaded, LAYER_LOAD_ADDED); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + EXPECT_EQ(reloaded, LAYER_LOAD_UNMODIFIED); EXPECT_EQ(1, layer.settings.size()); EXPECT_EQ(3, layer.presets.size()); } TEST(test_layer, load_setting_children_interit) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_05.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_05.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); EXPECT_EQ(1, layer.presets.size()); EXPECT_EQ(1, layer.settings.size()); @@ -186,11 +205,14 @@ TEST(test_layer, load_setting_children_interit) { } TEST(test_layer, load_setting_enum_interit) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_06.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_06.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); EXPECT_EQ(PLATFORM_WINDOWS_BIT | PLATFORM_LINUX_BIT | PLATFORM_MACOS_BIT | PLATFORM_ANDROID_BIT, layer.platforms); EXPECT_EQ(STATUS_BETA, layer.status); @@ -229,11 +251,14 @@ TEST(test_layer, load_setting_enum_interit) { } TEST(test_layer, load_setting_missing) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_07.json", LAYER_TYPE_IMPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_07.json", LAYER_TYPE_IMPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); EXPECT_EQ(PLATFORM_WINDOWS_BIT | PLATFORM_LINUX_BIT, layer.platforms); EXPECT_EQ(STATUS_BETA, layer.status); @@ -244,17 +269,20 @@ TEST(test_layer, load_setting_missing) { EXPECT_EQ(layer_controlA, LAYER_CONTROL_ON); const LayerLoadStatus reloaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_07.json", LAYER_TYPE_IMPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_07.json", LAYER_TYPE_IMPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(1, layer.settings.size()); EXPECT_EQ(2, layer.presets.size()); } TEST(test_layer, load_env_variable) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_08.json", LAYER_TYPE_IMPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_08.json", LAYER_TYPE_IMPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); EXPECT_STREQ("VK_LAYER_LUNARG_test_08", layer.key.c_str()); EXPECT_STREQ(Path(".\\VkLayer_test.dll").RelativePath().c_str(), layer.binary_path.RelativePath().c_str()); @@ -298,11 +326,14 @@ TEST(test_layer, load_env_variable) { } TEST(test_layer, load_setting_message) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_09.json", LAYER_TYPE_IMPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_09.json", LAYER_TYPE_IMPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + EXPECT_EQ(Version(1, 2, 0), layer.file_format_version); EXPECT_EQ(PLATFORM_WINDOWS_BIT | PLATFORM_LINUX_BIT, layer.platforms); EXPECT_EQ(STATUS_BETA, layer.status); @@ -323,11 +354,14 @@ TEST(test_layer, load_setting_message) { } TEST(test_layer, load_1_1_0_header) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_reference_1_1_0.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_reference_1_1_0.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + EXPECT_EQ(Version(1, 1, 0), layer.file_format_version); EXPECT_STREQ("VK_LAYER_LUNARG_reference_1_1_0", layer.key.c_str()); EXPECT_STREQ(Path(".\\VkLayer_reference.dll").RelativePath().c_str(), layer.binary_path.RelativePath().c_str()); @@ -342,11 +376,14 @@ TEST(test_layer, load_1_1_0_header) { } TEST(test_layer, load_1_2_0_preset_and_setting_type) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_reference_1_2_0.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_reference_1_2_0.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + // Preset Enum { const std::size_t index = 1; diff --git a/vkconfig_core/test/test_layer_manager.cpp b/vkconfig_core/test/test_layer_manager.cpp index 7e76be08e8..a0e2bb530c 100644 --- a/vkconfig_core/test/test_layer_manager.cpp +++ b/vkconfig_core/test/test_layer_manager.cpp @@ -26,7 +26,7 @@ static void InitLayer(LayerManager& layer_manager) { const std::vector& layers_paths = ::CollectFilePaths(":/layers"); for (std::size_t i = 0, n = layers_paths.size(); i < n; ++i) { - layer_manager.LoadLayer(layers_paths[i], LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(layers_paths[i], LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); } } @@ -54,14 +54,6 @@ TEST(test_layer_manager, save_json) { LayerManager layer_manager; bool result = layer_manager.Save(json_root_object); EXPECT_TRUE(result); - - EXPECT_TRUE(json_root_object.value("layers") != QJsonValue::Undefined); - - if (json_root_object.value("layers") != QJsonValue::Undefined) { - const QJsonObject& json_layers_object = json_root_object.value("layers").toObject(); - - EXPECT_TRUE(json_layers_object.value("found") != QJsonValue::Undefined); - } } TEST(test_layer_manager, load_all) { @@ -92,7 +84,7 @@ TEST(test_layer_manager, load_file) { LayerManager layer_manager; EXPECT_TRUE(layer_manager.Empty()); - layer_manager.LoadLayer(":/layers/VK_LAYER_LUNARG_reference_1_1_0.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_reference_1_1_0.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_TRUE(!layer_manager.Empty()); EXPECT_EQ(1, layer_manager.Size()); @@ -133,7 +125,7 @@ TEST(test_layer_manager, reload) { const std::size_t initial_size = layer_manager.Size(); LayerLoadStatus status1 = - layer_manager.LoadLayer(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(status1, LAYER_LOAD_UNMODIFIED); Layer* layer1 = layer_manager.FindFromManifest(":/layers/VK_LAYER_LUNARG_test_04.json", false); @@ -142,7 +134,7 @@ TEST(test_layer_manager, reload) { EXPECT_EQ(initial_size, reloaded_size1); LayerLoadStatus status2 = - layer_manager.LoadLayer(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(status2, LAYER_LOAD_UNMODIFIED); const std::size_t reloaded_size2 = layer_manager.Size(); @@ -197,11 +189,6 @@ TEST(test_layer_manager, FindLastModified) { Path modified_path = layer204_modified->manifest_path; layer204_modified->manifest_path = ":/layers/VK_LAYER_LUNARG_version_204_copy.json"; - auto it = layer_manager.layers_found.find(":/layers/VK_LAYER_LUNARG_version_204.json"); - assert(it != layer_manager.layers_found.end()); - - layer_manager.layers_found.insert(std::make_pair(":/layers/VK_LAYER_LUNARG_version_204_copy.json", it->second)); - ::InitLayer(layer_manager); const std::size_t reloaded_count = layer_manager.Size(); EXPECT_EQ(initial_count + 1, reloaded_count); @@ -234,7 +221,7 @@ TEST(test_layer_manager, FindFromManifest) { Layer* layer208 = layer_manager.FindFromManifest(":/layers/VK_LAYER_LUNARG_version_208.json", false); EXPECT_TRUE(layer208 == nullptr); - layer_manager.layers_found.find(":/layers/VK_LAYER_LUNARG_version_204.json")->second.enabled = false; + layer204->descriptor.enabled = false; Layer* layer204_disabledA = layer_manager.FindFromManifest(":/layers/VK_LAYER_LUNARG_version_204.json", false); EXPECT_TRUE(layer204_disabledA == nullptr); @@ -269,12 +256,12 @@ TEST(test_layer_manager, GatherManifests) { EXPECT_EQ(layer0->api_version, Version(1, 3, 290)); const Layer* layer1 = layer_manager.FindFromManifest(versions_found[1]); EXPECT_EQ(layer1->api_version, Version(1, 3, 204)); - const Layer* layer2 = layer_manager.FindFromManifest(versions_found[2]); + Layer* layer2 = layer_manager.FindFromManifest(versions_found[2]); EXPECT_EQ(layer2->api_version, Version(1, 2, 193)); const Layer* layer3 = layer_manager.FindFromManifest(versions_found[3]); EXPECT_EQ(layer3->api_version, Version(1, 1, 135)); - layer_manager.layers_found.find(versions_found[2])->second.enabled = false; + layer2->descriptor.enabled = false; const Layer* layer193 = layer_manager.Find("VK_LAYER_LUNARG_version", Version(1, 2, 193)); EXPECT_TRUE(layer193 != nullptr); @@ -307,10 +294,12 @@ TEST(test_layer_manager, GatherVersions) { EXPECT_EQ(versions_found[2], Version(1, 2, 193)); EXPECT_EQ(versions_found[3], Version(1, 1, 135)); - const Layer* layer193 = layer_manager.Find("VK_LAYER_LUNARG_version", Version(1, 2, 193)); + LayerId layer_id{Path(":/layers/VK_LAYER_LUNARG_version_193.json"), "VK_LAYER_LUNARG_version", Version(1, 2, 193)}; + + Layer* layer193 = layer_manager.Find(layer_id); EXPECT_TRUE(layer193 != nullptr); - layer_manager.layers_found.find(layer193->manifest_path)->second.enabled = false; + layer193->descriptor.enabled = false; const std::vector& versions_found_b = layer_manager.GatherVersions("VK_LAYER_LUNARG_version"); EXPECT_FALSE(versions_found_b.empty()); diff --git a/vkconfig_core/test/test_layer_preset.cpp b/vkconfig_core/test/test_layer_preset.cpp index 8b5f919b49..5ece200a04 100644 --- a/vkconfig_core/test/test_layer_preset.cpp +++ b/vkconfig_core/test/test_layer_preset.cpp @@ -20,6 +20,7 @@ #include "../layer.h" #include "../layer_preset.h" +#include "../layer_manager.h" #include "../setting_string.h" #include "../setting_int.h" #include "../util.h" @@ -64,11 +65,14 @@ TEST(test_layer_preset, has_preset) { } TEST(test_layer_preset, find_preset_index_no_preset) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_03.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_03.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + SettingDataSet layer_settings; ::CollectDefaultSettingData(layer.settings, layer_settings); @@ -77,22 +81,28 @@ TEST(test_layer_preset, find_preset_index_no_preset) { } TEST(test_layer_preset, find_preset_index_empty) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + SettingDataSet layer_settings; int index = layer.FindPresetIndex(layer_settings); EXPECT_EQ(index, Layer::NO_PRESET); } TEST(test_layer_preset, find_preset_index_found) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_04.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + SettingDataSet layer_settings; ::CollectDefaultSettingData(layer.settings, layer_settings); SettingDataInt& setting = static_cast(*layer_settings[0]); @@ -114,11 +124,14 @@ TEST(test_layer_preset, find_preset_index_found) { } TEST(test_layer_preset, find_preset_index_missing_value) { - Layer layer; + LayerManager layer_manager; + const LayerLoadStatus load_loaded = - layer.Load(":/layers/VK_LAYER_LUNARG_test_07.json", LAYER_TYPE_EXPLICIT, false, CONFIGURATOR_MODE_CMD); + layer_manager.LoadLayers(":/layers/VK_LAYER_LUNARG_test_07.json", LAYER_TYPE_EXPLICIT, CONFIGURATOR_MODE_CMD); EXPECT_EQ(load_loaded, LAYER_LOAD_ADDED); + Layer& layer = layer_manager.available_layers[0]; + SettingDataSet layer_settings; ::CollectDefaultSettingData(layer.settings, layer_settings); diff --git a/vkconfig_core/test/test_parameter.cpp b/vkconfig_core/test/test_parameter.cpp index 2e8acb1691..3a9421e560 100644 --- a/vkconfig_core/test/test_parameter.cpp +++ b/vkconfig_core/test/test_parameter.cpp @@ -32,13 +32,14 @@ static SettingMetaString* InstantiateString(Layer& layer, const std::string& key static void AddLayer(LayerManager& layers, const char* key, LayerType type) { std::string path = format("./%s.json", key); - layers.available_layers.push_back(Layer(key, Version(1, 0, 0), Version(1, 2, 148), "1", path.c_str())); - layers.available_layers[layers.available_layers.size() - 1].manifest_path = path; - layers.available_layers[layers.available_layers.size() - 1].type = type; - - LayerDescriptor descriptor; - descriptor.type = type; - layers.layers_found.insert(std::make_pair(path, descriptor)); + Layer layer(key); + layer.file_format_version = Version(1, 0, 0); + layer.api_version = Version(1, 2, 148); + layer.implementation_version = "1"; + layer.type = type; + layer.manifest_path = path; + + layers.available_layers.push_back(layer); } static void InitLayers(LayerManager& layers) { @@ -237,8 +238,13 @@ TEST(test_parameter, order_parameter_manual_partial) { EXPECT_STREQ(parameters[8].key.c_str(), "VK_LAYER_KHRONOS_timeline_semaphore"); // Insert a new layer in the parameter list - layers.available_layers.push_back( - Layer("VK_LAYER_KHRONOS_shader_object", Version(1, 0, 0), Version(1, 2, 148), "1", "layer.json")); + Layer layer("VK_LAYER_KHRONOS_shader_object"); + layer.manifest_path = "./layer.json"; + layer.api_version = Version(1, 2, 148); + layer.file_format_version = Version(1, 0, 0); + layer.implementation_version = "1"; + + layers.available_layers.push_back(layer); Parameter parameter_implicit2("VK_LAYER_KHRONOS_shader_object", LAYER_CONTROL_AUTO); parameters.push_back(parameter_implicit2); diff --git a/vkconfig_gui/CHANGELOG.md b/vkconfig_gui/CHANGELOG.md index 4bf29248e5..963f240612 100644 --- a/vkconfig_gui/CHANGELOG.md +++ b/vkconfig_gui/CHANGELOG.md @@ -20,6 +20,7 @@ - Show paths instead of Vulkan Configurator variables - Improve UI consistency - Move 'Validate Layer Manifest' settings to the preference tab +- Improve keyboard shortcuts ### Fixes: - Fix command line whitespace decoding #2625 @@ -31,6 +32,7 @@ - Fix UUID display in log, following the RFC9562 standard - Fix icon to remove a Vulkan driver - Fix key binding shortcuts (Eg: CTRL+F to search things on various tabs) +- Fix `VK_LAYER_NV_present` or `VK_LAYER_NV_optimus not` found #2597 ## Vulkan Configurator 3.4.2 - Febuary 2026 [Vulkan SDK 1.4.341.0](https://github.com/LunarG/VulkanTools/tree/vulkan-sdk-1.4.341) diff --git a/vkconfig_gui/mainwindow.ui b/vkconfig_gui/mainwindow.ui index 4d5af1af73..4d5102c8fe 100644 --- a/vkconfig_gui/mainwindow.ui +++ b/vkconfig_gui/mainwindow.ui @@ -91,7 +91,7 @@ QTabWidget::Rounded - 0 + 1 @@ -989,6 +989,12 @@ + + + 0 + 0 + + 16777215 @@ -1002,6 +1008,9 @@ false + + Enter search text to filter layers in the list... (Ctrl+F) + Enter search text to filter layers in the list... (Ctrl+F) @@ -1050,6 +1059,18 @@ 24 + + + 0 + 24 + + + + + 0 + 24 + + Arial @@ -1066,6 +1087,9 @@ false + + QProgressBar::BottomToTop + Loading layers... %p% @@ -1073,6 +1097,12 @@ + + + 0 + 0 + + 0 @@ -1092,6 +1122,9 @@ false + + Add a Vulkan Layer manifests path... (Ctrl+O) + Add a Vulkan Layer manifests path... (Ctrl+O) @@ -1519,6 +1552,12 @@ + + + 0 + 0 + + 16777215 @@ -1532,6 +1571,9 @@ false + + Enter search text to filter drivers in the list... (Ctrl+F) + Enter search text to filter drivers in the list... (Ctrl+F) @@ -1552,6 +1594,12 @@ + + + 0 + 0 + + 16777215 @@ -1565,6 +1613,9 @@ false + + Add Vulkan Driver manifests path... (Ctrl+O) + Add Vulkan Driver manifests path... (Ctrl+O) @@ -2430,6 +2481,9 @@ 24 + + Enter search text in the current log... (Ctrl+F) + Enter search text in the current log... (Ctrl+F) diff --git a/vkconfig_gui/tab_configurations.cpp b/vkconfig_gui/tab_configurations.cpp index 40e75bac23..956f99df6f 100644 --- a/vkconfig_gui/tab_configurations.cpp +++ b/vkconfig_gui/tab_configurations.cpp @@ -195,19 +195,22 @@ void TabConfigurations::UpdateUI_Configurations(UpdateUIMode mode) { ListItem *item = new ListItem(configuration.key.c_str()); item->setFlags(item->flags() | Qt::ItemIsEditable); item->setText(configuration.key.c_str()); + if (configurator.GetActiveConfiguration() == &configuration) { - item->setIcon(::Get(configurator.current_theme_mode, ::ICON_SYSTEM_ON)); + item->setIcon(::Get(configurator.current_theme_mode, has_missing_layer ? ::ICON_SYSTEM_INVALID : ::ICON_SYSTEM_ON)); item->setToolTip(configuration_tooltip.c_str()); current_row = static_cast(i); - } else if (has_missing_layer) { - item->setIcon(::Get(configurator.current_theme_mode, ::ICON_SYSTEM_INVALID)); - item->setToolTip( - format("The '%s' configuration has missing layers. These layers are ignored.", configuration.key.c_str()).c_str()); } else { - item->setIcon(::Get(configurator.current_theme_mode, ::ICON_SYSTEM_OFF)); + item->setIcon(::Get(configurator.current_theme_mode, has_missing_layer ? ::ICON_SYSTEM_INVALID : ::ICON_SYSTEM_OFF)); item->setToolTip( format("Select the '%s' configuration to use it with Vulkan executables", configuration.key.c_str()).c_str()); } + + if (has_missing_layer) { + item->setToolTip( + format("The '%s' configuration has missing layers. These layers are ignored.", configuration.key.c_str()).c_str()); + } + ui->configurations_list->addItem(item); } diff --git a/vkconfig_gui/tab_drivers.cpp b/vkconfig_gui/tab_drivers.cpp index a8895afed4..4b3093b3b2 100644 --- a/vkconfig_gui/tab_drivers.cpp +++ b/vkconfig_gui/tab_drivers.cpp @@ -318,7 +318,19 @@ void TabDrivers::on_driver_append_pressed() { configurator.last_driver_dir = selected_path; - const std::vector drivers_paths = ::CollectFilePaths(selected_path); + const std::vector drivers_paths = ::CollectDriversPaths(selected_path); + if (drivers_paths.empty()) { + QMessageBox alert; + alert.setWindowTitle("No Vulkan Driver Manifest found in the directory"); + alert.setText("The directory:"); + alert.setInformativeText(selected_path.AbsolutePath().c_str()); + alert.setStandardButtons(QMessageBox::Ok); + alert.setDefaultButton(QMessageBox::Ok); + alert.setIcon(QMessageBox::Warning); + alert.exec(); + return; + } + for (std::size_t i = 0, n = drivers_paths.size(); i < n; ++i) { configurator.driver_paths.insert(std::pair(drivers_paths[i], true)); } diff --git a/vkconfig_gui/tab_layers.cpp b/vkconfig_gui/tab_layers.cpp index cc1fdc751c..fe5bf00b4c 100644 --- a/vkconfig_gui/tab_layers.cpp +++ b/vkconfig_gui/tab_layers.cpp @@ -44,7 +44,9 @@ TabLayers::TabLayers(MainWindow &window, std::shared_ptr ui) : T this->connect(this->ui->layers_browse_button, SIGNAL(clicked()), this, SLOT(on_layers_browse_pressed())); this->connect(this->ui->layers_reload_button, SIGNAL(clicked()), this, SLOT(on_layers_reload_pressed())); + this->connect(this->ui->layers_path_lineedit, SIGNAL(editingFinished()), this, SLOT(on_layers_append_pressed())); this->connect(this->ui->layers_path_lineedit, SIGNAL(returnPressed()), this, SLOT(on_layers_append_pressed())); + // this->connect(this->ui->layers_path_lineedit, SIGNAL(clicked()), this, SLOT(on_layers_edit_pressed())); this->connect(this->ui->layers_search, SIGNAL(textEdited(QString)), this, SLOT(on_search_textEdited(QString))); this->connect(this->ui->layers_search_clear, SIGNAL(clicked()), this, SLOT(on_search_clear_pressed())); @@ -77,14 +79,14 @@ void TabLayers::UpdateUI_LayersPaths(UpdateUIMode ui_update_mode) { const std::set &layer_display_list = configurator.layers.BuildLayerDisplayList(); for (auto it = layer_display_list.begin(), end = layer_display_list.end(); it != end; ++it) { - const Layer *layer = configurator.layers.FindFromManifest(it->manifest_path, true); + const Layer *layer = configurator.layers.Find(it->id, false); if (layer == nullptr) { continue; } if (!this->layer_filter.empty()) { const std::string status = layer->status == STATUS_STABLE ? "" : format(" (%s)", ::GetToken(layer->status)); - const std::string text = format("%s - %s%s, %s layer", layer->key.c_str(), layer->api_version.str().c_str(), + const std::string text = format("%s - %s%s - %s layer", layer->key.c_str(), layer->api_version.str().c_str(), status.c_str(), ::GetToken(layer->type)); std::string lower_text = ::ToLowerCase(text); @@ -98,19 +100,12 @@ void TabLayers::UpdateUI_LayersPaths(UpdateUIMode ui_update_mode) { item->setFlags(item->flags() | Qt::ItemIsSelectable); item->setSizeHint(QSize(0, ITEM_HEIGHT)); - LayerWidget *layer_widget = new LayerWidget(layer); - layer_widget->setChecked(it->descriptor.enabled); - if (it->descriptor.added) { - QPalette palette = layer_widget->palette(); - palette.setColor(QPalette::Active, QPalette::WindowText, QColor(255, 0, 0)); - layer_widget->setPalette(palette); - } - + LayerWidget *layer_widget = new LayerWidget(*layer); this->connect(layer_widget, SIGNAL(itemChanged()), this, SLOT(on_paths_changed())); this->connect(layer_widget, SIGNAL(itemToggled()), this, SLOT(on_paths_toggled())); - ui->layers_list->addItem(item); - ui->layers_list->setItemWidget(item, layer_widget); + this->ui->layers_list->addItem(item); + this->ui->layers_list->setItemWidget(item, layer_widget); } } break; default: { @@ -122,7 +117,15 @@ void TabLayers::UpdateUI_LayersPaths(UpdateUIMode ui_update_mode) { void TabLayers::UpdateUI(UpdateUIMode ui_update_mode) { const Configurator &configurator = Configurator::Get(); - + /* + QSizePolicy policy_search = this->ui->layers_search->sizePolicy(); + policy_search.setHorizontalPolicy(QSizePolicy::MinimumExpanding); + this->ui->layers_search->setSizePolicy(policy_search); + + QSizePolicy policy_append = this->ui->layers_path_lineedit->sizePolicy(); + policy_append.setHorizontalPolicy(QSizePolicy::MinimumExpanding); + this->ui->layers_path_lineedit->setSizePolicy(policy_append); + */ this->ui->layers_search_clear->setEnabled(!this->ui->layers_search->text().isEmpty()); this->ui->layers_search->setFocus(); this->ui->layers_progress->resetFormat(); @@ -158,9 +161,23 @@ void TabLayers::on_paths_toggled() { this->UpdateUI_LayersPaths(UPDATE_REFRESH_UI); } +void TabLayers::on_layers_edit_pressed() { + /* + QSizePolicy policy_search = this->ui->layers_search->sizePolicy(); + policy_search.setHorizontalPolicy(QSizePolicy::Preferred); + this->ui->layers_search->setSizePolicy(policy_search); + + QSizePolicy policy_append = this->ui->layers_path_lineedit->sizePolicy(); + policy_append.setHorizontalPolicy(QSizePolicy::MinimumExpanding); + this->ui->layers_path_lineedit->setSizePolicy(policy_append); + */ +} + void TabLayers::on_layers_append_pressed() { this->LoadLayersManifest(this->ui->layers_path_lineedit->text()); } void TabLayers::on_layers_browse_pressed() { + this->on_layers_edit_pressed(); + Configurator &configurator = Configurator::Get(); const QString selected_path = @@ -170,7 +187,18 @@ void TabLayers::on_layers_browse_pressed() { this->LoadLayersManifest(selected_path); } -void TabLayers::on_focus_search() { this->ui->layers_search->setFocus(); } +void TabLayers::on_focus_search() { + this->ui->layers_search->setFocus(); + /* + QSizePolicy policy_search = this->ui->layers_search->sizePolicy(); + policy_search.setHorizontalPolicy(QSizePolicy::MinimumExpanding); + this->ui->layers_search->setSizePolicy(policy_search); + + QSizePolicy policy_append = this->ui->layers_path_lineedit->sizePolicy(); + policy_append.setHorizontalPolicy(QSizePolicy::Preferred); + this->ui->layers_path_lineedit->setSizePolicy(policy_append); + */ +} void TabLayers::on_search_textEdited(const QString &text) { this->layer_filter = text.toStdString(); @@ -190,6 +218,8 @@ void TabLayers::on_search_clear_pressed() { } void TabLayers::on_layers_reload_pressed() { + this->ui->layers_search->setVisible(false); + this->ui->layers_search_clear->setVisible(false); this->ui->layers_path_lineedit->setVisible(false); this->ui->layers_browse_button->setVisible(false); this->ui->layers_progress->setVisible(true); @@ -200,11 +230,7 @@ void TabLayers::on_layers_reload_pressed() { std::vector layers_count(LAYER_LOAD_COUNT, 0); - const std::vector &layers_paths = ::CollectFilePaths(new_path); - - for (std::size_t i = 0, n = layers_paths.size(); i < n; ++i) { - configurator.layers.AppendPath(layers_paths[i], LAYER_TYPE_EXPLICIT, true); - } + const std::vector &layers_paths = ::CollectLayersPaths(new_path); this->ui->layers_progress->setMaximum(static_cast(layers_paths.size())); this->ui->layers_progress->setValue(0); @@ -217,7 +243,7 @@ void TabLayers::on_layers_reload_pressed() { this->ui->layers_progress->setValue(static_cast(i + 1)); this->ui->layers_progress->update(); - LayerLoadStatus status = configurator.layers.LoadLayer(layers_paths[i], LAYER_TYPE_EXPLICIT, configurator.mode); + LayerLoadStatus status = configurator.layers.LoadLayers(layers_paths[i], LAYER_TYPE_EXPLICIT, configurator.mode); ++layers_count[status]; std::this_thread::sleep_until(std::chrono::system_clock::now() + std::chrono::milliseconds(10)); @@ -248,6 +274,8 @@ void TabLayers::on_layers_reload_pressed() { } } + this->ui->layers_search->setVisible(true); + this->ui->layers_search_clear->setVisible(true); this->ui->layers_path_lineedit->setVisible(true); this->ui->layers_browse_button->setVisible(true); this->ui->layers_progress->setVisible(false); @@ -262,6 +290,8 @@ void TabLayers::LoadLayersManifest(const QString &selected_path) { this->ui->layers_path_lineedit->setText(configurator.layers.last_layers_dir.AbsolutePath().c_str()); } + configurator.layers.gui_added_layers_paths.insert(configurator.layers.last_layers_dir); + this->on_layers_reload_pressed(); this->UpdateUI_LayersPaths(UPDATE_REBUILD_UI); diff --git a/vkconfig_gui/tab_layers.h b/vkconfig_gui/tab_layers.h index aa55c1b3b8..eee0498641 100644 --- a/vkconfig_gui/tab_layers.h +++ b/vkconfig_gui/tab_layers.h @@ -38,6 +38,7 @@ class TabLayers : public Tab { public Q_SLOTS: void on_paths_changed(); void on_paths_toggled(); + void on_layers_edit_pressed(); void on_layers_append_pressed(); void on_layers_browse_pressed(); void on_layers_reload_pressed(); diff --git a/vkconfig_gui/widget_tab_layers_path.cpp b/vkconfig_gui/widget_tab_layers_path.cpp index d4b84eea4d..4da507750b 100644 --- a/vkconfig_gui/widget_tab_layers_path.cpp +++ b/vkconfig_gui/widget_tab_layers_path.cpp @@ -26,22 +26,28 @@ #include #include -LayerWidget::LayerWidget(const Layer* layer) - : layer_key(layer->key), api_version(layer->api_version), manifest_path(layer->manifest_path) { +LayerWidget::LayerWidget(const Layer& layer) : layer_id(layer.GetId()) { const Configurator& configurator = Configurator::Get(); - const std::string status = layer->status == STATUS_STABLE ? "" : format(" (%s)", ::GetToken(layer->status)); - const std::string text = format("%s - %s%s, %s layer", layer->key.c_str(), layer->api_version.str().c_str(), status.c_str(), - ::GetToken(layer->type)); + const std::string status = layer.status == STATUS_STABLE ? "" : format(" (%s)", ::GetToken(layer.status)); + const std::string text = format("%s - %s%s - %s layer", layer.key.c_str(), layer.api_version.str().c_str(), status.c_str(), + ::ToLowerCase(::GetToken(layer.type)).c_str()); this->setText(text.c_str()); - this->setToolTip(format("%s", manifest_path.AbsolutePath().c_str()).c_str()); + this->setToolTip(format("%s", layer.manifest_path.AbsolutePath().c_str()).c_str()); + this->setChecked(layer.descriptor.enabled); this->buttom_remove = new QPushButton(this); this->buttom_remove->setIcon(::Get(configurator.current_theme_mode, ::ICON_FOLDER_REMOVE)); this->buttom_remove->setToolTip("Remove the Vulkan layer from Vulkan Configurator"); this->buttom_remove->setFixedSize(24, 24); + if (layer.descriptor.recent) { + QPalette palette = this->palette(); + palette.setColor(QPalette::Active, QPalette::WindowText, QColor(255, 0, 0)); + this->setPalette(palette); + } + this->connect(this, SIGNAL(toggled(bool)), this, SLOT(on_toggled(bool))); this->connect(this->buttom_remove, SIGNAL(clicked(bool)), this, SLOT(on_buttom_remove_clicked(bool))); } @@ -63,15 +69,16 @@ void LayerWidget::on_buttom_remove_clicked(bool checked) { if (!(configurator.Get(HIDE_MESSAGE_QUESTION_REMOVING_LAYERS_PATH))) { QMessageBox alert; - alert.setWindowTitle(format("Removing %s %s layer...", this->layer_key.c_str(), this->api_version.str().c_str()).c_str()); + alert.setWindowTitle( + format("Removing %s %s layer...", this->layer_id.key.c_str(), this->layer_id.api_version.str().c_str()).c_str()); alert.setIcon(QMessageBox::Question); alert.setDefaultButton(QMessageBox::No); alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No); alert.setCheckBox(new QCheckBox("Do not show again.")); - alert.setText(format("Are you sure you want to remove %s %s from %s?", this->layer_key.c_str(), - this->api_version.str().c_str(), VKCONFIG_NAME) + alert.setText(format("Are you sure you want to remove %s %s from %s?", this->layer_id.key.c_str(), + this->layer_id.api_version.str().c_str(), VKCONFIG_NAME) .c_str()); - alert.setInformativeText(format("The layer is located: %s", this->manifest_path.AbsolutePath().c_str()).c_str()); + alert.setInformativeText(format("The layer is located: %s", this->layer_id.manifest_path.AbsolutePath().c_str()).c_str()); int ret_val = alert.exec(); if (alert.checkBox()->isChecked()) { configurator.Set(HIDE_MESSAGE_QUESTION_REMOVING_LAYERS_PATH); @@ -81,14 +88,14 @@ void LayerWidget::on_buttom_remove_clicked(bool checked) { } } - configurator.layers.RemovePath(this->manifest_path); + configurator.layers.RemoveLayer(this->layer_id); emit itemChanged(); } void LayerWidget::on_toggled(bool checked) { Configurator& configurator = Configurator::Get(); - configurator.layers.Enable(this->manifest_path, checked); + configurator.layers.EnableLayer(this->layer_id, checked); emit itemToggled(); } diff --git a/vkconfig_gui/widget_tab_layers_path.h b/vkconfig_gui/widget_tab_layers_path.h index d91da0f0e3..9d9eb99b07 100644 --- a/vkconfig_gui/widget_tab_layers_path.h +++ b/vkconfig_gui/widget_tab_layers_path.h @@ -31,7 +31,7 @@ class LayerWidget : public QCheckBox { Q_OBJECT public: - LayerWidget(const Layer *layer); + LayerWidget(const Layer &layer); protected: void resizeEvent(QResizeEvent *event) override; @@ -45,8 +45,6 @@ class LayerWidget : public QCheckBox { void itemToggled(); public: - std::string layer_key; - Version api_version; - Path manifest_path; + LayerId layer_id; QPushButton *buttom_remove = nullptr; };