From 255d9d50292165230f6716973309a591b3b93d2e Mon Sep 17 00:00:00 2001 From: Christophe Date: Thu, 28 Nov 2024 11:33:21 +0100 Subject: [PATCH] vkconfig3: beta bugfixing - Fix ${VULKAN_SDK} path in logging - Fix ${VULKAN_SDK} overriding system path when set - Add vulkaninfo to default executable - Add ${VULKAN_PROFILES} - Fix group settings visibility which depends on enum value - Clean up layer paths on macOS - Improve layer control UI combobox on macOS - Resolve dark theme difficult link to read --- .../configurations/3.0.0/Portability.json | 2 +- vkconfig_core/configurator.cpp | 8 +- vkconfig_core/executable.cpp | 2 +- vkconfig_core/executable_manager.cpp | 10 +- vkconfig_core/layer_manager.cpp | 82 +++++++++++----- vkconfig_core/path.cpp | 95 +++++++++++-------- vkconfig_core/path.h | 7 +- .../test/test_executable_manager.cpp | 27 +++--- vkconfig_core/test/test_path.cpp | 14 +-- vkconfig_gui/CHANGELOG.md | 4 +- vkconfig_gui/mainwindow.ui | 62 ++++++------ vkconfig_gui/settings_tree.cpp | 12 ++- vkconfig_gui/tab_applications.cpp | 6 +- vkconfig_gui/tab_configurations.cpp | 3 +- vkconfig_gui/tab_documentation.cpp | 50 +++++++++- vkconfig_gui/tab_layers.cpp | 2 +- vkconfig_gui/vkconfig.pro | 2 + vkconfig_gui/widget_setting_enum.h | 4 +- vkconfig_gui/widget_setting_group.cpp | 44 +++++++++ vkconfig_gui/widget_setting_group.h | 40 ++++++++ .../widget_tab_configurations_layer.cpp | 7 +- 21 files changed, 339 insertions(+), 144 deletions(-) create mode 100644 vkconfig_gui/widget_setting_group.cpp create mode 100644 vkconfig_gui/widget_setting_group.h diff --git a/vkconfig_core/configurations/3.0.0/Portability.json b/vkconfig_core/configurations/3.0.0/Portability.json index 69c2099128..c164fd6cbf 100644 --- a/vkconfig_core/configurations/3.0.0/Portability.json +++ b/vkconfig_core/configurations/3.0.0/Portability.json @@ -31,7 +31,7 @@ { "key": "profile_dirs", "type": "LOAD_FOLDER", - "value": "${VULKAN_CONTENT}/VK_LAYER_KHRONOS_profiles" + "value": "${VULKAN_PROFILES}" }, { "key": "profile_name", diff --git a/vkconfig_core/configurator.cpp b/vkconfig_core/configurator.cpp index edb1961924..9cd24feeab 100644 --- a/vkconfig_core/configurator.cpp +++ b/vkconfig_core/configurator.cpp @@ -574,7 +574,11 @@ std::string Configurator::Log() const { log += format("%s %s - %s:\n", VKCONFIG_NAME, Version::VKCONFIG.str().c_str(), GetBuildDate().c_str()); log += format(" - Build: %s %s\n", GetLabel(VKC_PLATFORM), build.c_str()); log += format(" - Vulkan API version: %s\n", Version::VKHEADER.str().c_str()); - log += format(" - ${VULKAN_SDK}: %s\n", ::Get(Path::SDK).AbsolutePath().c_str()); + if (::Get(Path::SDK).Empty()) { + log += " - ${VULKAN_SDK}: unset\n"; + } else { + log += format(" - ${VULKAN_SDK}: %s\n", ::Get(Path::SDK).AbsolutePath().c_str()); + } log += "\n"; log += format("%s Settings:\n", VKCONFIG_NAME); @@ -620,6 +624,8 @@ std::string Configurator::Log() const { } log += format(" - Use system tray: %s\n", this->use_system_tray ? "true" : "false"); + log += format(" - ${VULKAN_BIN}: %s\n", ::Get(Path::BIN).AbsolutePath().c_str()); + log += format(" - ${VULKAN_PROFILES}: %s\n", ::Get(Path::PROFILES).AbsolutePath().c_str()); log += format(" - ${VK_HOME}: %s\n", ::Get(Path::HOME).AbsolutePath().c_str()); log += "\n"; diff --git a/vkconfig_core/executable.cpp b/vkconfig_core/executable.cpp index b8615fdcee..5a77d71da1 100644 --- a/vkconfig_core/executable.cpp +++ b/vkconfig_core/executable.cpp @@ -102,7 +102,7 @@ DefaultPath GetDefaultExecutablePath(const std::string& executable_key) { DefaultPath default_path{"." + executable_name, "."}; // Using VULKAN_SDK environement variable - const Path env = ::Get(Path::SDK_BIN); + const Path env = ::Get(Path::BIN); if (!env.Empty()) { const Path search_path(env + DEFAULT_PATH + executable_name.c_str()); if (search_path.Exists()) { diff --git a/vkconfig_core/executable_manager.cpp b/vkconfig_core/executable_manager.cpp index f8bc86b213..43b9c35dd6 100644 --- a/vkconfig_core/executable_manager.cpp +++ b/vkconfig_core/executable_manager.cpp @@ -40,8 +40,14 @@ const char* GetExecutableFilter() { } static const DefaultExecutable defaults_executables[] = { - {"vkcube", "/vkcube", "--suppress_popups", "VkCube launcher options"}, - {"vkcubepp", "/vkcubepp", "--suppress_popups", "VkCubepp launcher options"}}; + {"vkcube", "/vkcube", "--suppress_popups", "vkcube launcher options"}, + {"vkcubepp", "/vkcubepp", "--suppress_popups", "vkcubepp launcher options"}, +#if VKC_ENV == VKC_ENV_WIN32 + {"vulkaninfoSDK", "/vulkaninfoSDK", "--json", "vulkaninfo launcher options"}, +#else + {"vulkaninfo", "/vulkaninfo", "--json", "vulkaninfo launcher options"}, +#endif +}; std::string ExecutableManager::Log() const { std::string log; diff --git a/vkconfig_core/layer_manager.cpp b/vkconfig_core/layer_manager.cpp index 1997e6fb11..97d65f43b2 100644 --- a/vkconfig_core/layer_manager.cpp +++ b/vkconfig_core/layer_manager.cpp @@ -58,24 +58,42 @@ std::vector GetImplicitLayerPaths() { LoadRegistrySystemLayers("HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Class\\...\\VulkanImplicitLayers"); result.insert(result.begin(), drivers_registry_paths.begin(), drivers_registry_paths.end()); #else - static const char *LAYERS_PATHS[] = { - "/usr/local/etc/vulkan/implicit_layer.d", // Not used on macOS, okay to just ignore - "/usr/local/share/vulkan/implicit_layer.d", - "/etc/vulkan/implicit_layer.d", - "/usr/share/vulkan/implicit_layer.d", - ".local/share/vulkan/implicit_layer.d", + std::vector paths; + if (VKC_PLATFORM == PLATFORM_MACOS) { + static const char *LAYERS_PATHS[] = { + "/usr/local/share/vulkan/implicit_layer.d", + ".local/share/vulkan/implicit_layer.d", + }; + + for (std::size_t i = 0, n = std::size(LAYERS_PATHS); i < n; ++i) { + paths.push_back(LAYERS_PATHS[i]); + } + } else { + static const char *LAYERS_PATHS[] = { + "/usr/local/etc/vulkan/implicit_layer.d", + "/usr/local/share/vulkan/implicit_layer.d", + "/etc/vulkan/implicit_layer.d", + "/usr/share/vulkan/implicit_layer.d", + ".local/share/vulkan/implicit_layer.d", +#ifdef _DEBUG #ifdef INSTALL_FULL_DATAROOTDIR - INSTALL_FULL_DATAROOTDIR "/vulkan/implicit_layer.d", + INSTALL_FULL_DATAROOTDIR "/vulkan/implicit_layer.d", #endif #ifdef INSTALL_FULL_SYSCONFDIR - INSTALL_FULL_SYSCONFDIR "/vulkan/implicit_layer.d", + INSTALL_FULL_SYSCONFDIR "/vulkan/implicit_layer.d", #endif - }; +#endif //_DEBUG + }; - for (std::size_t i = 0, n = std::size(LAYERS_PATHS); i < n; ++i) { + for (std::size_t i = 0, n = std::size(LAYERS_PATHS); i < n; ++i) { + 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 = LAYERS_PATHS[i]; + info.path = paths[i]; result.push_back(info); } #endif @@ -100,24 +118,42 @@ std::vector GetExplicitLayerPaths() { LoadRegistrySystemLayers("HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Class\\...\\VulkanExplicitLayers"); result.insert(result.begin(), drivers_registry_paths.begin(), drivers_registry_paths.end()); #else - static const char *LAYERS_PATHS[] = { - "/usr/local/etc/vulkan/explicit_layer.d", // Not used on macOS, okay to just ignore - "/usr/local/share/vulkan/explicit_layer.d", - "/etc/vulkan/explicit_layer.d", - "/usr/share/vulkan/explicit_layer.d", - ".local/share/vulkan/explicit_layer.d", + std::vector paths; + if (VKC_PLATFORM == PLATFORM_MACOS) { + static const char *LAYERS_PATHS[] = { + "/usr/local/share/vulkan/explicit_layer.d", + ".local/share/vulkan/explicit_layer.d", + }; + + for (std::size_t i = 0, n = std::size(LAYERS_PATHS); i < n; ++i) { + paths.push_back(LAYERS_PATHS[i]); + } + } else { + static const char *LAYERS_PATHS[] = { + "/usr/local/etc/vulkan/explicit_layer.d", + "/usr/local/share/vulkan/explicit_layer.d", + "/etc/vulkan/explicit_layer.d", + "/usr/share/vulkan/explicit_layer.d", + ".local/share/vulkan/explicit_layer.d", +#ifdef _DEBUG #ifdef INSTALL_FULL_DATAROOTDIR - INSTALL_FULL_DATAROOTDIR "/vulkan/explicit_layer.d", + INSTALL_FULL_DATAROOTDIR "/vulkan/explicit_layer.d", #endif #ifdef INSTALL_FULL_SYSCONFDIR - INSTALL_FULL_SYSCONFDIR "/vulkan/explicit_layer.d", + INSTALL_FULL_SYSCONFDIR "/vulkan/explicit_layer.d", #endif - }; +#endif //_DEBUG + }; - for (std::size_t i = 0, n = std::size(LAYERS_PATHS); i < n; ++i) { + for (std::size_t i = 0, n = std::size(LAYERS_PATHS); i < n; ++i) { + 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 = LAYERS_PATHS[i]; + info.path = paths[i]; result.push_back(info); } #endif @@ -293,7 +329,7 @@ void LayerManager::InitSystemPaths() { this->paths[LAYERS_PATHS_SDK].clear(); { LayersPathInfo info; - info.path = ::Get(Path::SDK_BIN); + info.path = ::Get(Path::SDK_EXPLICIT_LAYERS); info.enabled = true; this->paths[LAYERS_PATHS_SDK].push_back(info); } diff --git a/vkconfig_core/path.cpp b/vkconfig_core/path.cpp index 5fe5012ba5..8c0c011fee 100644 --- a/vkconfig_core/path.cpp +++ b/vkconfig_core/path.cpp @@ -38,10 +38,9 @@ struct BuiltinDesc { const Path::Builtin path; }; -static const BuiltinDesc VARIABLES[] = {{"${VK_HOME}", Path::HOME}, - {"${VK_APPDATA}", Path::APPDATA}, - {"${VULKAN_SDK}", Path::SDK}, - {"${VULKAN_CONTENT}", Path::CONTENT}}; +static const BuiltinDesc VARIABLES[] = { + {"${VK_HOME}", Path::HOME}, {"${VK_APPDATA}", Path::APPDATA}, {"${VULKAN_BIN}", Path::BIN}, + {"${VULKAN_SDK}", Path::SDK}, {"${VULKAN_PROFILES}", Path::PROFILES}, {"${VULKAN_CONTENT}", Path::CONTENT}}; static std::string ConvertSeparators(const std::string& path, const char* native_separator, const char* alien_separator) { const std::size_t native_separator_size = std::strlen(native_separator); @@ -355,60 +354,72 @@ static const Path GetLoaderSettingsPath() { } static const Path GetSDKPath() { + std::string result = qgetenv("VULKAN_SDK").toStdString(); + return result; +} + +static const Path GetExplicitLayersPath() { + const std::string TABLE[] = { + "/Bin", // ENVIRONMENT_WIN32 + "/share/vulkan/explicit_layer.d" // ENVIRONMENT_UNIX + }; + static_assert(std::size(TABLE) == ENVIRONMENT_COUNT); + + return GetSDKPath() + TABLE[VKC_ENV]; +} + +static const Path GetVulkanPath() { const char* TABLE[] = { - "", // PLATFORM_WINDOWS_X86 - "", // PLATFORM_WINDOWS_ARM - "/usr", // PLATFORM_LINUX - "/usr/local/share/vulkan", // PLATFORM_MACOS - "", // PLATFORM_ANDROID - "" // PLATFORM_IOS + "", // PLATFORM_WINDOWS_X86 + "", // PLATFORM_WINDOWS_ARM + "/usr", // PLATFORM_LINUX + "/usr/local", // PLATFORM_MACOS + "", // PLATFORM_ANDROID + "" // PLATFORM_IOS }; static_assert(std::size(TABLE) == PLATFORM_COUNT, "The tranlation table size doesn't match the enum number of elements"); - std::string result = qgetenv("VULKAN_SDK").toStdString(); - if (result.empty()) { - result = TABLE[VKC_PLATFORM]; - } else { // VULKAN_SDK may be set on macOS - if (VKC_PLATFORM == PLATFORM_MACOS) { - result += "/share/vulkan"; - } + Path path = GetSDKPath(); + if (path.Empty()) { + return TABLE[VKC_PLATFORM]; + } else { + return path; } - - return result; } -static const Path GetSDKBinPath() { - const char* TABLE[] = { +static const Path GetVulkanBinPath() { + const std::string TABLE[] = { "/Bin", // ENVIRONMENT_WIN32 - "/bin", // ENVIRONMENT_UNIX + "/bin" // ENVIRONMENT_UNIX }; static_assert(std::size(TABLE) == ENVIRONMENT_COUNT); - return GetSDKPath() + TABLE[VKC_ENV]; + Path path = GetVulkanPath(); + if (path.Empty()) { + return ""; + } + + return GetVulkanPath() + TABLE[VKC_ENV]; } -static const Path GetExplicitLayersPath() { - static const std::string TABLE[] = { - "/Bin", // ENVIRONMENT_WIN32 - "/etc/vulkan/explicit_layer.d" // ENVIRONMENT_UNIX +static const Path GetVulkanContentPath() { + const std::string TABLE[] = { + "/Config", // ENVIRONMENT_WIN32 + "/share/vulkan/config" // ENVIRONMENT_UNIX }; static_assert(std::size(TABLE) == ENVIRONMENT_COUNT); - return GetSDKPath().RelativePath() + TABLE[VKC_ENV]; + return GetVulkanPath().RelativePath() + TABLE[VKC_ENV]; } -static const Path GetVulkanContentPath() { - static const std::string TABLE[] = { - "/Config", // PLATFORM_WINDOWS_86 - "/Config", // PLATFORM_WINDOWS_ARM - "/share/vulkan/config", // PLATFORM_LINUX - "/config", // PLATFORM_MACOS - "N/A", // PLATFORM_ANDROID - "N/A" // PLATFORM_IOS +static const Path GetVulkanProfilesPath() { + const std::string TABLE[] = { + "/Config/VK_LAYER_KHRONOS_profiles", // ENVIRONMENT_WIN32 + "/share/vulkan/config/VK_LAYER_KHRONOS_profiles" // ENVIRONMENT_UNIX }; - static_assert(std::size(TABLE) == PLATFORM_COUNT); + static_assert(std::size(TABLE) == ENVIRONMENT_COUNT); - return GetSDKPath().RelativePath() + TABLE[VKC_PLATFORM]; + return GetVulkanPath().RelativePath() + TABLE[VKC_ENV]; } Path Get(Path::Builtin path) { @@ -430,14 +441,16 @@ Path Get(Path::Builtin path) { return ::GetLayersSettingsPath(); case Path::LOADER_SETTINGS: return ::GetLoaderSettingsPath(); + case Path::BIN: + return ::GetVulkanBinPath(); case Path::SDK: return ::GetSDKPath(); - case Path::SDK_BIN: - return ::GetSDKBinPath(); - case Path::EXPLICIT_LAYERS: + case Path::SDK_EXPLICIT_LAYERS: return ::GetExplicitLayersPath(); case Path::CONTENT: return ::GetVulkanContentPath(); + case Path::PROFILES: + return ::GetVulkanProfilesPath(); } } diff --git a/vkconfig_core/path.h b/vkconfig_core/path.h index 808a919e31..579ba484bf 100644 --- a/vkconfig_core/path.h +++ b/vkconfig_core/path.h @@ -34,10 +34,11 @@ class Path { CONFIGS, LAYERS_SETTINGS, LOADER_SETTINGS, + BIN, SDK, - SDK_BIN, - EXPLICIT_LAYERS, - CONTENT, + SDK_EXPLICIT_LAYERS, + PROFILES, + CONTENT }; Path(); diff --git a/vkconfig_core/test/test_executable_manager.cpp b/vkconfig_core/test/test_executable_manager.cpp index f629bf796c..b6888a33c4 100644 --- a/vkconfig_core/test/test_executable_manager.cpp +++ b/vkconfig_core/test/test_executable_manager.cpp @@ -33,20 +33,23 @@ TEST(test_executable_manager, reset_default_applications_sdk_found) { std::string result = qgetenv("VULKAN_SDK").toStdString(); if (!result.empty()) { - EXPECT_EQ(2, executables.size()); + EXPECT_EQ(3, executables.size()); // Make sure the variable are not replaced - EXPECT_TRUE(executables[0].path.RelativePath().find("${VULKAN_SDK}") != std::string::npos); - + EXPECT_TRUE(executables[0].path.RelativePath().find("${VULKAN_BIN}") != std::string::npos); const std::vector& options0 = executables[0].GetOptions(); - EXPECT_TRUE(options0[0].working_folder.RelativePath().find("${VULKAN_SDK}") != std::string::npos); + EXPECT_TRUE(options0[0].working_folder.RelativePath().find("${VULKAN_BIN}") != std::string::npos); EXPECT_TRUE(options0[0].log_file.RelativePath().find("${VK_HOME}") != std::string::npos); - EXPECT_TRUE(executables[1].path.RelativePath().find("${VULKAN_SDK}") != std::string::npos); - + EXPECT_TRUE(executables[1].path.RelativePath().find("${VULKAN_BIN}") != std::string::npos); const std::vector& options1 = executables[1].GetOptions(); - EXPECT_TRUE(options1[0].working_folder.RelativePath().find("${VULKAN_SDK}") != std::string::npos); + EXPECT_TRUE(options1[0].working_folder.RelativePath().find("${VULKAN_BIN}") != std::string::npos); EXPECT_TRUE(options1[0].log_file.RelativePath().find("${VK_HOME}") != std::string::npos); + + EXPECT_TRUE(executables[2].path.RelativePath().find("${VULKAN_BIN}") != std::string::npos); + const std::vector& options2 = executables[2].GetOptions(); + EXPECT_TRUE(options2[0].working_folder.RelativePath().find("${VULKAN_BIN}") != std::string::npos); + EXPECT_TRUE(options2[0].log_file.RelativePath().find("${VK_HOME}") != std::string::npos); } } @@ -58,20 +61,22 @@ TEST(test_executable_manager, reset_default_applications_no_sdk) { const std::vector& executables = executable_manager.GetExecutables(); - EXPECT_EQ(2, executables.size()); + EXPECT_EQ(3, executables.size()); - // Make sure the variable are not replaced EXPECT_TRUE(executables[0].path.RelativePath().find("vkcube") != std::string::npos); - const std::vector& options0 = executables[0].GetOptions(); EXPECT_TRUE(options0[0].working_folder.RelativePath().find(".") != std::string::npos); EXPECT_TRUE(options0[0].log_file.RelativePath().find("${VK_HOME}") != std::string::npos); EXPECT_TRUE(executables[1].path.RelativePath().find("vkcubepp") != std::string::npos); - const std::vector& options1 = executables[1].GetOptions(); EXPECT_TRUE(options1[0].working_folder.RelativePath().find(".") != std::string::npos); EXPECT_TRUE(options1[0].log_file.RelativePath().find("${VK_HOME}") != std::string::npos); + + EXPECT_TRUE(executables[2].path.RelativePath().find("vulkaninfo") != std::string::npos); + const std::vector& options2 = executables[2].GetOptions(); + EXPECT_TRUE(options2[0].working_folder.RelativePath().find(".") != std::string::npos); + EXPECT_TRUE(options2[0].log_file.RelativePath().find("${VK_HOME}") != std::string::npos); } TEST(test_executable_manager, remove_missing_applications) { diff --git a/vkconfig_core/test/test_path.cpp b/vkconfig_core/test/test_path.cpp index eb584ff073..31acf22df1 100644 --- a/vkconfig_core/test/test_path.cpp +++ b/vkconfig_core/test/test_path.cpp @@ -245,17 +245,9 @@ TEST(test_path, get_path_override_layers) { } TEST(test_path, get_path_vulkan_sdk) { - { -#ifdef __APPLE__ - qputenv("VULKAN_SDK", "~/VulkanSDK"); - const std::string value = AbsolutePath(Path::SDK); - EXPECT_STREQ(Path("~/VulkanSDK/share/vulkan").AbsolutePath().c_str(), value.c_str()); -#else - qputenv("VULKAN_SDK", "~/VulkanSDK"); - const std::string value = AbsolutePath(Path::SDK); - EXPECT_STREQ(Path("~/VulkanSDK").AbsolutePath().c_str(), value.c_str()); -#endif - } + qputenv("VULKAN_SDK", "~/VulkanSDK"); + const std::string value = AbsolutePath(Path::SDK); + EXPECT_STREQ(Path("~/VulkanSDK").AbsolutePath().c_str(), value.c_str()); } TEST(test_path, get_path_vulkan_content) { diff --git a/vkconfig_gui/CHANGELOG.md b/vkconfig_gui/CHANGELOG.md index 47fb989b94..c017e97ed2 100644 --- a/vkconfig_gui/CHANGELOG.md +++ b/vkconfig_gui/CHANGELOG.md @@ -1,9 +1,6 @@ ## Vulkan Configurator 3.0.0 - January 2025 https://github.com/LunarG/VulkanTools/tree/vkconfig3-dev -### TODO: -- Fix preset label display - ### Features: - Improve layers loading and selection: * Add loading of multiple versions of the same layer @@ -25,6 +22,7 @@ * Add *Vulkan Loader* selection of each logging message type - Split GUI and command line into two separated executables - Add system diagnostic +- Improve ${VULKAN_SDK} applied on executable, profiles and layers path when set ### Improvements: - Almost all Vulkan Configurator data is stored in a `$HOME` directory JSON file diff --git a/vkconfig_gui/mainwindow.ui b/vkconfig_gui/mainwindow.ui index 5d941f00bf..2a174586f0 100644 --- a/vkconfig_gui/mainwindow.ui +++ b/vkconfig_gui/mainwindow.ui @@ -83,7 +83,7 @@ QTabWidget::Rounded - 3 + 4 @@ -1684,7 +1684,7 @@ 5 - + Arial @@ -1710,7 +1710,7 @@ 7 - + Arial @@ -1720,7 +1720,7 @@ - <html><head/><body><p>Vulkan 1.3 Core API + all published: <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/index.html"><span style=" text-decoration: underline; color:#0000ff;">Chunked HTML</span></a>, <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/pdf/vkspec.pdf"><span style=" text-decoration: underline; color:#0000ff;">PDF</span></a>, <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html"><span style=" text-decoration: underline; color:#0000ff;">Single-file HTML</span></a></p></body></html> + Vulkan 1.3 Core API + all published: <a style="color:%s;" href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/index.html">Chunked HTML</a>, <a style="color:%s;" href="https://registry.khronos.org/vulkan/specs/1.3-extensions/pdf/vkspec.pdf">PDF</a>, <a style="color:%s;" href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html">Single-file HTML</a> Qt::RichText @@ -1734,7 +1734,7 @@ - + Arial @@ -1744,7 +1744,7 @@ - <html><head/><body><p>Vulkan 1.3 Core API: <a href="https://registry.khronos.org/vulkan/specs/1.3/html/index.html"><span style=" text-decoration: underline; color:#0000ff;">Chunked HTML</span></a>, <a href="https://registry.khronos.org/vulkan/specs/1.3/pdf/vkspec.pdf"><span style=" text-decoration: underline; color:#0000ff;">PDF</span></a>, <a href="https://registry.khronos.org/vulkan/specs/1.3/html/vkspec.html"><span style=" text-decoration: underline; color:#0000ff;">Single-file HTML</span></a></p></body></html> + Vulkan 1.3 Core API: <a style="color:%s;" href="https://registry.khronos.org/vulkan/specs/1.3/html/index.html">Chunked HTML</a>, <a style="color:%s;" href="https://registry.khronos.org/vulkan/specs/1.3/pdf/vkspec.pdf">PDF</a>, <a style="color:%s;" href="https://registry.khronos.org/vulkan/specs/1.3/html/vkspec.html">Single-file HTML</a> Qt::RichText @@ -1758,7 +1758,7 @@ - + Arial @@ -1768,7 +1768,7 @@ - <html><head/><body><p>Vulkan 1.3 Core API + Ratified Extensions: <a href="https://registry.khronos.org/vulkan/specs/1.3-khr-extensions/html/index.html"><span style=" text-decoration: underline; color:#0000ff;">Chunked HTML</span></a>, <a href="https://registry.khronos.org/vulkan/specs/1.3-khr-extensions/pdf/vkspec.pdf"><span style=" text-decoration: underline; color:#0000ff;">PDF</span></a>, <a href="https://registry.khronos.org/vulkan/specs/1.3-khr-extensions/html/vkspec.html"><span style=" text-decoration: underline; color:#0000ff;">Single-file HTML</span></a></p></body></html> + Vulkan 1.3 Core API + Ratified Extensions: <a style="color:%s;" href="https://registry.khronos.org/vulkan/specs/1.3-khr-extensions/html/index.html">Chunked HTML</a>, <a style="color:%s;" href="https://registry.khronos.org/vulkan/specs/1.3-khr-extensions/pdf/vkspec.pdf">PDF</a>, <a style="color:%s;" href="https://registry.khronos.org/vulkan/specs/1.3-khr-extensions/html/vkspec.html">Single-file HTML</a> Qt::RichText @@ -1785,7 +1785,7 @@ - + Arial @@ -1811,7 +1811,7 @@ 7 - + Arial @@ -1821,7 +1821,7 @@ - <a href="https://docs.vulkan.org/spec/latest/index.html">Official Vulkan Documentation</a> + <a style="color:%s;" href="https://docs.vulkan.org/spec/latest/index.html">Official Vulkan Documentation</a> Qt::RichText @@ -1835,7 +1835,7 @@ - + Arial @@ -1845,7 +1845,7 @@ - <a href="https://registry.khronos.org/vulkan/">Khronos Vulkan Registry</a> + <a style="color:%s;" href="https://registry.khronos.org/vulkan/">Khronos Vulkan Registry</a> Qt::RichText @@ -1859,7 +1859,7 @@ - + Arial @@ -1869,7 +1869,7 @@ - <a href="https://vulkan.gpuinfo.org/">vulkan.gpuinfo.org</a> + <a style="color:%s;" href="https://vulkan.gpuinfo.org/">vulkan.gpuinfo.org</a> Qt::RichText @@ -1886,7 +1886,7 @@ - + Arial @@ -1912,7 +1912,7 @@ 7 - + Arial @@ -1922,7 +1922,7 @@ - Vulkan SDK: <a href="https://vulkan.lunarg.com/doc/sdk/latest/windows/release_notes.html">Release Notes</a>, <a href="https://vulkan.lunarg.com/sdk/home">Download Page</a> + Vulkan SDK: <a style="color:%s;" href="https://vulkan.lunarg.com/doc/sdk/latest/windows/release_notes.html">Release Notes</a>, <a style="color:%s;" href="https://vulkan.lunarg.com/sdk/home">Download Page</a> Qt::RichText @@ -1936,7 +1936,7 @@ - + Arial @@ -1946,7 +1946,7 @@ - Vulkan Configurator: <a href="https://github.com/LunarG/VulkanTools/blob/main/vkconfig_gui/README.md">Readme</a>, <a href="https://github.com/LunarG/VulkanTools/blob/main/vkconfig_gui/CHANGELOG.md">Changelog</a> + Vulkan Configurator: <a style="color:%s;" href="https://github.com/LunarG/VulkanTools/blob/main/vkconfig_gui/README.md">Readme</a>, <a style="color:%s;" href="https://github.com/LunarG/VulkanTools/blob/main/vkconfig_gui/CHANGELOG.md">Changelog</a> Qt::RichText @@ -1960,7 +1960,7 @@ - + Arial @@ -1970,7 +1970,7 @@ - <html><head/><body><p>Vulkan Loader: <a href="https://vulkan.lunarg.com/doc/view/latest/windows/layer_configuration.html"><span style=" text-decoration: underline; color:#0000ff;">Layers Configuration</span></a>, <a href="https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderDebugging.md"><span style=" text-decoration: underline; color:#0000ff;">Loader Debugging Guide</span></a></p></body></html> + Vulkan Loader: <a style="color:%s;" href="https://vulkan.lunarg.com/doc/view/latest/windows/layer_configuration.html">Layers Configuration</a>, <a style="color:%s;" href="https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderDebugging.md">Loader Debugging Guide</a> Qt::RichText @@ -1984,7 +1984,7 @@ - + Arial @@ -1994,7 +1994,7 @@ - Vulkan Validation Layer: <a href="https://vulkan.lunarg.com/doc/sdk/latest/windows/khronos_validation_layer.html">Readme</a>, <a href="https://vulkan.lunarg.com/doc/sdk/latest/windows/validation_error_database.html">Coverage</a> + Vulkan Validation Layer: <a style="color:%s;" href="https://vulkan.lunarg.com/doc/sdk/latest/windows/khronos_validation_layer.html">Readme</a>, <a style="color:%s;" href="https://vulkan.lunarg.com/doc/sdk/latest/windows/validation_error_database.html">Coverage</a> Qt::RichText @@ -2008,7 +2008,7 @@ - + Arial @@ -2018,7 +2018,7 @@ - <html><head/><body><p>Vulkan API Capture and Replay - GFXReconstruct: <a href="https://vulkan.lunarg.com/doc/sdk/latest/windows/capture_tools.html"><span style=" text-decoration: underline; color:#0000ff;">Usage</span></a></p></body></html> + Vulkan API Capture and Replay - GFXReconstruct: <a style="color:%s;" href="https://vulkan.lunarg.com/doc/sdk/latest/windows/capture_tools.html">Usage</a> Qt::RichText @@ -2032,7 +2032,7 @@ - + Arial @@ -2042,7 +2042,7 @@ - <html><head/><body><p>Vulkan Profiles Tools: <a href="https://github.com/KhronosGroup/Vulkan-Profiles/blob/main/OVERVIEW.md"><span style=" text-decoration: underline; color:#0000ff;">Overview</span></a>, <a href="https://github.com/KhronosGroup/Vulkan-Profiles/blob/main/CHANGELOG.md"><span style=" text-decoration: underline; color:#0000ff;">Changelog</span></a>, <a href="https://www.lunarg.com/wp-content/uploads/2024/04/The-Vulkan-Profiles-Tools-LunarG-Christophe-Riccio-04-11-2024.pdf"><span style=" text-decoration: underline; color:#0000ff;">Whitepaper</span></a></p></body></html> + Vulkan Profiles Tools: <a style="color:%s;" href="https://github.com/KhronosGroup/Vulkan-Profiles/blob/main/OVERVIEW.md">Overview</a>, <a style="color:%s;" href="https://github.com/KhronosGroup/Vulkan-Profiles/blob/main/CHANGELOG.md">Changelog</a>, <a style="color:%s;" href="https://www.lunarg.com/wp-content/uploads/2024/04/The-Vulkan-Profiles-Tools-LunarG-Christophe-Riccio-04-11-2024.pdf">Whitepaper</a> Qt::RichText @@ -2059,7 +2059,7 @@ - + Arial @@ -2085,7 +2085,7 @@ 7 - + Arial @@ -2095,7 +2095,7 @@ - <html><head/><body><p><a href="https://discord.com/invite/vulkan"><span style=" text-decoration: underline; color:#0000ff;">Vulkan Discord</span></a> - <a href="https://reddit.com/r/vulkan"><span style=" text-decoration: underline; color:#0000ff;">Reddit</span></a> - <a href="https://stackoverflow.com/questions/tagged/vulkan"><span style=" text-decoration: underline; color:#0000ff;">Stack Overflow</span></a> - <a href="https://fosstodon.org/@vulkan"><span style=" text-decoration: underline; color:#0000ff;">Mastodon</span></a></p></body></html> + <a style="color:%s;" href="https://discord.com/invite/vulkan">Vulkan Discord</a> - <a style="color:%s;" href="https://reddit.com/r/vulkan">Reddit</a> - <a style="color:%s;" href="https://stackoverflow.com/questions/tagged/vulkan">Stack Overflow</a> - <a style="color:%s;" href="https://fosstodon.org/@vulkan">Mastodon</a> Qt::RichText diff --git a/vkconfig_gui/settings_tree.cpp b/vkconfig_gui/settings_tree.cpp index 37385bb3d1..ed65dadad3 100644 --- a/vkconfig_gui/settings_tree.cpp +++ b/vkconfig_gui/settings_tree.cpp @@ -23,6 +23,7 @@ #include "item_tree.h" #include "widget_setting.h" +#include "widget_setting_group.h" #include "widget_setting_int.h" #include "widget_setting_float.h" #include "widget_setting_frames.h" @@ -210,11 +211,16 @@ void SettingsTreeManager::BuildTreeItem(QTreeWidgetItem *parent, const SettingMe } item->setExpanded(parameter->GetExpanded(meta_object.key.c_str())); + const SettingDependenceMode enabled = ::CheckDependence(meta_object, parameter->settings); + item->setHidden(enabled == SETTING_DEPENDENCE_HIDE); + item->setDisabled(enabled != SETTING_DEPENDENCE_ENABLE); + switch (meta_object.type) { case SETTING_GROUP: { - item->setText(0, meta_object.label.c_str()); - item->setToolTip(0, meta_object.description.c_str()); - item->setFont(0, this->ui->configurations_settings->font()); + const SettingMetaGroup &meta = static_cast(meta_object); + + WidgetSettingGroup *widget = new WidgetSettingGroup(this->ui->configurations_settings, item, meta, parameter->settings); + this->connect(widget, SIGNAL(itemChanged()), this, SLOT(OnSettingChanged())); } break; case SETTING_BOOL: case SETTING_BOOL_NUMERIC_DEPRECATED: { diff --git a/vkconfig_gui/tab_applications.cpp b/vkconfig_gui/tab_applications.cpp index 7f59167a22..c5b5349a6f 100644 --- a/vkconfig_gui/tab_applications.cpp +++ b/vkconfig_gui/tab_applications.cpp @@ -446,17 +446,17 @@ void TabApplications::on_launch_button_pressed() { Configuration *configuration = configurator.configurations.FindConfiguration(active_executable->configuration); QStringList env = QProcess::systemEnvironment(); - if (!options->envs.empty()) { const QStringList envs = ConvertString(options->envs); env << envs; } this->_launch_application->setEnvironment(env); + QStringList args; if (!options->args.empty()) { - const QStringList args = ConvertString(options->args); - this->_launch_application->setArguments(args); + args = ConvertString(options->args); } + this->_launch_application->setArguments(args); this->ui->launch_button->setText("Terminate"); this->_launch_application->start(QIODevice::ReadOnly | QIODevice::Unbuffered); diff --git a/vkconfig_gui/tab_configurations.cpp b/vkconfig_gui/tab_configurations.cpp index f98371b41d..09d1a7646e 100644 --- a/vkconfig_gui/tab_configurations.cpp +++ b/vkconfig_gui/tab_configurations.cpp @@ -248,8 +248,9 @@ void TabConfigurations::UpdateUI_Layers(UpdateUIMode mode) { } } - ListItem *item = new ListItem(parameter.key.c_str()); + QListWidgetItem *item = new ListItem(parameter.key.c_str()); item->setFlags(item->flags() | Qt::ItemIsSelectable); + item->setSizeHint(QSize(0, ITEM_HEIGHT)); if (has_multiple_parameter) { item->setIcon(QIcon(":/resourcefiles/drag.png")); } diff --git a/vkconfig_gui/tab_documentation.cpp b/vkconfig_gui/tab_documentation.cpp index ae47b60412..bb098944db 100644 --- a/vkconfig_gui/tab_documentation.cpp +++ b/vkconfig_gui/tab_documentation.cpp @@ -21,7 +21,55 @@ #include "tab_documentation.h" #include "mainwindow.h" -TabDocumentation::TabDocumentation(MainWindow &window, std::shared_ptr ui) : Tab(TAB_DOCUMENTATION, window, ui) {} +static void UpdateColor1(QLabel *label, const QColor &color) { + std::string ref = label->text().toStdString(); + const std::string hex = color.name().toStdString(); + std::string text = format(ref.c_str(), hex.c_str()); + label->setText(text.c_str()); +} + +static void UpdateColor2(QLabel *label, const QColor &color) { + std::string ref = label->text().toStdString(); + const std::string hex = color.name().toStdString(); + std::string text = format(ref.c_str(), hex.c_str(), hex.c_str()); + label->setText(text.c_str()); +} + +static void UpdateColor3(QLabel *label, const QColor &color) { + std::string ref = label->text().toStdString(); + const std::string hex = color.name().toStdString(); + std::string text = format(ref.c_str(), hex.c_str(), hex.c_str(), hex.c_str()); + label->setText(text.c_str()); +} + +static void UpdateColor4(QLabel *label, const QColor &color) { + std::string ref = label->text().toStdString(); + const std::string hex = color.name().toStdString(); + std::string text = format(ref.c_str(), hex.c_str(), hex.c_str(), hex.c_str(), hex.c_str()); + label->setText(text.c_str()); +} + +TabDocumentation::TabDocumentation(MainWindow &window, std::shared_ptr ui) : Tab(TAB_DOCUMENTATION, window, ui) { + QPalette palette = this->ui->documentation_spec->palette(); + QColor color = palette.color(QPalette::Text); + + ::UpdateColor3(this->ui->documentation_spec0, color); + ::UpdateColor3(this->ui->documentation_spec1, color); + ::UpdateColor3(this->ui->documentation_spec2, color); + + ::UpdateColor1(this->ui->documentation_doc0, color); + ::UpdateColor1(this->ui->documentation_doc1, color); + ::UpdateColor1(this->ui->documentation_doc2, color); + + ::UpdateColor2(this->ui->documentation_sdk0, color); + ::UpdateColor2(this->ui->documentation_sdk1, color); + ::UpdateColor2(this->ui->documentation_sdk2, color); + ::UpdateColor2(this->ui->documentation_sdk3, color); + ::UpdateColor1(this->ui->documentation_sdk4, color); + ::UpdateColor3(this->ui->documentation_sdk5, color); + + ::UpdateColor4(this->ui->documentation_com0, color); +} TabDocumentation::~TabDocumentation() {} diff --git a/vkconfig_gui/tab_layers.cpp b/vkconfig_gui/tab_layers.cpp index 6ead9c2268..660470f6d4 100644 --- a/vkconfig_gui/tab_layers.cpp +++ b/vkconfig_gui/tab_layers.cpp @@ -62,7 +62,7 @@ void TabLayers::UpdateUI_LayersPaths(UpdateUIMode ui_update_mode) { for (std::size_t i = 0, n = paths_group.size(); i < n; ++i) { QTreeWidgetItem *item_state = new QTreeWidgetItem; item_state->setFlags(item_state->flags() | Qt::ItemIsSelectable); - item_state->setSizeHint(0, QSize(0, 32)); + item_state->setSizeHint(0, QSize(0, ITEM_HEIGHT)); LayersPathWidget *layer_path_widget = new LayersPathWidget(paths_group[i], group_path); this->connect(layer_path_widget, SIGNAL(itemChanged()), this, SLOT(on_check_box_paths_changed())); diff --git a/vkconfig_gui/vkconfig.pro b/vkconfig_gui/vkconfig.pro index 9e9543166b..c1747f3cde 100644 --- a/vkconfig_gui/vkconfig.pro +++ b/vkconfig_gui/vkconfig.pro @@ -81,6 +81,7 @@ SOURCES += \ widget_tab_configurations_layer.cpp \ widget_tab_layers_path.cpp \ widget_setting.cpp \ + widget_setting_group.cpp \ widget_setting_bool.cpp \ widget_setting_enum.cpp \ widget_setting_filesystem.cpp \ @@ -160,6 +161,7 @@ HEADERS += \ widget_tab_configurations_layer.h \ widget_tab_layers_path.h \ widget_setting.h \ + widget_setting_group.h \ widget_setting_bool.h \ widget_setting_enum.h \ widget_setting_filesystem.h \ diff --git a/vkconfig_gui/widget_setting_enum.h b/vkconfig_gui/widget_setting_enum.h index 5f707cfbd3..92ae059ab4 100644 --- a/vkconfig_gui/widget_setting_enum.h +++ b/vkconfig_gui/widget_setting_enum.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2021 Valve Corporation - * Copyright (c) 2020-2021 LunarG, Inc. + * Copyright (c) 2020-2024 Valve Corporation + * Copyright (c) 2020-2024 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_group.cpp b/vkconfig_gui/widget_setting_group.cpp new file mode 100644 index 0000000000..6920dab3cf --- /dev/null +++ b/vkconfig_gui/widget_setting_group.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2020-2024 Valve Corporation + * Copyright (c) 2020-2024 LunarG, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Authors: + * - Christophe Riccio + */ + +#include "widget_setting_group.h" + +#include + +WidgetSettingGroup::WidgetSettingGroup(QTreeWidget* tree, QTreeWidgetItem* item, const SettingMetaGroup& meta, + SettingDataSet& data_set) + : WidgetSettingBase(tree, item), meta(meta), data_set(data_set) { + this->item->setText(0, meta.label.c_str()); + this->item->setToolTip(0, meta.description.c_str()); + this->item->setFont(0, tree->font()); + + this->item->setSizeHint(0, QSize(0, ITEM_HEIGHT)); + this->tree->setItemWidget(this->item, 0, this); + + this->Refresh(REFRESH_ENABLE_AND_STATE); +} + +void WidgetSettingGroup::Refresh(RefreshAreas refresh_areas) { + const SettingDependenceMode enabled = ::CheckDependence(this->meta, this->data_set); + + this->item->setHidden(enabled == SETTING_DEPENDENCE_HIDE); + this->item->setDisabled(enabled != SETTING_DEPENDENCE_ENABLE); + this->setEnabled(enabled == SETTING_DEPENDENCE_ENABLE); +} diff --git a/vkconfig_gui/widget_setting_group.h b/vkconfig_gui/widget_setting_group.h new file mode 100644 index 0000000000..6290d6a378 --- /dev/null +++ b/vkconfig_gui/widget_setting_group.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2020-2024 Valve Corporation + * Copyright (c) 2020-2024 LunarG, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Authors: + * - Christophe Riccio + */ + +#pragma once + +#include "../vkconfig_core/setting_group.h" + +#include "widget_setting.h" + +#include + +class WidgetSettingGroup : public WidgetSettingBase { + Q_OBJECT + + public: + explicit WidgetSettingGroup(QTreeWidget* tree, QTreeWidgetItem* item, const SettingMetaGroup& meta, SettingDataSet& data_set); + + void Refresh(RefreshAreas refresh_areas) override; + + private: + const SettingMetaGroup& meta; + SettingDataSet& data_set; +}; diff --git a/vkconfig_gui/widget_tab_configurations_layer.cpp b/vkconfig_gui/widget_tab_configurations_layer.cpp index 5f195836df..74a194f3e1 100644 --- a/vkconfig_gui/widget_tab_configurations_layer.cpp +++ b/vkconfig_gui/widget_tab_configurations_layer.cpp @@ -93,10 +93,6 @@ ConfigurationLayerWidget::ConfigurationLayerWidget(TabConfigurations *tab, const } else if (!parameter.manifest.Empty()) { this->setToolTip(parameter.manifest.AbsolutePath().c_str()); } - - this->layer_state->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); - this->layer_state->setSizeAdjustPolicy(QComboBox::AdjustToContents); - this->layer_state->adjustSize(); } bool ConfigurationLayerWidget::eventFilter(QObject *target, QEvent *event) { @@ -123,8 +119,9 @@ void ConfigurationLayerWidget::resizeEvent(QResizeEvent *event) { this->layer_state->adjustSize(); const int width_state = this->layer_state->width(); + const int height_state = this->layer_state->height(); - const QRect state_button_rect = QRect(size.width() - width_state, 0, width_state, size.height()); + const QRect state_button_rect = QRect(size.width() - width_state, 0, width_state, height_state); this->layer_state->setGeometry(state_button_rect); } }