diff --git a/CMakeLists.txt b/CMakeLists.txt
index ee99f65c88..c49e6d9278 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,7 +30,6 @@ find_package(valijson REQUIRED CONFIG)
option(BUILD_TESTS "Build tests")
option(RUN_ON_GITHUB "Build only tests that can run on Github" OFF)
-option(BUILD_EXPERIMENTAL "Build tests for debugging layers" OFF)
if(BUILD_TESTS)
enable_testing()
@@ -116,8 +115,6 @@ if(BUILD_LAYERMGR)
endif()
add_subdirectory(vkconfig_core)
- add_subdirectory(vkconfig)
- if(BUILD_EXPERIMENTAL)
- add_subdirectory(vkconfig3)
- endif()
+ add_subdirectory(vkconfig_cmd)
+ add_subdirectory(vkconfig_gui)
endif()
diff --git a/scripts/github_ci_linux.py b/scripts/github_ci_linux.py
index 42710d3b90..752dbb849e 100644
--- a/scripts/github_ci_linux.py
+++ b/scripts/github_ci_linux.py
@@ -85,7 +85,7 @@ def BuildVT(args):
print("Run Vulkan Tools Tests")
os.chdir(VT_BUILD_DIR)
- test_cmd = 'ctest --parallel %s --output-on-failure --config %s' % (os.cpu_count(), args.configuration)
+ test_cmd = 'ctest --parallel %s --output-on-failure' % (os.cpu_count())
RunShellCmd(test_cmd, VT_BUILD_DIR)
print("Build Vulkan Configurator with QtCreator")
diff --git a/vkconfig/README.md b/vkconfig/README.md
deleted file mode 100644
index 1c574998fd..0000000000
--- a/vkconfig/README.md
+++ /dev/null
@@ -1,161 +0,0 @@
-
-
-Copyright © 2015-2024 LunarG, Inc.
-
-[![Creative Commons][3]][4]
-
-[3]: https://i.creativecommons.org/l/by-nd/4.0/88x31.png "Creative Commons License"
-[4]: https://creativecommons.org/licenses/by-nd/4.0/
-
-
-
-*Vulkan Configurator* allows overriding the [layers configuration](https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderInterfaceArchitecture.md#layers) used by Vulkan applications at runtime.
-
-A Vulkan application may configure layers when creating a Vulkan Instance. This layers configuration may be overridden using *Vulkan Configurator* globally or for a selected list of Vulkan applications.
-
-Finally *Vulkan Configurator* allows using layers from user-defined directories.
-
-* **[Change Log](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/CHANGELOG.md)**: The history of *Vulkan Configurator* releases.
-* **[Bug reports](https://github.com/LunarG/VulkanTools/issues)**: Open a GitHub issue when you encounter a bug.
-* **[Roadmap](https://github.com/LunarG/VulkanTools/projects/2)**: Follow *Vulkan Configurator* future developments.
-* **[Contributing](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/CONTRIBUTING.md)**: Submit a fix or a feature to *Vulkan Configurator*.
-
---------------
-## Platforms Support
-
-| OS | Windows | Linux | macOS | iOS | Android |
-| --------| ------------------ | ------------------- | ------------------ | ------- | ------- |
-| Support | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: |
-
---------------
-## Downloads
-
-*Vulkan Configurator* is delivered with the [Vulkan SDK](https://vulkan.lunarg.com/sdk/home).
-
---------------
-## Using the Vulkan Configurator
-
-Vulkan Configurator is a graphical user interface (GUI) that may be launched from the console using `vkconfig`.
-
-The tool is distributed differently, depending on the platform:
-- Ubuntu packages: Upon installing the `lunarg-vkconfig` package, the tools will be available from the command line as `vkconfig`.
-- Linux tarball: The vkconfig executable comes pre-built; be sure Qt is installed to run it. Run vkconfig on the command line.
- - On Ubuntu 20.04 Qt can be installed by running `sudo apt install qt5-default`
-- Windows: The tool will be present on the start menu, in the Vulkan SDK menu. User can also invoke from a command line.
-- macOS: The tool is provided as an application bundle. Run it by double-clicking the bundle from a Finder window.
-
-Vulkan Configurator may be used with command line arguments to override layers. Use `vkconfig --help` in the console for more information.
-
-On Windows 10, Vulkan Configurator can't output to 'Command Prompt' without a redirection to a file because it's a win32 application.
-As a workaround, we can run Vulkan Configurator from 'MSYS'.
-
-![Vulkan Configurator Animated Presentation](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/images/presentation.gif)
-
-
-### Selecting an Application
-
-The typical use-case for VkConfig is to make changes and run applications while the tool is still open so
-that any changes made are not carried over when the tool exits.
-Because of this, VkConfig has an application launcher built in which allows you to select which
-application to run.
-
-![Application Selection](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/images/vkconfig_applications_collapsed.png)
-
-Select between any previously-defined applications by clicking the down-facing error on the right of
-the application line.
-The application selection can also be expanded so the application name, executable path, command-line
-arguments, and even the log file can be edited.
-To edit these fields in-place, expand the application area by simply expanding the arrow to the left of
-the word "Application".
-
-![Application Selection Expanded](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/images/vkconfig_applications_expanded.png)
-
-To add or further edit an application in the launcher, click the 3 periods (`...`) to the far right
-of the application field.
-This will expand to an application dialog where applications can be added, edited, or removed.
-
-![Application Dialog](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/images/vkconfig_applications_dialog.png)
-
-
-### Applications Listed by Name
-
-Applications are now listed by name so the same application can be added with different names and
-different command-line arguments.
-
-For example, "Rise of the Tomb Raider" and "Half-Life 2" are both available through Valve's Steam
-store.
-In order to run both application's, the `steam` executable must first be run, but with different
-arguments.
-Because applications are now listed by name, it is now possible to add both to the Application list so
-they can be triggered individually.
-This removes the need to edit the command-line when switching between them previously.
-
-This may also prove useful if running the same application with one or more different command-line
-arguments.
-
-
---------------
-## Terminology
-
-***[Vulkan Layer](https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderInterfaceArchitecture.md#layers)***: A layer is an optional library that can intercept Vulkan functions on their way from the Vulkan application down to the Vulkan drivers. Multiple layers can be chained together to use multiple layer functionalities simultaneously.
-
-***Vulkan Layers Configuration***: A collection of Vulkan Layers executed in [a specific order](#vulkan-layers-execution-order-overview) with specific settings for each layer.
-
-***[Vulkan Explicit Layers vs Implicit Layer](https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderApplicationInterface.md#implicit-vs-explicit-layers)***: An explicit layer has to be explicitly activated by the user from source in `vkCreateInstance`, using Vulkan Configurator or `VK_INSTANCE_LAYERS` environment variable. Implicit layers are enabled by their existence on the system by default.
-
-***[Vulkan Meta-Layer](https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderLayerInterface.md#override-meta-layer)***: Meta-layers are a special kind of layer which is only available through the desktop [Vulkan Loader](https://github.com/KhronosGroup/Vulkan-Loader). While usual layers are associated with one particular library, a meta-layer is actually a collection layer which contains an ordered list of other layers called *component layers*.
-
-***Vulkan Override Layer***: The Vulkan Override Layer is an implicit meta-layer found on the system with the name `VK_LAYER_LUNARG_override`. It is the mechanism used by *Vulkan Configurator* to override Vulkan applications layers. This layer contains:
-- The ordered list of layers to activate
-- The list of layers to exclude from execution
-- The list of paths to executables that the layers override applies to. If this list is empty, the override is applied to every application upon startup.
-
-***Vulkan Layer settings***: Per-layer settings loaded by each layer library and stored in the `vk_layer_settings.txt` file. This file is located either next to the Vulkan application executable or set globally and applied to all Vulkan applications thanks to *Vulkan Configurator*. These settings are described [here for VK_LAYER_KHRONOS_validation](https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/main/layers/vk_layer_settings.txt) and [here for other layers created by LunarG](https://github.com/LunarG/VulkanTools/blob/main/layersvt/vk_layer_settings.txt).
-
---------------
-## Vulkan Layers execution order overview
-
-[ ![Vulkan Loader](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/images/vulkan_layers_order_small.png) ](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/images/vulkan_layers_order.png)
-
---------------
-## Vulkan Loader and Layers implementation overview
-
-[ ![Vulkan Loader](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/images/vulkan_loader_640px.png) ](https://github.com/LunarG/VulkanTools/blob/main/vkconfig/images/vulkan_loader.png)
-
-For detailed information, read the [Architecture of the Vulkan Loader Interfaces](https://github.com/KhronosGroup/Vulkan-Loader/blob/main/loader/LoaderAndLayerInterface.md) document.
-
-## Vulkan Layers Settings
-
-### `vk_layer_settings.txt`
-
-The layer settings are stored into the `vk_layer_settings.txt` file and read directly by the layers.
-
-When *Vulkan Configurator is used to override layers, the Vulkan application local `vk_layer_settings.txt` file is ignored by layer ecosystem convention.
-
-*Vulkan Configurator* does not make any system-wide changes to a system, but it does make user-specific changes.
-These changes are documented below:
-
-#### Linux and macOS
-
-Unix systems store files in the following paths:
-
-- `$HOME/.local/share/vulkan/implicit_layer.d/VkLayer_override.json` tells a Vulkan application which layers to use
-- `$HOME/.local/share/vulkan/settings.d/vk_layer_settings.txt` tells Vulkan layers which settings to use
-
-#### Windows
-
-Windows systems store files in the following paths:
-
-- `%HOME%\AppData\Local\LunarG\vkconfig\override\VkLayerOverride.json` tells a Vulkan application which layers to use
-- `%HOME%\AppData\Local\LunarG\vkconfig\override\vk_layer_settings.txt` tells Vulkan layers which settings to use
-
-In addition, Windows system create registry entries in the following locations:
-
-- `HKEY_CURRENT_USER\Software\Khronos\Vulkan\ImplicitLayers` will have an entry that points to the JSON file above
-- `HKEY_CURRENT_USER\Software\Khronos\Vulkan\Settings` will have an entry that points to the text file above
-- `HKEY_CURRENT_USER\Software\LunarG\vkconfig` stores the application settings for `vkconfig`
-
-### Environment Variables (Deprecated)
-
-OS Environment Variables are the legacy approach to configure layers however they should be considered deprecated in favor of using `vk_layer_settings.txt` either locally, next to the Vulkan Applications or globally, generated from *Vulkan Configurator*.
-
diff --git a/vkconfig/configurator.cpp b/vkconfig/configurator.cpp
deleted file mode 100644
index ed757d51c6..0000000000
--- a/vkconfig/configurator.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * 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:
- * - Lenny Komow
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#include "configurator.h"
-#include "vulkan_util.h"
-
-#include "dialog_layers.h"
-
-#include "../vkconfig_core/util.h"
-#include "../vkconfig_core/path.h"
-#include "../vkconfig_core/override.h"
-#include "../vkconfig_core/alert.h"
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-Configurator &Configurator::Get(const std::string &VULKAN_SDK) {
- static Configurator configurator(VULKAN_SDK);
- return configurator;
-}
-
-Configurator::Configurator(const std::string &VULKAN_SDK)
- : path(VULKAN_SDK, SUPPORTED_CONFIG_FILES), environment(path), layers(environment), configurations(environment) {}
-
-Configurator::~Configurator() {
- configurations.SaveAllConfigurations(layers.selected_layers);
-
- SurrenderConfiguration(environment);
-}
-
-bool Configurator::Init() {
- std::string selected_configuration = this->environment.GetSelectedConfiguration();
-
- this->ActivateConfiguration("");
-
- this->UpdateDevices();
-
- // Load simple app settings, the additional search paths, and the
- // override app list.
- this->layers.LoadAllInstalledLayers();
-
- QSettings settings;
- if (settings.value("crashed", QVariant(false)).toBool()) {
- settings.setValue("crashed", false);
-
- if (Alert::ConfiguratorCrashed() == QMessageBox::No) {
- this->configurations.LoadAllConfigurations(this->layers.selected_layers);
- }
- } else {
- this->configurations.LoadAllConfigurations(this->layers.selected_layers);
- }
-
- if (this->configurations.Empty()) {
- this->configurations.ResetDefaultsConfigurations(layers.selected_layers);
- } else {
- this->configurations.FirstDefaultsConfigurations(layers.selected_layers);
- }
-
- this->ActivateConfiguration(selected_configuration);
-
- return true;
-}
-
-void Configurator::ActivateConfiguration(const std::string &configuration_name) {
- Configuration *configuration = nullptr;
- if (!configuration_name.empty()) {
- configuration = FindByKey(this->configurations.available_configurations, configuration_name.c_str());
- }
-
- if (configuration_name.empty()) {
- this->environment.SetSelectedConfiguration("");
- this->configurations.Configure(this->layers.selected_layers);
- } else if (configuration == nullptr) {
- QMessageBox alert;
- alert.QDialog::setWindowTitle("Vulkan layers configuration is missing...");
- const std::string text = format("%s couldn't find '%s' layers configuration.", VKCONFIG_NAME, configuration_name.c_str());
- alert.setText(text.c_str());
- alert.setInformativeText("Vulkan Configurator is switching to Layers Controlled by Vulkan Application mode");
- alert.setIcon(QMessageBox::Critical);
- alert.exec();
-
- this->environment.SetSelectedConfiguration("");
- this->environment.SetMode(LAYERS_MODE_BY_APPLICATIONS);
- this->configurations.Configure(this->layers.selected_layers);
- } else {
- // If the layers paths are differents, we need to reload the layers and the configurations
- const std::vector paths = this->environment.GetUserDefinedLayersPaths(USER_DEFINED_LAYERS_PATHS_GUI);
- if (configuration->user_defined_paths != paths) {
- this->configurations.SaveAllConfigurations(this->layers.selected_layers);
- this->environment.SetPerConfigUserDefinedLayersPaths(configuration->user_defined_paths);
- this->layers.LoadAllInstalledLayers();
- this->configurations.LoadAllConfigurations(this->layers.selected_layers);
- }
-
- this->environment.SetSelectedConfiguration(configuration_name.c_str());
-
- std::string missing_layer;
- if (::HasMissingLayer(configuration->parameters, layers.selected_layers, missing_layer)) {
- QMessageBox alert;
- alert.QDialog::setWindowTitle("Vulkan layer missing...");
- alert.setText(format("%s couldn't find '%s' layer required by '%s' configuration:", VKCONFIG_NAME,
- missing_layer.c_str(), configuration->key.c_str())
- .c_str());
- alert.setInformativeText("Do you want to edit the configuration to locate the layer?");
- alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
- alert.setDefaultButton(QMessageBox::Yes);
- alert.setIcon(QMessageBox::Warning);
- if (alert.exec() == QMessageBox::Yes) {
- LayersDialog dlg(nullptr, *configuration);
- dlg.exec();
-
- ActivateConfiguration(configuration->key);
- }
- } else {
- this->configurations.Configure(this->layers.selected_layers);
- }
- }
-}
-
-void Configurator::UpdateDevices() {
- QLibrary library(GetVulkanLibrary());
-
- VkInstance instance = VK_NULL_HANDLE;
- VkResult err = CreateInstance(library, instance, false);
-
- if (err != VK_SUCCESS) {
- err = CreateInstance(library, instance, true);
- if (err != VK_SUCCESS) {
- return;
- }
- }
-
- PFN_vkEnumeratePhysicalDevices pfnEnumeratePhysicalDevices =
- (PFN_vkEnumeratePhysicalDevices)library.resolve("vkEnumeratePhysicalDevices");
- PFN_vkDestroyInstance pfnDestroyInstance = (PFN_vkDestroyInstance)library.resolve("vkDestroyInstance");
- PFN_vkGetPhysicalDeviceProperties pfnGetPhysicalDeviceProperties =
- (PFN_vkGetPhysicalDeviceProperties)library.resolve("vkGetPhysicalDeviceProperties");
-
- if (pfnEnumeratePhysicalDevices == nullptr || pfnDestroyInstance == nullptr || pfnGetPhysicalDeviceProperties == nullptr) {
- return;
- }
-
- uint32_t gpu_count = 0;
- err = pfnEnumeratePhysicalDevices(instance, &gpu_count, NULL);
- assert(!err);
-
- std::vector devices;
- if (gpu_count > 0) {
- devices.resize(gpu_count);
-
- err = pfnEnumeratePhysicalDevices(instance, &gpu_count, &devices[0]);
- assert(!err);
- }
-
- this->device_names.clear();
- for (std::size_t i = 0, n = devices.size(); i < n; ++i) {
- VkPhysicalDeviceProperties properties;
- pfnGetPhysicalDeviceProperties(devices[i], &properties);
-
- this->device_names.push_back(properties.deviceName);
- }
-
- pfnDestroyInstance(instance, NULL);
-}
-
-bool Configurator::SupportDifferentLayerVersions(Version *return_loader_version) const {
- // Check loader version
- const Version version = GetVulkanLoaderVersion();
- assert(version != Version::VERSION_NULL);
-
- if (return_loader_version) {
- *return_loader_version = version;
- }
-
- return version >= Version("1.3.212");
-}
-
-bool Configurator::SupportApplicationList(Version *return_loader_version) const {
- // Check loader version
- const Version version = GetVulkanLoaderVersion();
- assert(version != Version::VERSION_NULL);
-
- if (return_loader_version) {
- *return_loader_version = version;
- }
-
- return version >= Version("1.2.141");
-}
-
-void Configurator::ResetToDefault(bool hard) {
- if (hard) {
- this->environment.Reset(Environment::CLEAR);
- this->layers.LoadAllInstalledLayers();
- this->configurations.ResetDefaultsConfigurations(this->layers.selected_layers);
-
- this->ActivateConfiguration(this->environment.GetSelectedConfiguration());
- } else {
- this->configurations.ReloadDefaultsConfigurations(this->layers.selected_layers);
- }
-}
-
-std::vector Configurator::GetDeviceNames() const { return device_names; }
diff --git a/vkconfig/dialog_about.cpp b/vkconfig/dialog_about.cpp
deleted file mode 100644
index 982058e889..0000000000
--- a/vkconfig/dialog_about.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#include "dialog_about.h"
-
-AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::dialog_about) {
- ui->setupUi(this);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
- connect(ui->pbAboutQt, SIGNAL(clicked()), this, SLOT(aboutQt()));
-}
-
-void AboutDialog::aboutQt() { qApp->aboutQt(); }
diff --git a/vkconfig/dialog_about.ui b/vkconfig/dialog_about.ui
deleted file mode 100644
index 399364cc8a..0000000000
--- a/vkconfig/dialog_about.ui
+++ /dev/null
@@ -1,220 +0,0 @@
-
-
- dialog_about
-
-
-
- 0
- 0
- 417
- 195
-
-
-
-
- 0
- 0
-
-
-
-
- 417
- 195
-
-
-
-
- 417
- 195
-
-
-
-
- Arial
- 10
-
-
-
- About Vulkan Configurator
-
-
-
-
- 80
- 150
- 301
- 32
-
-
-
- Qt::Horizontal
-
-
- QDialogButtonBox::Close
-
-
-
-
-
- 180
- 20
- 241
- 41
-
-
-
-
- Arial
- 10
- 50
- false
-
-
-
- Qt::LeftToRight
-
-
- Copyright (c) 2020-2024 LunarG, Inc.
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
- true
-
-
-
-
-
- 180
- 50
- 251
- 31
-
-
-
-
- Arial
- 10
- 50
- false
-
-
-
- Licensed under Apache 2.0
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
- true
-
-
-
-
-
- 20
- 10
- 161
- 71
-
-
-
-
-
-
- :/resourcefiles/lunarg_logo.png
-
-
-
-
-
- 130
- 100
- 231
- 41
-
-
-
-
- Arial
- 10
- 50
- false
-
-
-
- Qt licensed under LGPL 3.0
-
-
- true
-
-
-
-
-
- 130
- 150
- 81
- 32
-
-
-
- About Qt
-
-
-
-
-
- 20
- 100
- 91
- 81
-
-
-
-
-
-
- :/resourcefiles/qt_logo.png
-
-
-
-
-
-
-
-
- buttonBox
- accepted()
- dialog_about
- accept()
-
-
- 248
- 254
-
-
- 157
- 274
-
-
-
-
- buttonBox
- rejected()
- dialog_about
- reject()
-
-
- 316
- 260
-
-
- 286
- 274
-
-
-
-
-
diff --git a/vkconfig/dialog_applications.cpp b/vkconfig/dialog_applications.cpp
deleted file mode 100644
index 07053cc16e..0000000000
--- a/vkconfig/dialog_applications.cpp
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#include "dialog_applications.h"
-#include "configurator.h"
-
-#include "../vkconfig_core/alert.h"
-
-#include
-#include
-#include
-#include
-
-#include
-
-ApplicationsDialog::ApplicationsDialog(QWidget *parent)
- : QDialog(parent), ui(new Ui::dialog_applications()), _last_selected_application_index(-1) {
- ui->setupUi(this);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
- Configurator &configurator = Configurator::Get();
-
- // The header is hidden by default and stays hidden when no checkboxes are used.
- if (!configurator.environment.GetUseApplicationList())
- setWindowTitle("Vulkan Applications Launcher Shortcuts");
- else {
- ui->treeWidget->setHeaderHidden(false);
- ui->treeWidget->setHeaderLabel("Check to override Vulkan layers");
- }
-
- // Show the current list
- const std::vector &applications = configurator.environment.GetApplications();
- for (std::size_t i = 0, n = applications.size(); i < n; ++i) {
- CreateApplicationItem(applications[i]);
- }
-
- ui->treeWidget->installEventFilter(this);
-
- connect(ui->treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this,
- SLOT(selectedPathChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
- connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(itemChanged(QTreeWidgetItem *, int)));
- connect(ui->lineEditAppName, SIGNAL(textEdited(const QString &)), this, SLOT(editAppName(const QString &)));
- connect(ui->lineEditExecutable, SIGNAL(textEdited(const QString &)), this, SLOT(editExecutable(const QString &)));
- connect(ui->lineEditCmdArgs, SIGNAL(textEdited(const QString &)), this, SLOT(editCommandLine(const QString &)));
- connect(ui->lineEditWorkingFolder, SIGNAL(textEdited(const QString &)), this, SLOT(editWorkingFolder(const QString &)));
- connect(ui->lineEditLogFile, SIGNAL(textEdited(const QString &)), this, SLOT(editLogFile(const QString &)));
-
- // If there is an item in the tree (nullptr is okay here), make it the currently selected item.
- // This is a work around for macOS, where the currentItemChanged() signal is being emitted (by something)
- // after this constructor, without actually selecting the first row. The effect there is, the remove button is
- // enabled, and the first item is selected, but not visibly so. Repainting does not fix the issue either. This
- // is a macOS only fix, but is put in for all platforms so that the GUI behavior is consistent across all
- // platforms.
- QTreeWidgetItem *item = ui->treeWidget->topLevelItem(0);
- ui->treeWidget->setCurrentItem(item);
-}
-
-bool ApplicationsDialog::eventFilter(QObject *target, QEvent *event) {
- // Launch tree does some fancy resizing and since it's down in
- // layouts and splitters, we can't just rely on the resize method
- // of this window.
- if (target == ui->treeWidget) {
- if (event->type() == QEvent::Resize) {
- ui->treeWidget->resizeColumnToContents(1);
- int nLastColumnWidth = ui->treeWidget->columnWidth(1);
- QRect rect = ui->treeWidget->geometry();
- ui->treeWidget->setColumnWidth(0, rect.width() - nLastColumnWidth);
- }
- }
- return false;
-}
-
-/// Make sure any changes are saved
-void ApplicationsDialog::closeEvent(QCloseEvent *event) {
- Environment &environment = Configurator::Get().environment;
-
- event->accept();
-
- // When we don't use overridden list only, no need to alert the user about empty list cases.
- if (!environment.GetUseApplicationList()) return;
-
- if (environment.GetApplications().empty() || !environment.HasOverriddenApplications()) {
- environment.SetUseApplicationList(false);
-
- Alert::ApplicationListEmpty();
- }
-}
-
-/// Browse for and select an executable file to add to the list.
-void ApplicationsDialog::on_pushButtonAdd_clicked() // Pick the test application
-{
- Configurator &configurator = Configurator::Get();
-
- const std::string suggested_path(configurator.path.GetPath(PATH_EXECUTABLE).c_str());
- std::string executable_full_path = configurator.path.SelectPath(this, PATH_EXECUTABLE, suggested_path).c_str();
-
- // If they have selected something!
- if (!executable_full_path.empty()) {
- // On macOS, they may have selected a binary, or they may have selected an app bundle.
- // If the later, we need to drill down to the actuall applicaiton
- if (executable_full_path.find(".app") != std::string::npos) {
- // Start by drilling down
- ExactExecutableFromAppBundle(executable_full_path);
- }
-
- std::string app_name;
- if (executable_full_path.find(GetNativeSeparator()) != std::string::npos) {
- app_name = executable_full_path.substr(executable_full_path.rfind(GetNativeSeparator()) + 1);
- } else {
- app_name = executable_full_path;
- }
-
- Application new_application(app_name, executable_full_path, "");
- configurator.environment.AppendApplication(new_application);
-
- QTreeWidgetItem *item = CreateApplicationItem(new_application);
-
- // To update the application list configuration
- configurator.configurations.Configure(configurator.layers.selected_layers);
-
- ui->treeWidget->setCurrentItem(item);
- configurator.environment.SelectActiveApplication(ui->treeWidget->indexOfTopLevelItem(item));
- }
-}
-
-QTreeWidgetItem *ApplicationsDialog::CreateApplicationItem(const Application &application) const {
- Configurator &configurator = Configurator::Get();
-
- QTreeWidgetItem *item = new QTreeWidgetItem();
- ui->treeWidget->addTopLevelItem(item);
-
- if (configurator.environment.GetUseApplicationList()) {
- QCheckBox *check_box = new QCheckBox(application.app_name.c_str());
- check_box->setChecked(application.layers_mode != LAYERS_MODE_BY_APPLICATIONS);
- ui->treeWidget->setItemWidget(item, 0, check_box);
- connect(check_box, SIGNAL(stateChanged(int)), this, SLOT(OnStateChanged(int)));
- } else {
- item->setText(0, application.app_name.c_str());
- }
-
- return item;
-}
-
-/// Easy enough, just remove the selected program from the list
-void ApplicationsDialog::on_pushButtonRemove_clicked() {
- QTreeWidgetItem *current = ui->treeWidget->currentItem();
- int selection = ui->treeWidget->indexOfTopLevelItem(current);
- assert(selection >= 0 && selection < ui->treeWidget->topLevelItemCount());
-
- Configurator &configurator = Configurator::Get();
-
- ui->treeWidget->takeTopLevelItem(selection);
- ui->treeWidget->setCurrentItem(nullptr);
- configurator.environment.RemoveApplication(selection);
-
- ui->groupLaunchInfo->setEnabled(false);
- ui->pushButtonRemove->setEnabled(false);
- ui->pushButtonSelect->setEnabled(false);
- ui->lineEditAppName->setText("");
- ui->lineEditExecutable->setText("");
- ui->lineEditCmdArgs->setText("");
- ui->lineEditWorkingFolder->setText("");
- ui->lineEditLogFile->setText("");
-
- // Update the application list configuration
- configurator.configurations.Configure(configurator.layers.selected_layers);
-
- ui->treeWidget->update();
-}
-
-// Dismiss the dialog, and preserve app information so it can be set to
-// the launcher.
-void ApplicationsDialog::on_pushButtonSelect_clicked() {
- Configurator &configurator = Configurator::Get();
- QTreeWidgetItem *item = ui->treeWidget->currentItem();
- if (item != nullptr) {
- configurator.environment.SelectActiveApplication(ui->treeWidget->indexOfTopLevelItem(item));
- }
-
- close();
-}
-
-/// The remove button is disabled until/unless something is selected that can
-/// be removed. Also the working folder and command line arguments are updated
-void ApplicationsDialog::selectedPathChanged(QTreeWidgetItem *current_item, QTreeWidgetItem *previous_item) {
- (void)previous_item;
- int application_index = ui->treeWidget->indexOfTopLevelItem(current_item);
-
- ui->groupLaunchInfo->setEnabled(application_index >= 0);
- ui->pushButtonRemove->setEnabled(application_index >= 0);
- ui->pushButtonSelect->setEnabled(application_index >= 0);
-
- if (application_index < 0) {
- ui->lineEditAppName->setText("");
- ui->lineEditExecutable->setText("");
- ui->lineEditCmdArgs->setText("");
- ui->lineEditWorkingFolder->setText("");
- ui->lineEditLogFile->setText("");
- return;
- }
-
- const Application &application = Configurator::Get().environment.GetApplication(application_index);
-
- ui->lineEditAppName->setText(application.app_name.c_str());
- ui->lineEditExecutable->setText(application.executable_path.c_str());
- ui->lineEditExecutable->setToolTip(ReplaceBuiltInVariable(application.executable_path.c_str()).c_str());
- ui->lineEditWorkingFolder->setText(application.working_folder.c_str());
- ui->lineEditWorkingFolder->setToolTip(ReplaceBuiltInVariable(application.working_folder.c_str()).c_str());
- ui->lineEditCmdArgs->setText(application.arguments.c_str());
- ui->lineEditLogFile->setText(application.log_file.c_str());
- ui->lineEditLogFile->setToolTip(ReplaceBuiltInVariable(application.log_file.c_str()).c_str());
-}
-
-void ApplicationsDialog::itemChanged(QTreeWidgetItem *item, int column) {
- _last_selected_application_index = ui->treeWidget->indexOfTopLevelItem(item);
- QCheckBox *check_box = dynamic_cast(ui->treeWidget->itemWidget(item, column));
- if (check_box != nullptr) {
- Configurator::Get().environment.GetApplication(_last_selected_application_index).layers_mode =
- check_box->isChecked() ? LAYERS_MODE_BY_CONFIGURATOR_RUNNING : LAYERS_MODE_BY_APPLICATIONS;
- }
-}
-
-/// Something was clicked. We don't know what, and short of setting up a new
-/// signal/slot for each button, this seemed a reasonable approach. Just poll
-/// all of them. There aren't that many, so KISS (keep it simple stupid)
-/// If one of them had their state flipped, that's the one that was checked, make
-/// it the currently selected one.
-void ApplicationsDialog::OnStateChanged(int) {
- Environment &environment = Configurator::Get().environment;
- const bool need_checkbox = environment.GetUseApplicationList();
- if (!need_checkbox) return;
-
- // Loop through the whole list and reset the checkboxes
- for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) {
- QTreeWidgetItem *item = ui->treeWidget->topLevelItem(i);
- QCheckBox *check_box = dynamic_cast(ui->treeWidget->itemWidget(item, 0));
- assert(check_box != nullptr);
- environment.GetApplication(i).layers_mode =
- check_box->isChecked() ? LAYERS_MODE_BY_CONFIGURATOR_RUNNING : LAYERS_MODE_BY_APPLICATIONS;
- }
-}
-
-void ApplicationsDialog::editAppName(const QString &name) {
- QTreeWidgetItem *current = ui->treeWidget->currentItem();
- _last_selected_application_index = ui->treeWidget->indexOfTopLevelItem(current);
- if (_last_selected_application_index < 0) return;
-
- Configurator::Get().environment.GetApplication(_last_selected_application_index).app_name = name.toStdString();
-}
-
-void ApplicationsDialog::editExecutable(const QString &executable) {
- QTreeWidgetItem *current = ui->treeWidget->currentItem();
- _last_selected_application_index = ui->treeWidget->indexOfTopLevelItem(current);
- if (_last_selected_application_index < 0) return;
-
- Configurator::Get().environment.GetApplication(_last_selected_application_index).executable_path = executable.toStdString();
-}
-
-void ApplicationsDialog::editCommandLine(const QString &cmdLine) {
- QTreeWidgetItem *current = ui->treeWidget->currentItem();
- _last_selected_application_index = ui->treeWidget->indexOfTopLevelItem(current);
- if (_last_selected_application_index < 0) return;
-
- Configurator::Get().environment.GetApplication(_last_selected_application_index).arguments = cmdLine.toStdString();
-}
-
-void ApplicationsDialog::editWorkingFolder(const QString &workingFolder) {
- QTreeWidgetItem *current = ui->treeWidget->currentItem();
- _last_selected_application_index = ui->treeWidget->indexOfTopLevelItem(current);
- if (_last_selected_application_index < 0) return;
-
- Configurator::Get().environment.GetApplication(_last_selected_application_index).working_folder = workingFolder.toStdString();
-}
-
-void ApplicationsDialog::editLogFile(const QString &logFile) {
- QTreeWidgetItem *current = ui->treeWidget->currentItem();
- _last_selected_application_index = ui->treeWidget->indexOfTopLevelItem(current);
- if (_last_selected_application_index < 0) return;
-
- Configurator::Get().environment.GetApplication(_last_selected_application_index).log_file = logFile.toStdString();
-}
diff --git a/vkconfig/dialog_applications.h b/vkconfig/dialog_applications.h
deleted file mode 100644
index e676324ce2..0000000000
--- a/vkconfig/dialog_applications.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#pragma once
-
-#include "ui_dialog_applications.h"
-
-#include "../vkconfig_core/application.h"
-
-#include
-
-class ApplicationsDialog : public QDialog {
- Q_OBJECT
-
- public:
- explicit ApplicationsDialog(QWidget *parent = nullptr);
-
- int GetSelectedLaunchApplicationIndex() const { return _last_selected_application_index; }
-
- private:
- QTreeWidgetItem *CreateApplicationItem(const Application &application) const;
-
- void closeEvent(QCloseEvent *) override;
- bool eventFilter(QObject *target, QEvent *event) override;
-
- public Q_SLOTS:
- void on_pushButtonAdd_clicked(); // Pick the application
- void on_pushButtonRemove_clicked(); // Remove
- void on_pushButtonSelect_clicked(); // Make this the current launcher app
- void selectedPathChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); // Used to enable remove button
- void itemChanged(QTreeWidgetItem *item, int column_index);
-
- void OnStateChanged(int);
-
- void editAppName(const QString &name);
- void editExecutable(const QString &name);
- void editCommandLine(const QString &cmd_line);
- void editWorkingFolder(const QString &working_folder);
- void editLogFile(const QString &log_file);
-
- private:
- ApplicationsDialog(const ApplicationsDialog &) = delete;
- ApplicationsDialog &operator=(const ApplicationsDialog &) = delete;
-
- std::unique_ptr ui;
- int _last_selected_application_index;
-};
diff --git a/vkconfig/dialog_applications.ui b/vkconfig/dialog_applications.ui
deleted file mode 100644
index dd52a4b9d8..0000000000
--- a/vkconfig/dialog_applications.ui
+++ /dev/null
@@ -1,176 +0,0 @@
-
-
- dialog_applications
-
-
-
- 0
- 0
- 606
- 375
-
-
-
-
- Arial
- 10
-
-
-
- Vulkan Applications with overridden Vulkan Layers
-
-
- -
-
-
- Add...
-
-
-
- -
-
-
- false
-
-
- Remove
-
-
-
- -
-
-
- false
-
-
- Ok
-
-
-
- -
-
-
-
- Arial
- 10
-
-
-
-
-
-
- Qt::ScrollBarAlwaysOff
-
-
- 4
-
-
- true
-
-
- 1
-
-
- false
-
-
- false
-
-
-
- 1
-
-
-
-
- -
-
-
- false
-
-
-
- 0
- 60
-
-
-
- This information is used only when the application is launched manually from vkconfig.
-
-
- Monitored Launch Info
-
-
-
-
-
-
- Application:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
- -
-
-
- Executable:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
- -
-
-
- Working Folder:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
- -
-
-
- Command Line Arguments:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
- -
-
-
- Log File
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
diff --git a/vkconfig/dialog_layers.cpp b/vkconfig/dialog_layers.cpp
deleted file mode 100644
index 448bdbf19e..0000000000
--- a/vkconfig/dialog_layers.cpp
+++ /dev/null
@@ -1,744 +0,0 @@
-/*
- * 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#include "dialog_layers.h"
-
-#include "configurator.h"
-
-#include "../vkconfig_core/alert.h"
-#include "../vkconfig_core/platform.h"
-#include "../vkconfig_core/util.h"
-#include "../vkconfig_core/doc.h"
-
-#if VKC_PLATFORM == VKC_PLATFORM_WINDOWS
-#include
-#endif
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#if VKC_PLATFORM == VKC_PLATFORM_WINDOWS
-// From Stack Overflow.
-#define MKPTR(p1, p2) ((DWORD_PTR)(p1) + (DWORD_PTR)(p2))
-
-typedef enum _pe_architecture {
- PE_ARCHITECTURE_UNKNOWN = 0x0000,
- PE_ARCHITECTURE_ANYCPU = 0x0001,
- PE_ARCHITECTURE_X86 = 0x010B,
- PE_ARCHITECTURE_x64 = 0x020B
-} PE_ARCHITECTURE;
-
-static PE_ARCHITECTURE GetImageArchitecture(void *pImageBase) {
- // Parse and validate the DOS header
- IMAGE_DOS_HEADER *pDosHd = (IMAGE_DOS_HEADER *)pImageBase;
- if (IsBadReadPtr(pDosHd, sizeof(pDosHd->e_magic)) || pDosHd->e_magic != IMAGE_DOS_SIGNATURE) return PE_ARCHITECTURE_UNKNOWN;
-
- // Parse and validate the NT header
- IMAGE_NT_HEADERS *pNtHd = (IMAGE_NT_HEADERS *)MKPTR(pDosHd, pDosHd->e_lfanew);
- if (IsBadReadPtr(pNtHd, sizeof(pNtHd->Signature)) || pNtHd->Signature != IMAGE_NT_SIGNATURE) return PE_ARCHITECTURE_UNKNOWN;
-
- // First, naive, check based on the 'Magic' number in the Optional Header.
- PE_ARCHITECTURE architecture = (PE_ARCHITECTURE)pNtHd->OptionalHeader.Magic;
-
- return architecture;
-}
-
-// End Stack Overflow
-#endif
-
-/// Utility function to see if the file is 32-bit
-static bool IsDLL32Bit(const std::string full_path) {
-#if VKC_PLATFORM == VKC_PLATFORM_WINDOWS
- if (full_path.empty()) return false;
-
- QFile file(full_path.c_str());
- if (!file.open(QIODevice::ReadOnly)) {
- return false; // punt...
- }
-
- // Not gonna lie, just guessed 1024 and it was enough.
- // This is the minimum page size on any OS (I might be wrong,
- // it could be 4096), so going lower is not really helpful.
- // Changed to 4096 on a whim; looking for crashing bug I can't debug
- void *header = file.map(0, 4096, QFileDevice::MapPrivateOption);
-
- // Another punt as we may not be able to map the file
- if (header == nullptr) return false;
-
- PE_ARCHITECTURE arch = GetImageArchitecture(header);
-
- file.unmap((uchar *)header);
- file.close();
-
- return (PE_ARCHITECTURE_X86 == arch);
-#else
- (void)full_path;
- return false;
-#endif
-}
-
-LayersDialog::LayersDialog(QWidget *parent, const Configuration &configuration)
- : QDialog(parent), configuration(configuration), ui(new Ui::dialog_layers) {
- ui->setupUi(this);
-
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
- Configurator &configurator = Configurator::Get();
- configurator.configurations.SaveAllConfigurations(configurator.layers.selected_layers);
-
- ui->lineEditName->setText(configuration.key.c_str());
- ui->lineEditName->setFocus();
- ui->lineEditDescription->setText(configuration.description.c_str());
- ui->buttonBox->setEnabled(!configurator.layers.Empty());
- ui->pushButtonRemove->setEnabled(false);
-
- Environment &environment = configurator.environment;
- restoreGeometry(environment.Get(LAYOUT_LAYER_GEOMETRY));
-
- const QByteArray &restore_splitter_state = environment.Get(LAYOUT_LAYER_SPLITTER);
- if (restore_splitter_state.isEmpty()) {
- ui->splitter->setSizes(QList({300, 30}));
- } else {
- ui->splitter->restoreState(environment.Get(LAYOUT_LAYER_SPLITTER));
- }
-
- QTreeWidgetItem *header_item = ui->layerTree->headerItem();
-
- header_item->setText(0, "Layers");
- header_item->setText(1, "Usage");
-
- connect(ui->layerTree, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this,
- SLOT(currentLayerChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
-
- connect(ui->layerTreeSorted, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this,
- SLOT(OnLayerTreeSortedClicked(QTreeWidgetItem *, int)));
-
- this->Reinit();
-}
-
-LayersDialog::~LayersDialog() {
- Environment &environment = Configurator::Get().environment;
-
- environment.Set(LAYOUT_LAYER_SPLITTER, ui->splitter->saveState());
- environment.Set(LAYOUT_LAYER_GEOMETRY, saveGeometry());
-}
-
-void LayersDialog::Reinit() {
- this->BuildParameters();
-
- this->LoadAvailableLayersUI();
- this->LoadSortedLayersUI();
- this->LoadUserDefinedPaths();
-
- this->UpdateUI();
-}
-
-struct ParameterState {
- std::string key;
- LayerState state;
-};
-
-static std::vector StoreParameterStates(const std::vector ¶meters) {
- std::vector ParameterStates;
- for (std::size_t i = 0, n = parameters.size(); i < n; ++i) {
- ParameterState state;
- state.key = parameters[i].key;
- state.state = parameters[i].state;
- ParameterStates.push_back(state);
- }
- return ParameterStates;
-}
-
-static void RestoreParameterStates(std::vector &Parameters, const std::vector &states) {
- for (std::size_t i = 0, n = states.size(); i < n; ++i) {
- Parameter *saved_parameter = FindByKey(Parameters, states[i].key.c_str());
- if (saved_parameter == nullptr) continue;
-
- saved_parameter->state = states[i].state;
- }
-}
-
-void LayersDialog::Reload() {
- std::string configuration_name = this->configuration.key;
- const std::vector &ParameterStates = StoreParameterStates(this->configuration.parameters);
- std::vector user_defined_paths = this->configuration.user_defined_paths;
-
- Configurator &configurator = Configurator::Get();
- configurator.configurations.SaveAllConfigurations(configurator.layers.selected_layers);
- configurator.configurations.available_configurations.clear();
- configurator.environment.SetPerConfigUserDefinedLayersPaths(this->configuration.user_defined_paths);
-
- configurator.layers.LoadAllInstalledLayers();
- configurator.configurations.LoadAllConfigurations(configurator.layers.selected_layers);
-
- Configuration *saved_configuration =
- FindByKey(configurator.configurations.available_configurations, configuration_name.c_str());
- if (saved_configuration != nullptr) {
- this->configuration = *saved_configuration;
- this->BuildParameters();
- }
-
- RestoreParameterStates(this->configuration.parameters, ParameterStates);
- this->configuration.user_defined_paths = user_defined_paths;
-
- configurator.environment.SetSelectedConfiguration(configuration_name);
- configurator.configurations.Configure(configurator.layers.selected_layers);
-}
-
-void LayersDialog::UpdateUI() {
- this->UpdateButtons();
-
- if (!selected_available_layer_name.empty()) {
- for (int i = 0, n = ui->layerTree->topLevelItemCount(); i < n; ++i) {
- TreeWidgetItemParameter *layer_item = dynamic_cast(ui->layerTree->topLevelItem(i));
- if (layer_item->layer_name != selected_available_layer_name) continue;
-
- ui->layerTree->setCurrentItem(layer_item);
- }
- } else if (ui->layerTree->topLevelItemCount() > 0) {
- ui->layerTree->setCurrentItem(ui->layerTree->topLevelItem(0));
- }
-
- if (!selected_sorted_layer_name.empty() && ui->layerTreeSorted->topLevelItemCount() > 1) {
- for (int i = 0, n = ui->layerTreeSorted->topLevelItemCount(); i < n; ++i) {
- TreeWidgetItemParameter *layer_item = dynamic_cast(ui->layerTreeSorted->topLevelItem(i));
- if (layer_item->layer_name != selected_sorted_layer_name) continue;
-
- ui->layerTreeSorted->setCurrentItem(layer_item);
- }
- } else if (ui->layerTreeSorted->topLevelItemCount() > 1) {
- ui->layerTreeSorted->setCurrentItem(ui->layerTreeSorted->topLevelItem(0));
- }
-
- ui->layerTreeSorted->setEnabled(ui->layerTreeSorted->topLevelItemCount() > 1);
-
- QTreeWidgetItem *current_sorted_layers = ui->layerTreeSorted->currentItem();
- const bool has_selected_sorted_item = current_sorted_layers != nullptr;
-
- const bool has_above_sorted_item = ui->layerTreeSorted->itemAbove(current_sorted_layers) != nullptr;
- ui->pushButtonUp->setEnabled(has_selected_sorted_item && has_above_sorted_item);
-
- const bool has_below_sorted_item = ui->layerTreeSorted->itemBelow(current_sorted_layers) != nullptr;
- ui->pushButtonDown->setEnabled(has_selected_sorted_item && has_below_sorted_item);
-}
-
-void LayersDialog::OnLayerTreeSortedClicked(QTreeWidgetItem *item, int column) {
- (void)column;
-
- TreeWidgetItemParameter *selected_sorted_item = dynamic_cast(item);
- assert(selected_sorted_item);
-
- this->selected_available_layer_name = this->selected_sorted_layer_name = selected_sorted_item->layer_name;
-
- UpdateUI();
-}
-
-void LayersDialog::AddLayerItem(const Parameter ¶meter) {
- assert(!parameter.key.empty());
-
- std::vector &available_layers = Configurator::Get().layers.selected_layers;
-
- const Layer *layer = FindByKey(available_layers, parameter.key.c_str());
-
- std::string decorated_name(parameter.key);
-
- bool is_implicit_layer = false;
- if (layer != nullptr) {
- if (layer->status != STATUS_STABLE) {
- decorated_name += format(" (%s)", GetToken(layer->status));
- }
-
- decorated_name += format(" - %s", layer->api_version.str().c_str());
-
- if (IsDLL32Bit(layer->manifest_path)) {
- decorated_name += " (32-bit)";
- }
-
- if (layer->type == LAYER_TYPE_IMPLICIT) {
- is_implicit_layer = true;
- decorated_name += format(" - %s layer", GetLayerTypeLabel(layer->type));
- }
- } else {
- // A layers configuration may have excluded layer that are misssing because they are not available on this platform
- // We simply hide these layers to avoid confusing the Vulkan developers
- if (parameter.state == LAYER_STATE_EXCLUDED) return;
-
- decorated_name += " (Missing)";
- }
-
- TreeWidgetItemParameter *item = new TreeWidgetItemParameter(parameter.key.c_str());
-
- item->setText(0, decorated_name.c_str());
- if (layer != nullptr) {
- item->setToolTip(0, layer->manifest_path.c_str());
- }
- item->setFlags(item->flags() | Qt::ItemIsSelectable);
- item->setDisabled(layer == nullptr);
-
- // Add the top level item
- ui->layerTree->addTopLevelItem(item);
-
- // Add a combo box. Default has gray background which looks hidious
- WidgetTreeFriendlyComboBox *widget = new WidgetTreeFriendlyComboBox(item);
- ui->layerTree->setItemWidget(item, 1, widget);
-
- if (layer != nullptr) {
- std::string tooltip;
-
- bool disable_value = false;
- bool enable_value = false;
-
- if (!layer->disable_env.empty()) {
- disable_value = !qgetenv(layer->disable_env.c_str()).isEmpty();
-
- tooltip += layer->disable_env + format(": %s", disable_value ? "true" : "false");
- }
-
- if (!layer->enable_env.empty()) {
- enable_value = qgetenv(layer->enable_env.c_str()).toStdString() == layer->enable_value;
-
- tooltip += "; " + layer->enable_env + format(": %s", enable_value ? "true" : "false");
- }
-
- const std::string implicit_string = !disable_value || (!layer->enable_env.empty() && enable_value)
- ? "Env Variables Controlled: On"
- : "Env Variables Controlled: Off";
-
- widget->setToolTip(tooltip.c_str());
- widget->addItem(is_implicit_layer ? implicit_string.c_str() : "Application-Controlled");
- } else {
- widget->addItem("Application-Controlled");
- widget->setCurrentIndex(LAYER_STATE_APPLICATION_CONTROLLED);
- }
-
- widget->addItem("Overridden / Forced On");
- widget->addItem("Excluded / Forced Off");
- widget->setCurrentIndex(parameter.state);
-
- this->connect(widget, SIGNAL(selectionMade(QTreeWidgetItem *, int)), this, SLOT(layerUseChanged(QTreeWidgetItem *, int)));
-}
-
-void LayersDialog::LoadAvailableLayersUI() {
- ui->layerTree->clear();
-
- for (std::size_t i = 0, n = this->configuration.parameters.size(); i < n; ++i) {
- AddLayerItem(this->configuration.parameters[i]);
- }
-
- resizeEvent(nullptr);
-
- ui->layerTree->update();
-}
-
-void LayersDialog::LoadSortedLayersUI() {
- ui->layerTreeSorted->clear();
-
- for (std::size_t i = 0, n = this->configuration.parameters.size(); i < n; ++i) {
- if (this->configuration.parameters[i].state != LAYER_STATE_OVERRIDDEN) continue;
-
- TreeWidgetItemParameter *sorted_layer_item = new TreeWidgetItemParameter(this->configuration.parameters[i].key.c_str());
- sorted_layer_item->setText(0, this->configuration.parameters[i].key.c_str());
- sorted_layer_item->setFlags(sorted_layer_item->flags() | Qt::ItemIsSelectable);
-
- ui->layerTreeSorted->addTopLevelItem(sorted_layer_item);
- }
-}
-
-void LayersDialog::LoadUserDefinedPaths() {
- Configurator &configurator = Configurator::Get();
-
- // Populate the tree
- ui->layerTreePath->clear();
-
- // Building the list is not obvious. Each custom path may have multiple layers and there
- // could be duplicates, which are not allowed. The layer paths are traversed in order, and
- // layers are used on a first occurance basis. So we can't just show the layers that are
- // present in the folder (because they may not be used). We have to list the custom layer paths
- // and then look for layers that are already loaded that are from that path.
-
- for (std::size_t path_index = 0, count = this->configuration.user_defined_paths.size(); path_index < count; ++path_index) {
- const std::string user_defined_path(ConvertNativeSeparators(this->configuration.user_defined_paths[path_index]));
-
- QTreeWidgetItem *item = new QTreeWidgetItem();
- ui->layerTreePath->addTopLevelItem(item);
- item->setText(0, user_defined_path.c_str());
- item->setExpanded(true);
-
- // Look for layers that are loaded that are also from this folder
- for (std::size_t i = 0, n = configurator.layers.selected_layers.size(); i < n; ++i) {
- const Layer &layer = configurator.layers.selected_layers[i];
-
- const QFileInfo file_info(layer.manifest_path.c_str());
- const std::string path(ConvertNativeSeparators(file_info.path().toStdString()));
- if (path != user_defined_path) {
- continue;
- }
-
- std::string decorated_name(layer.key);
- if (layer.status != STATUS_STABLE) {
- decorated_name += format(" (%s)", GetToken(layer.status));
- }
- decorated_name += format(" - %s", layer.api_version.str().c_str());
-
- QTreeWidgetItem *child = new QTreeWidgetItem();
- child->setText(0, decorated_name.c_str());
- item->addChild(child);
- }
- }
-}
-
-// The only way to catch the resize from the layouts
-// (which is screwing up the spacing with the combo boxes)
-void LayersDialog::showEvent(QShowEvent *event) {
- (void)event;
-
- resizeEvent(nullptr);
-}
-
-void LayersDialog::resizeEvent(QResizeEvent *event) {
- (void)event;
-
- const QFontMetrics fm = ui->layerTree->fontMetrics();
- const int combo_width = (fm.size(Qt::TextSingleLine, "Env Variables Controlled: Off").width() * 1.5);
- const int width = ui->layerTree->width() - combo_width;
- ui->layerTree->setColumnWidth(0, width);
-}
-
-void LayersDialog::on_button_properties_clicked() {
- const std::vector &selected_layers = Configurator::Get().layers.selected_layers;
- const Layer *layer = FindByKey(selected_layers, this->selected_available_layer_name.c_str());
-
- Alert::LayerProperties(layer);
-}
-
-void LayersDialog::on_button_doc_clicked() {
- const std::vector &selected_layers = Configurator::Get().layers.selected_layers;
- const Layer *layer = FindByKey(selected_layers, this->selected_available_layer_name.c_str());
- const std::string path = format("%s/%s.html", GetPath(BUILTIN_PATH_APPDATA).c_str(), layer->key.c_str());
- ExportHtmlDoc(*layer, path);
- QDesktopServices::openUrl(QUrl(("file:///" + path).c_str()));
-}
-
-void LayersDialog::on_button_website_clicked() {
- const std::vector &selected_layers = Configurator::Get().layers.selected_layers;
- const Layer *layer = FindByKey(selected_layers, this->selected_available_layer_name.c_str());
- QDesktopServices::openUrl(QUrl(layer->url.c_str()));
-}
-
-void LayersDialog::on_button_reset_clicked() {
- Configurator &configurator = Configurator::Get();
-
- QMessageBox alert;
- alert.QDialog::setWindowTitle(format("Resetting *%s* configuration...", this->configuration.key.c_str()).c_str());
- alert.setText(format("Are you sure you want to reset the *%s* configuration?", this->configuration.key.c_str()).c_str());
- if (this->configuration.IsBuiltIn())
- alert.setInformativeText(
- format("The configuration layers and settings will be restored to default built-in *%s* configuration.",
- configuration.key.c_str())
- .c_str());
- else if (configurator.configurations.HasFile(this->configuration))
- alert.setInformativeText(
- format("The configuration layers and settings will be reloaded using the *%s* saved file from previous %s run.",
- configuration.key.c_str(), VKCONFIG_NAME)
- .c_str());
- else
- alert.setInformativeText("The configuration layers and settings will be reset to zero.");
- alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
- alert.setDefaultButton(QMessageBox::Yes);
- alert.setIcon(QMessageBox::Warning);
- if (alert.exec() == QMessageBox::No) return;
-
- selected_available_layer_name.clear();
- selected_sorted_layer_name.clear();
-
- configuration.Reset(configurator.layers.selected_layers, configurator.path);
-
- this->Reinit();
-
- ui->button_reset->setEnabled(false);
-}
-
-void LayersDialog::OverrideOrder(const std::string layer_name, const TreeWidgetItemParameter *below,
- const TreeWidgetItemParameter *above) {
- assert(below != nullptr);
- assert(below != above);
-
- Parameter *below_parameter = FindByKey(configuration.parameters, below->layer_name.c_str());
- assert(below_parameter != nullptr);
- Parameter *above_parameter = FindByKey(configuration.parameters, above->layer_name.c_str());
- assert(above_parameter != nullptr);
-
- this->selected_sorted_layer_name = this->selected_available_layer_name = layer_name;
-
- std::swap(below_parameter->overridden_rank, above_parameter->overridden_rank);
-
- OrderParameter(configuration.parameters, Configurator::Get().layers.selected_layers);
- LoadAvailableLayersUI();
- LoadSortedLayersUI();
- LoadUserDefinedPaths();
-
- UpdateUI();
-}
-
-void LayersDialog::on_pushButtonUp_clicked() {
- TreeWidgetItemParameter *selected_item = dynamic_cast(ui->layerTreeSorted->currentItem());
- assert(selected_item);
- TreeWidgetItemParameter *above_item = dynamic_cast(ui->layerTreeSorted->itemAbove(selected_item));
- assert(above_item);
-
- OverrideOrder(selected_item->layer_name, selected_item, above_item);
-
- ui->button_reset->setEnabled(true);
- this->UpdateButtons();
-}
-
-void LayersDialog::on_pushButtonDown_clicked() {
- TreeWidgetItemParameter *selected_item = dynamic_cast(ui->layerTreeSorted->currentItem());
- assert(selected_item);
- TreeWidgetItemParameter *below_item = dynamic_cast(ui->layerTreeSorted->itemBelow(selected_item));
- assert(below_item);
-
- OverrideOrder(selected_item->layer_name, below_item, selected_item);
-
- ui->button_reset->setEnabled(true);
- this->UpdateButtons();
-}
-
-void LayersDialog::currentLayerChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous) {
- (void)previous;
-
- TreeWidgetItemParameter *layer_item = dynamic_cast(current);
-
- if (layer_item == nullptr) {
- this->selected_available_layer_name.clear();
- return;
- }
-
- assert(!layer_item->layer_name.empty());
-
- this->selected_available_layer_name = layer_item->layer_name.c_str();
-
- ui->button_reset->setEnabled(true);
- this->UpdateButtons();
-}
-
-void LayersDialog::UpdateButtons() {
- const bool enabled = !selected_available_layer_name.empty();
-
- bool enabled_url = false;
-
- if (enabled) {
- std::vector &available_layers = Configurator::Get().layers.selected_layers;
- const Layer *layer = FindByKey(available_layers, selected_available_layer_name.c_str());
- assert(layer != nullptr);
- if (!layer->url.empty()) enabled_url = true;
- }
-
- ui->button_properties->setEnabled(enabled);
- ui->button_doc->setEnabled(enabled);
- ui->button_website->setEnabled(enabled && enabled_url);
-}
-
-void LayersDialog::OverrideAllExplicitLayers() {
- for (auto it = this->configuration.parameters.begin(); it != this->configuration.parameters.end(); ++it) {
- if (it->state != LAYER_STATE_APPLICATION_CONTROLLED) continue;
-
- Configurator &configurator = Configurator::Get();
- std::vector &available_layers = configurator.layers.selected_layers;
-
- const Layer *layer = FindByKey(available_layers, it->key.c_str());
- if (layer == nullptr) continue;
-
- if (layer->type == LAYER_TYPE_IMPLICIT) continue;
-
- if (it->key == "VK_LAYER_KHRONOS_validation")
- it->state = LAYER_STATE_OVERRIDDEN;
- else
- it->state = LAYER_STATE_EXCLUDED;
- }
-}
-
-// Select the layer LayerState
-void LayersDialog::layerUseChanged(QTreeWidgetItem *item, int selection) {
- // Combo box changed. We first need to know which tree item was selected.
- // Fortunatly, changing the combo box also changes the selected item.
- assert(item);
- assert(selection >= LAYER_STATE_FIRST && selection <= LAYER_STATE_LAST);
-
- TreeWidgetItemParameter *tree_layer_item = dynamic_cast(item);
- assert(tree_layer_item != nullptr);
- Parameter *current_parameter = FindByKey(configuration.parameters, tree_layer_item->layer_name.c_str());
- assert(current_parameter != nullptr);
-
- LayerState layer_state = static_cast(selection);
-
- if (layer_state == LAYER_STATE_OVERRIDDEN && current_parameter->key == "VK_LAYER_KHRONOS_profiles") {
- if (Alert::LayerProfiles() == QMessageBox::Yes) {
- OverrideAllExplicitLayers();
- }
- } else if (layer_state == LAYER_STATE_EXCLUDED) {
- const std::vector &selected_layers = Configurator::Get().layers.selected_layers;
- const Layer *layer = FindByKey(selected_layers, tree_layer_item->layer_name.c_str());
-
- if (layer != nullptr) {
- if (layer->type == LAYER_TYPE_IMPLICIT) {
- if (Alert::LayerImplicitExcluded(tree_layer_item->layer_name.c_str()) == QMessageBox::No) {
- layer_state = LAYER_STATE_APPLICATION_CONTROLLED;
- }
- }
- }
- }
-
- current_parameter->state = layer_state;
- current_parameter->overridden_rank = Parameter::NO_RANK;
-
- OrderParameter(this->configuration.parameters, Configurator::Get().layers.selected_layers);
-
- ui->button_reset->setEnabled(true);
-
- LoadAvailableLayersUI();
- LoadSortedLayersUI();
- LoadUserDefinedPaths();
-
- UpdateUI();
-}
-
-void LayersDialog::on_layerTreePath_itemSelectionChanged() { ui->pushButtonRemove->setEnabled(true); }
-
-void LayersDialog::on_pushButtonAdd_clicked() {
- Configurator &configurator = Configurator::Get();
- const std::string custom_path = configurator.path.SelectPath(this, PATH_USER_DEFINED_LAYERS_GUI);
-
- if (!custom_path.empty()) {
- std::vector &user_defined_paths = this->configuration.user_defined_paths;
-
- if (std::find(user_defined_paths.begin(), user_defined_paths.end(), custom_path) == user_defined_paths.end()) {
- user_defined_paths.push_back(custom_path);
-
- this->Reload();
- this->Reinit();
- }
- }
-
- ui->buttonBox->setEnabled(!configurator.layers.Empty());
-}
-
-void LayersDialog::on_pushButtonRemove_clicked() {
- // Which one is selected? We need the top item too
- QTreeWidgetItem *selected = ui->layerTreePath->currentItem();
- if (selected == nullptr) {
- ui->pushButtonRemove->setEnabled(false);
- return;
- }
-
- while (selected->parent() != nullptr) selected = selected->parent();
-
- RemoveString(this->configuration.user_defined_paths, selected->text(0).toStdString());
-
- this->Reload();
- this->Reinit();
-
- // Nothing is selected, so disable remove button
- ui->pushButtonRemove->setEnabled(false);
-}
-
-void LayersDialog::accept() {
- if (ui->lineEditName->text().isEmpty()) {
- Alert::ConfigurationNameEmpty();
- return;
- }
-
- if (!IsPortableFilename(ui->lineEditName->text().toStdString())) {
- Alert::ConfigurationNameInvalid();
- return;
- }
-
- /* ANSI character are allowed
- if (ui->lineEditName->text().contains(QRegularExpression(QStringLiteral("[^\\x{0000}-\\x{007F}]")))) {
- Alert::ConfigurationNameASCII();
- return;
- }
- */
-
- Configurator &configurator = Configurator::Get();
- if (this->configuration.key != ui->lineEditName->text().toStdString() &&
- IsFound(configurator.configurations.available_configurations, ui->lineEditName->text().toStdString().c_str())) {
- Alert::ConfigurationRenamingFailed();
- return;
- }
-
- Version loader_version;
- if (!configurator.SupportDifferentLayerVersions(&loader_version)) {
- std::string log_versions;
- if (!configurator.configurations.CheckLayersVersions(configurator.layers.selected_layers, &this->configuration,
- log_versions)) {
- Alert::LayerIncompatibleVersions(log_versions.c_str(), loader_version);
- return;
- }
- }
-
- FilterParameters(this->configuration.parameters, LAYER_STATE_APPLICATION_CONTROLLED);
-
- Configuration *saved_configuration =
- FindByKey(configurator.configurations.available_configurations, this->configuration.key.c_str());
- assert(saved_configuration != nullptr);
-
- if (saved_configuration->key != ui->lineEditName->text().toStdString()) {
- configurator.configurations.RemoveConfigurationFile(saved_configuration->key);
- }
-
- const std::string active_configuration_name = ui->lineEditName->text().toStdString();
-
- saved_configuration->key = active_configuration_name;
- saved_configuration->description = ui->lineEditDescription->text().toStdString();
- saved_configuration->parameters = this->configuration.parameters;
- saved_configuration->user_defined_paths = this->configuration.user_defined_paths;
- saved_configuration->setting_tree_state.clear();
- configurator.configurations.SaveAllConfigurations(configurator.layers.selected_layers);
-
- QDialog::accept();
-}
-
-void LayersDialog::reject() {
- Configurator &configurator = Configurator::Get();
- Configuration *saved_configuration =
- FindByKey(configurator.configurations.available_configurations, this->configuration.key.c_str());
- assert(saved_configuration != nullptr);
-
- if (saved_configuration->user_defined_paths != this->configuration.user_defined_paths) {
- configurator.environment.SetPerConfigUserDefinedLayersPaths(saved_configuration->user_defined_paths);
- // Restore layers
- this->Reload();
- }
-
- QDialog::reject();
-}
-
-void LayersDialog::BuildParameters() {
- Configurator &configurator = Configurator::Get();
- this->configuration.parameters = GatherParameters(this->configuration.parameters, configurator.layers.selected_layers);
-}
diff --git a/vkconfig/dialog_layers.h b/vkconfig/dialog_layers.h
deleted file mode 100644
index bbcc7941bd..0000000000
--- a/vkconfig/dialog_layers.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#pragma once
-
-#include "widget_tree_friendly_combobox.h"
-
-#include "../vkconfig_core/configuration.h"
-
-#include "ui_dialog_layers.h"
-
-#include
-#include
-
-class TreeWidgetItemParameter : public QTreeWidgetItem {
- public:
- TreeWidgetItemParameter(const char *layer_name) : layer_name(layer_name) { assert(layer_name != nullptr); }
-
- std::string layer_name;
-};
-
-class LayersDialog : public QDialog {
- Q_OBJECT
-
- public:
- explicit LayersDialog(QWidget *parent, const Configuration &configuration);
- ~LayersDialog();
-
- public Q_SLOTS:
- void accept() override;
- void reject() override;
-
- void currentLayerChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
-
- void on_button_properties_clicked();
- void on_button_doc_clicked();
- void on_button_website_clicked();
- void on_button_reset_clicked();
- void on_pushButtonUp_clicked();
- void on_pushButtonDown_clicked();
- void on_pushButtonAdd_clicked();
- void on_pushButtonRemove_clicked();
- void on_layerTreePath_itemSelectionChanged();
-
- void OnLayerTreeSortedClicked(QTreeWidgetItem *item, int column);
-
- void layerUseChanged(QTreeWidgetItem *item, int selection);
-
- private:
- LayersDialog(const LayersDialog &) = delete;
- LayersDialog &operator=(const LayersDialog &) = delete;
-
- virtual void resizeEvent(QResizeEvent *event) override;
- virtual void showEvent(QShowEvent *) override;
-
- void UpdateUI();
-
- void UpdateButtons();
-
- void LoadAvailableLayersUI();
- void LoadSortedLayersUI();
- void LoadUserDefinedPaths();
- void Reload();
- void Reinit();
- void AddLayerItem(const Parameter ¶meter);
- void BuildParameters();
- void OverrideAllExplicitLayers();
- void OverrideOrder(const std::string layer_name, const TreeWidgetItemParameter *below, const TreeWidgetItemParameter *above);
-
- Configuration configuration;
- std::string selected_available_layer_name;
- std::string selected_sorted_layer_name;
-
- std::unique_ptr ui;
-};
diff --git a/vkconfig/dialog_layers.ui b/vkconfig/dialog_layers.ui
deleted file mode 100644
index 8952d76e01..0000000000
--- a/vkconfig/dialog_layers.ui
+++ /dev/null
@@ -1,555 +0,0 @@
-
-
- dialog_layers
-
-
-
- 0
- 0
- 1024
- 640
-
-
-
-
- 1024
- 640
-
-
-
-
- 10000
- 10000
-
-
-
-
- 0
- 0
-
-
-
-
- Arial
- 10
-
-
-
- Edit Vulkan Layers
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 250
- 80
-
-
-
-
- 16777215
- 80
-
-
-
-
- 0
- 1
-
-
-
-
-
-
-
-
-
-
- Description:
-
-
-
- -
-
-
-
- 0
- 24
-
-
-
- Description of your user-defined configuration
-
-
-
- -
-
-
-
- 0
- 24
-
-
-
-
-
-
- Name of your new user-defined configuration
-
-
-
- -
-
-
- Name:
-
-
-
-
-
-
- -
-
-
- 1
-
-
- Qt::Vertical
-
-
- false
-
-
- 10
-
-
- false
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
-
- 1
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
- Show Properties...
-
-
-
- -
-
-
- Show Documentation...
-
-
-
- -
-
-
- Visit Website...
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 120
- 0
-
-
-
-
- 1000
- 16777215
-
-
-
- Reset
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 32
-
-
-
-
- 0
- 32
-
-
-
-
- Arial
- 10
-
-
-
- QFrame::Box
-
-
- QFrame::Plain
-
-
- false
-
-
- false
-
-
- QAbstractItemView::NoDragDrop
-
-
- Qt::IgnoreAction
-
-
- false
-
-
- true
-
-
- 0
-
-
- 0
-
-
-
- 1
-
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
-
- 1
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
-
- 0
- 32
-
-
-
-
- 16777215
- 16777215
-
-
-
-
- 0
- 32
-
-
-
-
- Arial
- 10
-
-
-
- Overridden layers ordering requires multiple layers
-
-
- QFrame::Box
-
-
- QFrame::Plain
-
-
- false
-
-
-
- 1
-
-
-
-
- -
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
- Execute Closer to the Vulkan Applications
-
-
-
- -
-
-
- Execute Closer to the Vulkan Drivers
-
-
-
-
-
-
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
- QFrame::Box
-
-
- QFrame::Plain
-
-
- 1
-
-
- false
-
-
- 0
-
-
- 0
-
-
-
- 1
-
-
-
-
- -
-
-
- 6
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
- Add User-Defined Path...
-
-
-
- -
-
-
- Remove User-Defined Path
-
-
-
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Qt::Horizontal
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
-
- false
-
-
-
-
-
-
- layerTree
-
-
-
-
- buttonBox
- accepted()
- dialog_layers
- accept()
-
-
- 248
- 254
-
-
- 157
- 274
-
-
-
-
- buttonBox
- rejected()
- dialog_layers
- reject()
-
-
- 316
- 260
-
-
- 286
- 274
-
-
-
-
-
diff --git a/vkconfig/dialog_vulkan_analysis.cpp b/vkconfig/dialog_vulkan_analysis.cpp
deleted file mode 100644
index a5b54c9aba..0000000000
--- a/vkconfig/dialog_vulkan_analysis.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#include "dialog_vulkan_analysis.h"
-
-#include "../vkconfig_core/platform.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-VulkanAnalysisDialog::VulkanAnalysisDialog(QWidget *parent) : QDialog(parent), ui(new Ui::dialog_vulkan_analysis) {
- ui->setupUi(this);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
- // Hide the test widget as no test is actually run.
- // This may be added back again later.
- ui->tabWidget->removeTab(2);
-
- Run();
-}
-
-void VulkanAnalysisDialog::Run() {
- ui->envTable->clear();
- ui->cleanupTable->clear();
- ui->hardwareTable->clear();
- ui->instanceTable->clear();
- ui->lunarGSDKTable->clear();
- ui->executableTable->clear();
- ui->vkRuntimesTable->clear();
- ui->externalTestsTable->clear();
- ui->layerSettingsTable->clear();
- ui->explicitLayersTable->clear();
- ui->implicitLayersTable->clear();
- ui->logicalDevicesTable->clear();
- ui->physicalDevicesTable->clear();
-
- QProcess *via = new QProcess(this);
-#if VKC_PLATFORM == VKC_PLATFORM_MACOS
- via->setProgram("/usr/local/bin/vkvia");
-#else
- via->setProgram("vkvia");
-#endif
-
- const QString &file_Path = QDir::temp().path() + "/vkvia.json";
-
- // Remove the old one
- remove(file_Path.toUtf8().constData());
-
- QStringList args;
- args << "--output_path" << QDir::temp().path();
- args << "--vkconfig_output";
- args << "--disable_cube_tests";
- via->setArguments(args);
- via->start();
- via->waitForFinished();
-
- QFile file(file_Path);
- if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- QMessageBox msgBox;
- msgBox.setText(tr("Error running vkvia. Is your SDK up to date and installed properly?"));
- msgBox.exec();
- return;
- }
-
- QString json_text = file.readAll();
- file.close();
-
- //////////////////////////////////////////////////////
- // Convert the text to a JSON document & validate it
- QJsonParseError parse_error;
- QJsonDocument json_document = QJsonDocument::fromJson(json_text.toUtf8(), &parse_error);
-
- if (parse_error.error != QJsonParseError::NoError) {
- QMessageBox msgBox;
- msgBox.setWindowTitle("Cannot parse vkvia output.");
- msgBox.setText(parse_error.errorString());
- msgBox.exec();
- return;
- }
-
- if (json_document.isEmpty() || json_document.isNull()) return;
-
- /////////////////////////////////////////////////////////
- // Get the instance version and set that to the header
- QString output;
- const QJsonObject &json_object = json_document.object();
-
- ///////////////////////////////////// System Info
- // Get the extensions object and process it's members
- QJsonValue environmentValue = json_object.value(QString(tr("Environment")));
- QJsonObject environmentObject = environmentValue.toObject();
- LoadTable(environmentObject, ui->envTable);
-
- QJsonValue hardwareValue = json_object.value(QString(tr("Hardware")));
- QJsonObject hardwareObject = hardwareValue.toObject();
- LoadTable(hardwareObject, ui->hardwareTable);
-
- QJsonValue executableValue = json_object.value(QString(tr("Executable Info")));
- QJsonObject executableObject = executableValue.toObject();
- LoadTable(executableObject, ui->executableTable);
-
- QJsonValue vkDriverInfo = json_object.value(QString(tr("Vulkan Driver Info")));
- QJsonObject vkDriverObject = vkDriverInfo.toObject();
- LoadTable(vkDriverObject, ui->vkDriverInfoTable);
-
- QJsonValue vkRunTimeValue = json_object.value(QString(tr("Vulkan Runtimes")));
- QJsonObject vkRunTimeObject = vkRunTimeValue.toObject();
- LoadTable(vkRunTimeObject, ui->vkRuntimesTable);
-
- QJsonValue lunarGSDKValue = json_object.value(QString(tr("Vulkan SDKs")));
- QJsonObject lunarGSDKObject = lunarGSDKValue.toObject();
- LoadTable(lunarGSDKObject, ui->lunarGSDKTable);
-
- QJsonValue vkImplicitValue = json_object.value(QString(tr("Vulkan Implicit Layers")));
- QJsonObject vkImplicitObject = vkImplicitValue.toObject();
- LoadTable(vkImplicitObject, ui->implicitLayersTable);
-
- QJsonValue vkExplicitValue = json_object.value(QString(tr("Vulkan Explicit Layers")));
- QJsonObject vkExplicitObject = vkExplicitValue.toObject();
- LoadTable(vkExplicitObject, ui->explicitLayersTable);
-
- QJsonValue vkLayerSettingsValue = json_object.value(QString(tr("Vulkan Layer Settings File")));
- QJsonObject vkLayerSettingsObject = vkLayerSettingsValue.toObject();
- LoadTable(vkLayerSettingsObject, ui->layerSettingsTable);
-
- /////////////////////////// Vulkan API Calls
- QJsonValue instanceValue = json_object.value(QString(tr("Instance")));
- QJsonObject instanceObject = instanceValue.toObject();
- LoadTable(instanceObject, ui->instanceTable);
-
- QJsonObject devicesObject = json_object.value(QString(tr("Physical Devices"))).toObject();
- LoadTable(devicesObject, ui->physicalDevicesTable);
-
- QJsonObject logicalObject = json_object.value(QString(tr("Logical Devices"))).toObject();
- LoadTable(logicalObject, ui->logicalDevicesTable);
-
- QJsonObject cleanupObject = json_object.value(QString(tr("Cleanup"))).toObject();
- LoadTable(cleanupObject, ui->cleanupTable);
-
- /////////////////////////////////// External Tests
- QJsonValue cubeValue = json_object.value(QString(tr("Cube"))).toObject();
- QJsonObject cubeObject = cubeValue.toObject();
- if (!cubeObject.isEmpty())
- LoadTable(cubeObject, ui->externalTestsTable);
- else {
- ui->externalTestsTable->setRowCount(1);
- ui->externalTestsTable->setColumnCount(1);
- ui->externalTestsTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
- ui->externalTestsTable->setShowGrid(false);
- QTableWidgetItem *item = new QTableWidgetItem();
- item->setText(tr("No SDK found by VIA, skipping test section"));
- ui->externalTestsTable->setItem(0, 0, item);
- }
-
- show();
-}
-
-void VulkanAnalysisDialog::LoadTable(QJsonObject &json_parent, QTableWidget *table) {
- // How many items does this object contain?
- int nHowManyRows = json_parent.size();
- table->setRowCount(nHowManyRows);
-
- // Get the first item in the table, and see how many items it has. This
- // will be the number of columns
- QJsonValue rowValue = json_parent.value("0");
- QJsonObject rowObject = rowValue.toObject();
- int nHowManyCols = rowObject.size();
- table->setColumnCount(nHowManyCols);
-
- table->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
-
- // Now just iterate and fill in the cells
- for (int row = 0; row < nHowManyRows; row++) {
- rowValue = json_parent.value(QString().asprintf("%d", row));
- rowObject = rowValue.toObject();
-
- for (int col = 0; col < nHowManyCols; col++) {
- QJsonValue colValue = rowObject.value(QString().asprintf("%d", col));
- QString text = colValue.toString();
- QTableWidgetItem *item = new QTableWidgetItem;
- item->setText(text);
- table->setItem(row, col, item);
- }
- }
-}
diff --git a/vkconfig/main_doc.h b/vkconfig/main_doc.h
deleted file mode 100644
index ce23885758..0000000000
--- a/vkconfig/main_doc.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2022 Valve Corporation
- * Copyright (c) 2022 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:
- * - David Pinedo
- */
-
-#pragma once
-
-#include "../vkconfig_core/command_line.h"
-
-int run_doc(const CommandLine& commandLine);
diff --git a/vkconfig/main_gui.cpp b/vkconfig/main_gui.cpp
deleted file mode 100644
index f614f40584..0000000000
--- a/vkconfig/main_gui.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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 "main_gui.h"
-
-#include "mainwindow.h"
-
-#include "../vkconfig_core/alert.h"
-#include "../vkconfig_core/version.h"
-#include "../vkconfig_core/application_singleton.h"
-
-#include
-#include
-
-int run_gui(int argc, char* argv[], const CommandLine& command_line) {
- QCoreApplication::setOrganizationName("LunarG");
- QCoreApplication::setOrganizationDomain("lunarg.com");
-
- // This is used by QSettings for .ini, registry, and .plist files.
- // It needs to not have spaces in it, and by default is the same as
- // the executable name. If we rename the executable at a later date,
- // keeping this as 'vkconfig' will ensure that it picks up the
- // settings from the previous version (assuming that's ever an issue)
- QCoreApplication::setApplicationName(VKCONFIG_SHORT_NAME);
-
- // Older Qt versions do not have this. Dynamically check the version
- // of Qt since it's just an enumerant. Versions 5.6.0 and later have
- // high dpi support. We really don't need to check the 5, but for
- // the sake of completeness and mabye compatibility with qt 6.
- // Also ignoring the trailing point releases
- const char* version = qVersion();
- int version_major, version_minor;
- sscanf(version, "%d.%d", &version_major, &version_minor);
- if (version_major >= 5 && version_minor >= 6) {
- // Qt::AA_EnableHighDpiScaling = 20 from qnamespace.h in Qt 5.6 or later
- QCoreApplication::setAttribute((Qt::ApplicationAttribute)20);
- }
-
- QApplication app(argc, argv);
-
- // This has to go after the construction of QApplication in
- // order to use a QMessageBox and avoid some QThread warnings.
- ApplicationSingleton singleton("vkconfig_single_instance");
-
- while (!singleton.IsFirstInstance()) {
- if (Alert::ConfiguratorSingleton() == QMessageBox::Cancel) {
- return -1;
- }
- }
-
- // We simply cannot run without any layers
- Configurator& configurator = Configurator::Get(command_line.command_vulkan_sdk);
-
- if (!configurator.Init()) return -1;
-
- // The main GUI is driven here
- MainWindow main_window;
- main_window.show();
-
- return app.exec();
-}
diff --git a/vkconfig/main_gui.h b/vkconfig/main_gui.h
deleted file mode 100644
index 06c17e5aca..0000000000
--- a/vkconfig/main_gui.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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/command_line.h"
-
-int run_gui(int argc, char* argv[], const CommandLine& command_line);
diff --git a/vkconfig/main_layers.cpp b/vkconfig/main_layers.cpp
deleted file mode 100644
index 1e5b041607..0000000000
--- a/vkconfig/main_layers.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * 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 "main_layers.h"
-#include "configurator.h"
-
-#include "../vkconfig_core/configuration.h"
-#include "../vkconfig_core/override.h"
-#include "../vkconfig_core/layer_manager.h"
-
-#include
-
-static int RunLayersOverride(const CommandLine& command_line) {
- PathManager paths(command_line.command_vulkan_sdk, SUPPORTED_CONFIG_FILES);
- Environment environment(paths);
- environment.Reset(Environment::DEFAULT);
-
- LayerManager layers(environment);
- layers.LoadAllInstalledLayers();
-
- Configuration configuration;
- const bool load_result = configuration.Load(layers.selected_layers, command_line.layers_configuration_path.c_str());
- if (!load_result) {
- printf("\nFailed to load the layers configuration file...\n");
- return -1;
- }
-
- // With command line, don't store the application list, it's always global, save and restore the setting
- const bool use_application_list = environment.HasOverriddenApplications();
- environment.SetUseApplicationList(false);
-
- const bool override_result = OverrideConfiguration(environment, layers.selected_layers, configuration);
-
- environment.SetUseApplicationList(use_application_list);
-
- environment.Reset(Environment::SYSTEM); // Don't change the system settings on exit
-
- if (override_result) {
- printf("\nLayers configuration \"%s\" applied to all Vulkan Applications, including Vulkan layers:\n",
- command_line.layers_configuration_path.c_str());
- for (std::size_t i = 0, n = configuration.parameters.size(); i < n; ++i) {
- const Parameter& parameter = configuration.parameters[i];
- if (parameter.state == LAYER_STATE_APPLICATION_CONTROLLED) continue;
-
- printf("\t%s (%s)\n", parameter.key.c_str(), parameter.state == LAYER_STATE_OVERRIDDEN ? "Overridden" : "Excluded");
- }
- printf("\n (Use \"vkconfig layers --surrender\" to return Vulkan layers control to Vulkan applications.)\n");
- } else {
- printf("\nFailed to override Vulkan applications layers...\n");
- }
-
- return override_result ? 0 : -1;
-}
-
-static int RunLayersSurrender(const CommandLine& command_line) {
- PathManager paths(command_line.command_vulkan_sdk, SUPPORTED_CONFIG_FILES);
- Environment environment(paths);
- environment.Reset(Environment::DEFAULT);
-
- const bool has_overridden_layers = HasOverride();
- const bool surrender_result = SurrenderConfiguration(environment);
-
- environment.Reset(Environment::SYSTEM); // Don't change the system settings on exit
-
- if (has_overridden_layers) {
- if (surrender_result) {
- printf("\nFull Vulkan layers control returned to Vulkan applications.\n");
- printf("\n (Use \"vkconfig layers --override to take control of Vulkan layers.)\n");
- } else {
- printf("\nFailed to surrender Vulkan applications layers...\n");
- }
- } else {
- printf("\nNo overridden Vulkan layers, nothing to surrender.\n");
- }
-
- return surrender_result ? 0 : -1;
-}
-
-static int RunLayersList(const CommandLine& command_line) {
- PathManager paths(command_line.command_vulkan_sdk, SUPPORTED_CONFIG_FILES);
- Environment environment(paths);
- environment.Reset(Environment::DEFAULT);
-
- LayerManager layers(environment);
- layers.LoadAllInstalledLayers();
-
- if (layers.selected_layers.empty()) {
- printf("No Vulkan layer found\n");
- } else {
- for (std::size_t i = 0, n = layers.selected_layers.size(); i < n; ++i) {
- const Layer& layer = layers.selected_layers[i];
-
- printf("%s\n", layer.key.c_str());
- }
- }
-
- return 0;
-}
-
-static int RunLayersVerbose(const CommandLine& command_line) {
- PathManager paths(command_line.command_vulkan_sdk, SUPPORTED_CONFIG_FILES);
- Environment environment(paths);
- environment.Reset(Environment::DEFAULT);
-
- LayerManager layers(environment);
- layers.LoadAllInstalledLayers();
-
- for (std::size_t i = 0, n = layers.selected_layers.size(); i < n; ++i) {
- const Layer& layer = layers.selected_layers[i];
-
- printf("%s (%s) %s-%s\n", layer.key.c_str(), GetLayerTypeLabel(layer.type), layer.api_version.str().c_str(),
- layer.implementation_version.c_str());
- printf("- %s\n", layer.description.c_str());
- printf("- %s\n", layer.manifest_path.c_str());
- printf("- %s\n", layer.binary_path.c_str());
- }
-
- return 0;
-}
-
-int run_layers(const CommandLine& command_line) {
- assert(command_line.command == COMMAND_LAYERS);
- assert(command_line.error == ERROR_NONE);
-
- switch (command_line.command_layers_arg) {
- case COMMAND_LAYERS_OVERRIDE: {
- return RunLayersOverride(command_line);
- }
- case COMMAND_LAYERS_SURRENDER: {
- return RunLayersSurrender(command_line);
- }
- case COMMAND_LAYERS_LIST: {
- return RunLayersList(command_line);
- }
- case COMMAND_LAYERS_VERBOSE: {
- return RunLayersVerbose(command_line);
- }
- default: {
- assert(0);
- return -1;
- }
- }
-}
diff --git a/vkconfig/main_reset.cpp b/vkconfig/main_reset.cpp
deleted file mode 100644
index 3480bd9585..0000000000
--- a/vkconfig/main_reset.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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 "main_reset.h"
-
-#include "configurator.h"
-
-#include
-
-#include
-
-static int RunReset(int argc, char* argv[], bool hard) {
- QCoreApplication::setOrganizationName("LunarG");
- QCoreApplication::setOrganizationDomain("lunarg.com");
-
- // This is used by QSettings for .ini, registry, and .plist files.
- // It needs to not have spaces in it, and by default is the same as
- // the executable name. If we rename the executable at a later date,
- // keeping this as 'vkconfig' will ensure that it picks up the
- // settings from the previous version (assuming that's ever an issue)
- QCoreApplication::setApplicationName(VKCONFIG_SHORT_NAME);
-
- // Older Qt versions do not have this. Dynamically check the version
- // of Qt since it's just an enumerant. Versions 5.6.0 and later have
- // high dpi support. We really don't need to check the 5, but for
- // the sake of completeness and mabye compatibility with qt 6.
- // Also ignoring the trailing point releases
- const char* version = qVersion();
- int version_major, version_minor;
- sscanf(version, "%d.%d", &version_major, &version_minor);
- if (version_major >= 5 && version_minor >= 6) {
- // Qt::AA_EnableHighDpiScaling = 20 from qnamespace.h in Qt 5.6 or later
- QCoreApplication::setAttribute((Qt::ApplicationAttribute)20);
- }
-
- QApplication app(argc, argv);
-
- Configurator::Get().ResetToDefault(hard);
-
- return 0;
-}
-
-int run_reset(int argc, char* argv[], const CommandLine& command_line) {
- assert(command_line.command == COMMAND_RESET);
- assert(command_line.error == ERROR_NONE);
-
- switch (command_line.command_reset_arg) {
- case COMMAND_RESET_SOFT: {
- return RunReset(argc, argv, false);
- }
- case COMMAND_RESET_HARD: {
- return RunReset(argc, argv, true);
- }
- default: {
- assert(0);
- return -1;
- }
- }
-}
diff --git a/vkconfig/mainwindow.cpp b/vkconfig/mainwindow.cpp
deleted file mode 100644
index df2c8924b9..0000000000
--- a/vkconfig/mainwindow.cpp
+++ /dev/null
@@ -1,1897 +0,0 @@
-/*
- * 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#include "mainwindow.h"
-
-#include "dialog_about.h"
-#include "dialog_vulkan_analysis.h"
-#include "dialog_vulkan_info.h"
-#include "dialog_layers.h"
-#include "dialog_applications.h"
-
-#include "configurator.h"
-#include "vulkan_util.h"
-
-#include "../vkconfig_core/alert.h"
-#include "../vkconfig_core/util.h"
-#include "../vkconfig_core/version.h"
-#include "../vkconfig_core/platform.h"
-#include "../vkconfig_core/help.h"
-#include "../vkconfig_core/doc.h"
-#include "../vkconfig_core/date.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#if VKC_PLATFORM == VKC_PLATFORM_LINUX || VKC_PLATFORM == VKC_PLATFORM_MACOS
-#include
-#endif
-
-#include
-
-static const int LAUNCH_COLUMN0_SIZE = 220;
-static const int LAUNCH_COLUMN2_SIZE = 32;
-static const int LAUNCH_SPACING_SIZE = 2;
-#if VKC_PLATFORM == VKC_PLATFORM_MACOS
-static const int LAUNCH_ROW_HEIGHT = 26;
-#else
-static const int LAUNCH_ROW_HEIGHT = 28;
-#endif
-
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent),
- _launch_application(nullptr),
- _log_file(nullptr),
- _launcher_apps_combo(nullptr),
- _launcher_executable(nullptr),
- _launcher_arguments(nullptr),
- _launcher_working(nullptr),
- _launcher_log_file_edit(nullptr),
- _launcher_apps_browse_button(nullptr),
- _launcher_executable_browse_button(nullptr),
- _launcher_working_browse_button(nullptr),
- _launcher_log_file_browse_button(nullptr),
- _tray_icon(nullptr),
- _tray_icon_menu(nullptr),
- _tray_restore_action(nullptr),
- _tray_layers_controlled_by_applications(nullptr),
- _tray_layers_controlled_by_configurator(nullptr),
- _tray_layers_disabled_by_configurator(nullptr),
- _tray_quit_action(nullptr),
- ui(new Ui::MainWindow),
- been_warned_about_old_loader(false) {
- ui->setupUi(this);
- ui->launcher_tree->installEventFilter(this);
- ui->configuration_tree->installEventFilter(this);
- ui->settings_tree->installEventFilter(this);
-
- SetupLauncherTree();
-
- connect(ui->action_find_more_layers, SIGNAL(triggered(bool)), this, SLOT(OnHelpFindLayers(bool)));
- connect(ui->actionAbout, SIGNAL(triggered(bool)), this, SLOT(OnHelpAbout(bool)));
- connect(ui->actionVulkan_Info, SIGNAL(triggered(bool)), this, SLOT(toolsVulkanInfo(bool)));
- connect(ui->action_readme, SIGNAL(triggered(bool)), this, SLOT(OnHelpReadme(bool)));
- connect(ui->action_changelog, SIGNAL(triggered(bool)), this, SLOT(OnHelpChangelog(bool)));
- connect(ui->actionVulkan_specification, SIGNAL(triggered(bool)), this, SLOT(OnHelpVulkanSpec(bool)));
- connect(ui->actionVulkan_Layer_Specification, SIGNAL(triggered(bool)), this, SLOT(OnHelpLayerSpec(bool)));
- connect(ui->actionGPU_Info_Reports, SIGNAL(triggered(bool)), this, SLOT(OnHelpGPUInfo(bool)));
-
- connect(ui->actionVulkan_Installation, SIGNAL(triggered(bool)), this, SLOT(toolsVulkanInstallation(bool)));
- connect(ui->actionRestore_Default_Configurations, SIGNAL(triggered(bool)), this, SLOT(toolsResetToDefault(bool)));
-
- connect(ui->configuration_tree, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this,
- SLOT(OnConfigurationItemChanged(QTreeWidgetItem *, int)));
- connect(ui->configuration_tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this,
- SLOT(OnConfigurationItemDoubleClicked(QTreeWidgetItem *, int)));
- connect(ui->configuration_tree, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this,
- SLOT(OnConfigurationTreeChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
- connect(ui->configuration_tree, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this,
- SLOT(OnConfigurationTreeClicked(QTreeWidgetItem *, int)));
-
- connect(ui->combo_box_layers_controlled, SIGNAL(currentIndexChanged(int)), this, SLOT(OnComboBoxModeChanged(int)));
-
- connect(ui->settings_tree, SIGNAL(itemExpanded(QTreeWidgetItem *)), this, SLOT(editorExpanded(QTreeWidgetItem *)));
- // No need to do something when clicking on the setting tree, individual setting will update the configuration files
- // connect(ui->settings_tree, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(OnSettingsTreeClicked(QTreeWidgetItem *,
- // int)));
-
- connect(ui->launcher_tree, SIGNAL(itemCollapsed(QTreeWidgetItem *)), this, SLOT(launchItemCollapsed(QTreeWidgetItem *)));
- connect(ui->launcher_tree, SIGNAL(itemExpanded(QTreeWidgetItem *)), this, SLOT(launchItemExpanded(QTreeWidgetItem *)));
-
- connect(ui->launcher_loader_debug, SIGNAL(currentIndexChanged(int)), this, SLOT(OnLauncherLoaderMessageChanged(int)));
-
- Configurator &configurator = Configurator::Get();
- Environment &environment = configurator.environment;
-
- // Restore window geometry from last launch
- restoreGeometry(environment.Get(VKCONFIG2_LAYOUT_MAIN_GEOMETRY));
- restoreState(environment.Get(VKCONFIG2_LAYOUT_MAIN_WINDOW_STATE));
- ui->splitter_settings->restoreState(environment.Get(VKCONFIG2_LAYOUT_MAIN_SPLITTER1));
- ui->splitter_configurations->restoreState(environment.Get(VKCONFIG2_LAYOUT_MAIN_SPLITTER2));
- ui->splitter_main->restoreState(environment.Get(VKCONFIG2_LAYOUT_MAIN_SPLITTER3));
-
- ui->check_box_persistent->setToolTip("Keep Vulkan Configurator running in system tray when closing the main window");
- ui->check_box_persistent->setVisible(QSystemTrayIcon::isSystemTrayAvailable());
-
- LoadConfigurationList();
-
- // Resetting this from the default prevents the log window (a QTextEdit) from overflowing.
- // Whenever the control surpasses this block count, old blocks are discarded.
- // Note: We could make this a user configurable setting down the road should this be
- // insufficinet.
- ui->log_browser->document()->setMaximumBlockCount(2048);
- ui->configuration_tree->scrollToItem(ui->configuration_tree->topLevelItem(0), QAbstractItemView::PositionAtTop);
-
- this->InitTray();
- this->UpdateTray();
- this->UpdateUI();
-}
-
-MainWindow::~MainWindow() { ResetLaunchApplication(); }
-
-void MainWindow::InitTray() {
- if (QSystemTrayIcon::isSystemTrayAvailable()) {
- this->_tray_quit_action = new QAction("&Quit", this);
- connect(this->_tray_quit_action, &QAction::triggered, qApp, &QCoreApplication::quit);
-
- this->_tray_restore_action = new QAction("Open &Vulkan Configurator", this);
- connect(this->_tray_restore_action, &QAction::triggered, this, &MainWindow::trayActionRestore);
-
- this->_tray_layers_controlled_by_applications = new QAction("Layers Controlled by the Vulkan Applications", this);
- this->_tray_layers_controlled_by_applications->setCheckable(true);
- connect(this->_tray_layers_controlled_by_applications, &QAction::toggled, this,
- &MainWindow::trayActionControlledByApplications);
-
- this->_tray_layers_controlled_by_configurator = new QAction("Layers Controlled by the Vulkan Configurator", this);
- this->_tray_layers_controlled_by_configurator->setCheckable(true);
- connect(this->_tray_layers_controlled_by_configurator, &QAction::toggled, this,
- &MainWindow::trayActionControlledByConfigurator);
-
- this->_tray_layers_disabled_by_configurator = new QAction("Layers Disabled by the Vulkan Configurator", this);
- this->_tray_layers_disabled_by_configurator->setCheckable(true);
- connect(this->_tray_layers_disabled_by_configurator, &QAction::toggled, this,
- &MainWindow::trayActionDisabledByApplications);
-
- this->_tray_icon_menu = new QMenu(this);
- this->_tray_icon_menu->addAction(this->_tray_restore_action);
- this->_tray_icon_menu->addSeparator();
- this->_tray_icon_menu->addAction(this->_tray_layers_controlled_by_applications);
- this->_tray_icon_menu->addAction(this->_tray_layers_controlled_by_configurator);
- this->_tray_icon_menu->addAction(this->_tray_layers_disabled_by_configurator);
- 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->connect(this->_tray_icon, &QSystemTrayIcon::activated, this, &MainWindow::iconActivated);
- }
-}
-
-void MainWindow::UpdateTray() {
- if (QSystemTrayIcon::isSystemTrayAvailable()) {
- QApplication::setQuitOnLastWindowClosed(!ui->check_box_persistent->isChecked());
-
- Configurator &configurator = Configurator::Get();
-
- const Environment &environment = configurator.environment;
-
- const bool use_override = environment.GetMode() != LAYERS_MODE_BY_APPLICATIONS;
- const bool active = configurator.configurations.HasActiveConfiguration(configurator.layers.selected_layers) && use_override;
-
- switch (environment.GetMode()) {
- default:
- case LAYERS_MODE_BY_APPLICATIONS:
- this->_tray_layers_controlled_by_applications->setChecked(true);
- this->_tray_layers_controlled_by_configurator->setChecked(false);
- this->_tray_layers_disabled_by_configurator->setChecked(false);
- break;
- case LAYERS_MODE_BY_CONFIGURATOR_RUNNING:
- this->_tray_layers_controlled_by_applications->setChecked(false);
- this->_tray_layers_controlled_by_configurator->setChecked(true);
- this->_tray_layers_disabled_by_configurator->setChecked(false);
- break;
- case LAYERS_MODE_BY_CONFIGURATOR_ALL_DISABLED:
- this->_tray_layers_controlled_by_applications->setChecked(false);
- this->_tray_layers_controlled_by_configurator->setChecked(false);
- this->_tray_layers_disabled_by_configurator->setChecked(true);
- break;
- }
-
- if (active) {
- const QIcon icon(":/resourcefiles/vkconfig-on.png");
-
- this->setWindowIcon(icon);
- 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);
- this->_tray_icon->setIcon(icon);
- this->_tray_icon->setToolTip("Layers controlled by the Vulkan Applications");
- }
-
- this->_tray_icon->show();
- }
-}
-
-void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason) {
- switch (reason) {
- default:
- break;
- case QSystemTrayIcon::Context:
- break;
- case QSystemTrayIcon::DoubleClick:
- Qt::WindowStates window_states = this->windowState();
-
- const bool is_minimized = this->isMinimized();
- const bool is_visible = this->isVisible();
- const bool is_hidden = this->isHidden();
-
- if (this->isMinimized() || this->isHidden()) {
- this->setVisible(true);
- this->showNormal();
- this->setWindowState(Qt::WindowState::WindowActive);
- } else {
- this->hide();
- }
-
- this->UpdateTray();
- break;
- }
-}
-
-void MainWindow::trayActionRestore() {
- this->hide();
- this->showNormal();
-
- this->UpdateUI();
- this->UpdateTray();
-}
-
-void MainWindow::trayActionControlledByApplications(bool checked) {
- if (checked) {
- Configurator &configurator = Configurator::Get();
- configurator.environment.SetMode(LAYERS_MODE_BY_APPLICATIONS);
- configurator.configurations.Configure(configurator.layers.selected_layers);
-
- this->UpdateUI();
- this->UpdateTray();
- }
-}
-
-void MainWindow::trayActionControlledByConfigurator(bool checked) {
- if (checked) {
- Configurator &configurator = Configurator::Get();
- configurator.environment.SetMode(LAYERS_MODE_BY_CONFIGURATOR_RUNNING);
- configurator.configurations.Configure(configurator.layers.selected_layers);
-
- this->UpdateUI();
- this->UpdateTray();
- }
-}
-
-void MainWindow::trayActionDisabledByApplications(bool checked) {
- if (checked) {
- Configurator &configurator = Configurator::Get();
- configurator.environment.SetMode(LAYERS_MODE_BY_CONFIGURATOR_ALL_DISABLED);
- configurator.configurations.Configure(configurator.layers.selected_layers);
-
- this->UpdateUI();
- this->UpdateTray();
- }
-}
-
-static std::string GetMainWindowTitle(bool active) {
-#if VKCONFIG_DATE
- std::string title = format("%s %s-%s", VKCONFIG_NAME, Version::VKCONFIG.str().c_str(), GetBuildDate().c_str());
-#else
- std::string title = format("%s %s", VKCONFIG_NAME, Version::VKCONFIG.str().c_str());
-#endif
- if (active) title += " ";
- return title;
-}
-
-void MainWindow::UpdateUI() {
- static int check_recurse = 0;
- ++check_recurse;
- assert(check_recurse <= 2);
-
- Configurator &configurator = Configurator::Get();
- const Environment &environment = Configurator::Get().environment;
- const std::string &selected_contiguration_name = environment.GetSelectedConfiguration();
- const bool has_selected_configuration = !selected_contiguration_name.empty();
-
- this->blockSignals(true);
- this->ClearLog();
-
- ui->configuration_tree->blockSignals(true);
-
- ui->combo_box_layers_controlled->blockSignals(true);
- ui->combo_box_layers_controlled->setCurrentIndex(environment.GetMode());
- ui->combo_box_layers_controlled->blockSignals(false);
-
- const bool has_active_configuration = configurator.configurations.HasActiveConfiguration(configurator.layers.selected_layers);
-
- // Mode states
- this->UpdateTray();
-
- // Update configurations
- ui->group_box_configurations->setEnabled(environment.GetMode() == LAYERS_MODE_BY_CONFIGURATOR_RUNNING);
- ui->configuration_tree->setCurrentItem(nullptr);
-
- for (int i = 0, n = ui->configuration_tree->topLevelItemCount(); i < n; ++i) {
- ConfigurationListItem *item = dynamic_cast(ui->configuration_tree->topLevelItem(i));
- assert(item);
- assert(!item->configuration_name.empty());
-
- Configuration *configuration =
- FindByKey(configurator.configurations.available_configurations, item->configuration_name.c_str());
- if (configuration == nullptr) continue;
-
- item->setText(1, item->configuration_name.c_str());
- item->setToolTip(1, configuration->description.c_str());
- item->radio_button->setToolTip(configuration->description.c_str());
- item->radio_button->blockSignals(true);
-
- if (item->configuration_name == selected_contiguration_name) {
- item->radio_button->setChecked(true);
- ui->configuration_tree->setCurrentItem(item);
- } else {
- // item->radio_button->setChecked(false);
- }
-
- item->radio_button->blockSignals(false);
- }
-
- // Update settings
- ui->push_button_edit->setEnabled(has_selected_configuration);
- ui->push_button_remove->setEnabled(has_selected_configuration);
- ui->push_button_duplicate->setEnabled(has_selected_configuration);
- ui->push_button_new->setEnabled(true);
- if (has_selected_configuration) {
- ui->group_box_settings->setTitle((selected_contiguration_name + " Settings").c_str());
- } else {
- ui->group_box_settings->setTitle("Configuration Settings");
- }
-
- // Handle application lists states
- ui->check_box_apply_list->setEnabled(!been_warned_about_old_loader &&
- ui->combo_box_layers_controlled->currentIndex() != LAYERS_MODE_BY_APPLICATIONS);
- ui->check_box_apply_list->setChecked(!been_warned_about_old_loader && environment.GetUseApplicationList());
- ui->push_button_applications->setEnabled(!been_warned_about_old_loader &&
- ui->combo_box_layers_controlled->currentIndex() != LAYERS_MODE_BY_APPLICATIONS);
-
- _launcher_apps_combo->blockSignals(true);
- _launcher_apps_combo->clear();
-
- const std::vector &applications = environment.GetApplications();
- if (applications.empty()) {
- _launcher_executable->setText("");
- _launcher_arguments->setText("");
- _launcher_working->setText("");
- _launcher_log_file_edit->setText("");
- } else {
- for (std::size_t i = 0, n = applications.size(); i < n; ++i) {
- _launcher_apps_combo->addItem(applications[i].app_name.c_str());
- }
- _launcher_apps_combo->setCurrentIndex(environment.GetActiveApplicationIndex());
-
- const Application &application = environment.GetActiveApplication();
- this->UpdateApplicationUI(application);
- }
-
- _launcher_apps_combo->blockSignals(false);
-
- // Handle persistent states
- ui->check_box_persistent->setChecked(environment.GetUseSystemTray());
-
- // Launcher states
- const bool has_application_list = !environment.GetApplications().empty();
- ui->push_button_launcher->setEnabled(has_application_list);
- ui->push_button_launcher->setText(_launch_application ? "Terminate" : "Launch");
- ui->check_box_clear_on_launch->setChecked(environment.Get(LAYOUT_LAUNCHER_NOT_CLEAR) != "true");
- ui->launcher_loader_debug->blockSignals(true); // avoid calling again UpdateUI
- ui->launcher_loader_debug->setCurrentIndex(GetLoaderMessageType(environment.GetLoaderMessageTypes()));
- ui->launcher_loader_debug->blockSignals(false);
-
- // ui->launcher_loader_debug
- if (_launcher_executable_browse_button) {
- _launcher_executable_browse_button->setEnabled(has_application_list);
- }
- if (_launcher_working_browse_button) {
- _launcher_working_browse_button->setEnabled(has_application_list);
- }
- if (_launcher_log_file_browse_button) {
- _launcher_log_file_browse_button->setEnabled(has_application_list);
- }
- if (_launcher_apps_combo) {
- _launcher_apps_combo->setEnabled(has_application_list);
- }
- if (_launcher_executable) {
- _launcher_executable->setEnabled(has_application_list);
- }
- if (_launcher_arguments) {
- _launcher_arguments->setEnabled(has_application_list);
- }
- if (_launcher_working) {
- _launcher_working->setEnabled(has_application_list);
- }
- if (_launcher_log_file_edit) {
- _launcher_log_file_edit->setEnabled(has_application_list);
- }
-
- ui->settings_tree->setEnabled(environment.GetMode() == LAYERS_MODE_BY_CONFIGURATOR_RUNNING && has_selected_configuration);
- if (has_selected_configuration) {
- this->_settings_tree_manager.CreateGUI(ui->settings_tree);
- } else {
- this->_settings_tree_manager.CleanupGUI();
- }
-
- // Update title bar
- setWindowTitle(GetMainWindowTitle(has_active_configuration).c_str());
-
- ui->configuration_tree->blockSignals(false);
- this->blockSignals(false);
-
- --check_recurse;
-}
-
-// Load or refresh the list of configuration. Any configuration that uses a layer that
-// is not detected on the system is disabled.
-void MainWindow::LoadConfigurationList() {
- // There are lots of ways into this, and in none of them
- // can we have an active editor running.
- _settings_tree_manager.CleanupGUI();
- ui->configuration_tree->blockSignals(true); // No signals firing off while we do this
- ui->configuration_tree->clear();
-
- Configurator &configurator = Configurator::Get();
-
- for (std::size_t i = 0, n = configurator.configurations.available_configurations.size(); i < n; ++i) {
- const Configuration &configuration = configurator.configurations.available_configurations[i];
-
- // Hide built-in configuration when the layer is missing. The Vulkan user may have not installed the necessary layer
- // if (configuration.IsBuiltIn() && HasMissingLayer(configuration.parameters, configurator.layers.available_layers))
- // continue;
-
- ConfigurationListItem *item = new ConfigurationListItem(configuration.key);
- item->setToolTip(0, configuration.description.c_str());
- item->radio_button = new QRadioButton();
- item->radio_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- item->radio_button->setFixedSize(QSize(24, 24));
- item->radio_button->setToolTip(configuration.description.c_str());
- item->setFlags(item->flags() | Qt::ItemIsEditable);
- ui->configuration_tree->addTopLevelItem(item);
- ui->configuration_tree->setItemWidget(item, 0, item->radio_button);
- // connect(item->radio_button, SIGNAL(clicked(bool)), this, SLOT(OnConfigurationItemClicked(bool)));
- connect(item->radio_button, SIGNAL(toggled(bool)), this, SLOT(OnConfigurationItemClicked(bool)));
- }
-
- ui->configuration_tree->blockSignals(false);
- ui->configuration_tree->resizeColumnToContents(0);
- ui->configuration_tree->resizeColumnToContents(1);
-}
-
-/// Okay, because we are using custom controls, some of
-/// the signaling is not happening as expected. So, we cannot
-/// always get an accurate answer to the currently selected
-/// item, but we do often need to know what has been checked
-/// when an event occurs. This unambigously answers that question.
-ConfigurationListItem *MainWindow::GetCheckedItem() {
- // Just go through all the top level items
- for (int i = 0, n = ui->configuration_tree->topLevelItemCount(); i < n; ++i) {
- ConfigurationListItem *item = dynamic_cast(ui->configuration_tree->topLevelItem(i));
-
- if (item == nullptr) continue;
- if (item->radio_button->isChecked()) return item;
- }
-
- return nullptr;
-}
-
-void MainWindow::OnComboBoxModeChanged(int index) {
- Configurator &configurator = Configurator::Get();
- configurator.environment.SetMode(static_cast(ui->combo_box_layers_controlled->currentIndex()));
-
- this->UpdateUI();
-}
-
-// We want to apply to just the app list... hang on there. Doe we have the new loader?
-void MainWindow::on_check_box_apply_list_clicked() {
- Configurator &configurator = Configurator::Get();
-
- // Handle old loader case
- Version loader_version;
- if (!configurator.SupportApplicationList(&loader_version)) {
- const std::string version = loader_version.str();
- const std::string message =
- format("The detected Vulkan loader version is %s but version 1.2.141 or newer is required", version.c_str());
- ui->check_box_apply_list->setToolTip(message.c_str());
-
- Alert::ApplicationListUnsupported(message.c_str());
-
- ui->check_box_apply_list->setEnabled(false);
- ui->check_box_apply_list->setChecked(false);
- ui->push_button_applications->setEnabled(false);
- configurator.environment.SetUseApplicationList(false);
- been_warned_about_old_loader = true;
-
- return;
- }
-
- configurator.environment.SetUseApplicationList(ui->check_box_apply_list->isChecked());
-
- // Handle the case where no application with active override is present
- const bool application_list_requires_update = !configurator.environment.HasOverriddenApplications();
- if (ui->check_box_apply_list->isChecked() && application_list_requires_update) {
- ApplicationsDialog dialog(this);
- dialog.exec();
- }
-
- configurator.configurations.Configure(configurator.layers.selected_layers);
-
- UpdateUI();
-}
-
-void MainWindow::on_check_box_persistent_clicked() {
- if (!QSystemTrayIcon::isSystemTrayAvailable()) {
- return;
- }
-
- Environment &environment = Configurator::Get().environment;
-
- // Alert the user to the current state of the vulkan configurator and
- // give them the option to not shutdown.
- QSettings settings;
- if (ui->check_box_persistent->isChecked() && !settings.value(VKCONFIG_KEY_MESSAGE_SYSTEM_TRAY, false).toBool()) {
- const QPalette saved_palette = ui->check_box_persistent->palette();
- QPalette modified_palette = saved_palette;
- modified_palette.setColor(QPalette::ColorRole::WindowText, QColor(255, 0, 0, 255));
- ui->check_box_persistent->setPalette(modified_palette);
-
- const std::string message = "Vulkan Layers will remain controlled by Vulkan Configurator while active in the system tray.";
-
- QMessageBox alert(this);
- alert.setWindowTitle("Vulkan Configurator behavior when closing the main window");
- alert.setText(message.c_str());
- alert.setIcon(QMessageBox::Warning);
- alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
- alert.setDefaultButton(QMessageBox::No);
- alert.setCheckBox(new QCheckBox("Do not show again."));
- alert.setInformativeText(
- "Do you want to keep Vulkan Configurator running in the system tray when closing the main window?");
-
- int ret_val = alert.exec();
- settings.setValue(VKCONFIG_KEY_MESSAGE_SYSTEM_TRAY, alert.checkBox()->isChecked());
-
- ui->check_box_persistent->setPalette(saved_palette);
-
- if (ret_val == QMessageBox::No) {
- ui->check_box_persistent->setChecked(false);
- return;
- }
- }
-
- environment.SetUseSystemTray(ui->check_box_persistent->isChecked());
-}
-
-void MainWindow::on_check_box_clear_on_launch_clicked() {
- Configurator::Get().environment.Set(LAYOUT_LAUNCHER_NOT_CLEAR, ui->check_box_clear_on_launch->isChecked() ? "false" : "true");
-}
-
-void MainWindow::toolsResetToDefault(bool checked) {
- (void)checked;
-
- ResetLaunchApplication();
-
- if (Alert::ConfiguratorResetAll() == QMessageBox::No) return;
-
- Configurator &configurator = Configurator::Get();
- configurator.ResetToDefault(true);
-
- LoadConfigurationList();
-
- this->UpdateUI();
-}
-
-// Thist signal actually comes from the radio button
-void MainWindow::OnConfigurationItemClicked(bool checked) {
- (void)checked;
- // Someone just got checked, they are now the current profile
- // This pointer will only be valid if it's one of the elements with
- // the radio button
- ConfigurationListItem *configuration_item = GetCheckedItem();
- if (configuration_item == nullptr) {
- return;
- }
-
- // This appears redundant on Windows, but under linux it is needed
- // to ensure the new item is "selected"
- ui->configuration_tree->setCurrentItem(configuration_item);
-
- Configurator &configurator = Configurator::Get();
- if (configurator.environment.GetSelectedConfiguration() != configuration_item->configuration_name) {
- configurator.ActivateConfiguration(configuration_item->configuration_name);
- this->UpdateUI();
- }
-}
-
-void MainWindow::OnConfigurationTreeClicked(QTreeWidgetItem *item, int column) {
- (void)column;
-
- ConfigurationListItem *configuration_item = dynamic_cast(item);
- if (configuration_item == nullptr) {
- return;
- }
-
- Configurator &configurator = Configurator::Get();
- if (configurator.environment.GetSelectedConfiguration() != configuration_item->configuration_name) {
- configurator.ActivateConfiguration(configuration_item->configuration_name);
- this->UpdateUI();
- }
-}
-
-/// This gets called with keyboard selections and clicks that do not necessarily
-/// result in a radio button change (but it may). So we need to do two checks here, one
-/// for the radio button, and one to change the editor/information at lower right.
-void MainWindow::OnConfigurationTreeChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous) {
- (void)previous;
-
- // This pointer will only be valid if it's one of the elements with
- // the radio button
- ConfigurationListItem *configuration_item = dynamic_cast(current);
- if (configuration_item == nullptr) {
- return;
- }
- configuration_item->radio_button->setChecked(true);
-
- Configurator &configurator = Configurator::Get();
- if (configurator.environment.GetSelectedConfiguration() != configuration_item->configuration_name) {
- configurator.ActivateConfiguration(configuration_item->configuration_name);
- this->UpdateUI();
- }
-}
-
-void MainWindow::OnConfigurationItemDoubleClicked(QTreeWidgetItem *item, int column) {
- ConfigurationListItem *configuration_item = dynamic_cast(item);
- if (configuration_item == nullptr) {
- return;
- }
-
- EditClicked(configuration_item);
-}
-
-/// An item has been changed. Check for edit of the items name (configuration name)
-void MainWindow::OnConfigurationItemChanged(QTreeWidgetItem *item, int column) {
- // This pointer will only be valid if it's one of the elements with
- // the radio button
- ConfigurationListItem *configuration_item = dynamic_cast(item);
- if (configuration_item == nullptr) {
- return;
- }
-
- if (column == 1) { // configuration name
- _settings_tree_manager.CleanupGUI();
- Configurator &configurator = Configurator::Get();
-
- // We are renaming the file. Things can go wrong here...
- // This is the name of the configuratin we are changing
- // const std::string full_path =
- // ConvertNativeSeparators(GetPath(BUILTIN_PATH_CONFIG_LAST) + "/" + configuration_item->configuration_name + ".json");
-
- // This is the new name we want to use for the configuration
- const std::string &new_name = configuration_item->text(1).toStdString();
- bool valid_new_name = true;
-
- if (new_name.empty()) {
- valid_new_name = false;
- Alert::ConfigurationNameEmpty();
- } else {
- if (!IsPortableFilename(new_name)) {
- valid_new_name = false;
- Alert::ConfigurationNameInvalid();
- }
- }
-
- Configuration *duplicate_configuration = FindByKey(configurator.configurations.available_configurations, new_name.c_str());
- if (duplicate_configuration != nullptr) {
- valid_new_name = false;
- Alert::ConfigurationRenamingFailed();
- }
-
- // Find existing configuration using it's old name
- const std::string old_name = configuration_item->configuration_name;
- Configuration *configuration = FindByKey(configurator.configurations.available_configurations, old_name.c_str());
-
- if (valid_new_name) {
- // Rename configuration ; Remove old configuration file ; change the name of the configuration
- configurator.configurations.RemoveConfigurationFile(old_name);
- configuration->key = configuration_item->configuration_name = new_name;
- configurator.configurations.SaveAllConfigurations(configurator.layers.selected_layers);
-
- configurator.ActivateConfiguration(new_name);
-
- LoadConfigurationList();
- } else {
- // If the configurate name is empty or the configuration name is taken, keep old configuration name
-
- ui->configuration_tree->blockSignals(true);
- item->setText(1, old_name.c_str());
- ui->configuration_tree->blockSignals(false);
-
- configurator.ActivateConfiguration(old_name);
- }
-
- this->UpdateUI();
- }
-}
-
-// Unused flag, just display the about Qt dialog
-void MainWindow::OnHelpAbout(bool checked) {
- (void)checked;
-
- AboutDialog dlg(this);
- dlg.exec();
-}
-
-void MainWindow::StartTool(Tool tool) {
- Configurator &configurator = Configurator::Get();
-
- LayersMode saved_mode = configurator.environment.GetMode();
- configurator.environment.SetMode(LAYERS_MODE_BY_APPLICATIONS);
- configurator.configurations.Configure(configurator.layers.selected_layers);
-
- switch (tool) {
- case TOOL_VULKAN_INFO:
- vk_info_dialog.reset(new VulkanInfoDialog(this));
- break;
- case TOOL_VULKAN_INSTALL:
- vk_installation_dialog.reset(new VulkanAnalysisDialog(this));
- break;
- }
-
- configurator.environment.SetMode(saved_mode);
- configurator.configurations.Configure(configurator.layers.selected_layers);
-}
-
-/// Create the VulkanInfo dialog if it doesn't already exits & show it.
-void MainWindow::toolsVulkanInfo(bool checked) {
- (void)checked;
-
- this->StartTool(TOOL_VULKAN_INFO);
-}
-
-/// Create the VulkanTools dialog if it doesn't already exist & show it.
-void MainWindow::toolsVulkanInstallation(bool checked) {
- (void)checked;
-
- this->StartTool(TOOL_VULKAN_INSTALL);
-}
-
-void MainWindow::OnHelpFindLayers(bool checked) {
- (void)checked;
-
- ShowDoc(DOC_FIND_LAYERS);
-}
-
-void MainWindow::OnHelpReadme(bool checked) {
- (void)checked;
-
- ShowDoc(DOC_VKCONFIG_README);
-}
-
-void MainWindow::OnHelpChangelog(bool checked) {
- (void)checked;
-
- ShowDoc(DOC_VKCONFIG_CHANGELOG);
-}
-
-void MainWindow::OnHelpVulkanSpec(bool checked) {
- (void)checked;
-
- ShowDoc(DOC_VULKAN_SPEC);
-}
-
-void MainWindow::OnHelpLayerSpec(bool checked) {
- (void)checked;
-
- ShowDoc(DOC_VULKAN_LAYERS);
-}
-
-void MainWindow::OnHelpGPUInfo(bool checked) {
- (void)checked;
-
- ShowDoc(DOC_GPU_INFO);
-}
-
-/// The only thing we need to do here is clear the configuration if
-/// the user does not want it active.
-void MainWindow::closeEvent(QCloseEvent *event) {
- Environment &environment = Configurator::Get().environment;
-
- // If a child process is still running, destroy it
- if (_launch_application) {
- ResetLaunchApplication();
- }
-
- _settings_tree_manager.CleanupGUI();
-
- environment.Set(VKCONFIG2_LAYOUT_MAIN_GEOMETRY, saveGeometry());
- environment.Set(VKCONFIG2_LAYOUT_MAIN_WINDOW_STATE, saveState());
- environment.Set(VKCONFIG2_LAYOUT_MAIN_SPLITTER1, ui->splitter_settings->saveState());
- environment.Set(VKCONFIG2_LAYOUT_MAIN_SPLITTER2, ui->splitter_configurations->saveState());
- environment.Set(VKCONFIG2_LAYOUT_MAIN_SPLITTER3, ui->splitter_main->saveState());
-
- environment.Save();
-
- if (QSystemTrayIcon::isSystemTrayAvailable() && environment.GetUseSystemTray()) {
- QGuiApplication::setQuitOnLastWindowClosed(false);
- this->hide();
- event->ignore();
- } else {
- QGuiApplication::setQuitOnLastWindowClosed(true);
- QMainWindow::closeEvent(event);
- }
-}
-
-/// Resizing needs a little help. Yes please, there has to be
-/// a better way of doing this.
-void MainWindow::resizeEvent(QResizeEvent *event) {
- if (event != nullptr) event->accept();
-}
-
-void MainWindow::showEvent(QShowEvent *event) {
- (void)event;
-
- UpdateUI();
-
- event->accept();
-}
-
-/// Edit the list of apps that can be filtered.
-void MainWindow::on_push_button_applications_clicked() {
- ApplicationsDialog dlg(this);
- dlg.exec();
-
- Configurator &configurator = Configurator::Get();
- configurator.configurations.Configure(configurator.layers.selected_layers);
-
- UpdateUI();
-}
-
-void MainWindow::on_push_button_new_clicked() {
- Configurator &configurator = Configurator::Get();
- const std::string selected_configuration = configurator.environment.GetSelectedConfiguration();
-
- Configuration &new_configuration =
- configurator.configurations.CreateConfiguration(configurator.layers.selected_layers, "New Configuration");
-
- std::string activate_configuration;
-
- LayersDialog dlg(this, new_configuration);
- switch (dlg.exec()) {
- case QDialog::Accepted:
- activate_configuration = new_configuration.key;
- break;
- case QDialog::Rejected:
- activate_configuration = selected_configuration;
- configurator.configurations.RemoveConfiguration(configurator.layers.selected_layers, new_configuration.key);
- break;
- default:
- assert(0);
- break;
- }
-
- configurator.ActivateConfiguration(activate_configuration);
-
- LoadConfigurationList();
-
- this->UpdateUI();
-}
-
-void MainWindow::on_push_button_remove_clicked() {
- Configurator &configurator = Configurator::Get();
-
- this->RemoveConfiguration(configurator.environment.GetSelectedConfiguration());
-}
-
-void MainWindow::on_push_button_duplicate_clicked() {
- Configurator &configurator = Configurator::Get();
-
- Configuration *configutation = configurator.configurations.FindActiveConfiguration();
- assert(configutation != nullptr);
-
- const Configuration &duplicated_configuration =
- configurator.configurations.CreateConfiguration(configurator.layers.selected_layers, configutation->key, true);
-
- configurator.ActivateConfiguration(duplicated_configuration.key);
-
- LoadConfigurationList();
-
- this->UpdateUI();
-}
-
-void MainWindow::on_push_button_edit_clicked() {
- Configurator &configurator = Configurator::Get();
- Configuration *configuration = configurator.configurations.FindActiveConfiguration();
- assert(configuration != nullptr);
-
- LayersDialog dlg(this, *configuration);
- if (dlg.exec() == QDialog::Accepted) {
- configurator.ActivateConfiguration(configuration->key);
-
- LoadConfigurationList();
-
- this->UpdateUI();
- }
-}
-
-// Edit the layers for the given configuration.
-void MainWindow::EditClicked(ConfigurationListItem *item) {
- assert(item);
- assert(!item->configuration_name.empty());
-
- Configurator &configurator = Configurator::Get();
- Configuration *configuration =
- FindByKey(configurator.configurations.available_configurations, item->configuration_name.c_str());
- assert(configuration != nullptr);
-
- LayersDialog dlg(this, *configuration);
- if (dlg.exec() == QDialog::Accepted) {
- configurator.configurations.SortConfigurations();
- configurator.ActivateConfiguration(configuration->key);
-
- LoadConfigurationList();
-
- this->UpdateUI();
- }
-}
-
-void MainWindow::RemoveConfiguration(const std::string &configuration_name) {
- assert(!configuration_name.empty());
-
- // Let make sure...
- QMessageBox alert;
- alert.setWindowTitle(format("Removing *%s* configuration...", configuration_name.c_str()).c_str());
- alert.setText(format("Are you sure you want to remove the *%s* configuration?", configuration_name.c_str()).c_str());
- alert.setInformativeText("All the data from this configuration will be lost.");
- alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
- alert.setDefaultButton(QMessageBox::Yes);
- alert.setIcon(QMessageBox::Warning);
- if (alert.exec() == QMessageBox::No) {
- return;
- }
-
- Configurator &configurator = Configurator::Get();
- configurator.configurations.RemoveConfiguration(configurator.layers.selected_layers, configuration_name);
- configurator.environment.SetSelectedConfiguration("");
-
- LoadConfigurationList();
-
- this->UpdateUI();
-}
-
-void MainWindow::RemoveClicked(ConfigurationListItem *item) {
- assert(item);
-
- this->RemoveConfiguration(item->configuration_name);
-}
-
-void MainWindow::ResetClicked(ConfigurationListItem *item) {
- assert(item);
- assert(!item->configuration_name.empty());
-
- Configurator &configurator = Configurator::Get();
- Configuration *configuration =
- FindByKey(configurator.configurations.available_configurations, item->configuration_name.c_str());
- assert(configuration != nullptr);
-
- QMessageBox alert;
- alert.setWindowTitle(format("Resetting *%s* configuration...", configuration->key.c_str()).c_str());
- alert.setText(format("Are you sure you want to reset the *%s* configuration?", configuration->key.c_str()).c_str());
- if (configuration->IsBuiltIn())
- alert.setInformativeText(
- format("The configuration layers and settings will be restored to default built-in *%s* configuration.",
- configuration->key.c_str())
- .c_str());
- else if (configurator.configurations.HasFile(*configuration))
- alert.setInformativeText(
- format("The configuration layers and settings will be reloaded using the *%s* saved file from previous %s run.",
- configuration->key.c_str(), VKCONFIG_NAME)
- .c_str());
- else
- alert.setInformativeText("The configuration layers and settings will be reset to zero.");
- alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
- alert.setDefaultButton(QMessageBox::Yes);
- alert.setIcon(QMessageBox::Warning);
- if (alert.exec() == QMessageBox::No) {
- return;
- }
-
- configuration->Reset(configurator.layers.selected_layers, configurator.path);
-
- configurator.ActivateConfiguration(configuration->key);
-
- LoadConfigurationList();
-
- this->UpdateUI();
-}
-
-void MainWindow::RenameClicked(ConfigurationListItem *item) {
- assert(item);
-
- ui->configuration_tree->editItem(item, 1);
-}
-
-void MainWindow::DuplicateClicked(ConfigurationListItem *item) {
- assert(item);
- assert(!item->configuration_name.empty());
-
- Configurator &configurator = Configurator::Get();
- const Configuration &duplicated_configuration =
- configurator.configurations.CreateConfiguration(configurator.layers.selected_layers, item->configuration_name, true);
-
- item->configuration_name = duplicated_configuration.key;
-
- configurator.ActivateConfiguration(duplicated_configuration.key);
-
- LoadConfigurationList();
-
- ConfigurationListItem *new_item = nullptr;
- for (int i = 0, n = ui->configuration_tree->topLevelItemCount(); i < n; ++i) {
- ConfigurationListItem *searched_item = dynamic_cast(ui->configuration_tree->topLevelItem(i));
- assert(searched_item);
-
- if (searched_item->configuration_name != duplicated_configuration.key) continue;
-
- new_item = searched_item;
- break;
- }
- assert(new_item);
- ui->configuration_tree->editItem(new_item, 1);
-
- this->UpdateUI();
-}
-
-void MainWindow::ImportClicked(ConfigurationListItem *item) {
- (void)item; // We don't need this
-
- Configurator &configurator = Configurator::Get();
-
- const std::string full_import_path = configurator.path.SelectPath(this, PATH_IMPORT_CONFIGURATION);
- if (full_import_path.empty()) return;
-
- const std::string imported_configuration =
- configurator.configurations.ImportConfiguration(configurator.layers.selected_layers, full_import_path);
- if (imported_configuration.empty()) {
- return;
- }
-
- configurator.ActivateConfiguration(imported_configuration);
-
- LoadConfigurationList();
-
- this->UpdateUI();
-}
-
-void MainWindow::ExportClicked(ConfigurationListItem *item) {
- assert(item);
-
- Configurator &configurator = Configurator::Get();
-
- const std::string full_suggested_path = configurator.path.GetFullPath(PATH_EXPORT_CONFIGURATION, item->configuration_name);
- const std::string full_export_path = configurator.path.SelectPath(this, PATH_EXPORT_CONFIGURATION, full_suggested_path);
- if (full_export_path.empty()) return;
-
- configurator.configurations.ExportConfiguration(configurator.layers.selected_layers, full_export_path,
- item->configuration_name);
-}
-
-void MainWindow::ReloadDefaultClicked(ConfigurationListItem *item) {
- (void)item;
-
- if (Alert::ConfiguratorReloadDefault() == QMessageBox::Yes) {
- _settings_tree_manager.CleanupGUI();
-
- Configurator &configurator = Configurator::Get();
- configurator.configurations.ReloadDefaultsConfigurations(configurator.layers.selected_layers);
-
- configurator.ActivateConfiguration(configurator.environment.GetSelectedConfiguration());
-
- LoadConfigurationList();
-
- this->UpdateUI();
- }
-}
-
-void MainWindow::editorExpanded(QTreeWidgetItem *item) {
- (void)item;
- ui->settings_tree->resizeColumnToContents(0);
-}
-
-void MainWindow::OnConfigurationItemExpanded(QTreeWidgetItem *item) {
- (void)item;
- ui->settings_tree->resizeColumnToContents(0);
- ui->settings_tree->resizeColumnToContents(1);
-}
-
-void MainWindow::OnSettingsTreeClicked(QTreeWidgetItem *item, int column) {
- (void)column;
- (void)item;
-
- Configurator &configurator = Configurator::Get();
- configurator.configurations.Configure(configurator.layers.selected_layers);
-
- // Don't update UI here. It's not useful and cause setting tree rebuild
-}
-
-void MainWindow::SetupLauncherTree() {
- // App Name
- QTreeWidgetItem *launcher_parent = new QTreeWidgetItem();
- launcher_parent->setText(0, "Application");
- ui->launcher_tree->addTopLevelItem(launcher_parent);
-
- _launcher_apps_combo = new QComboBox();
- _launcher_apps_combo->setFocusPolicy(Qt::StrongFocus);
- _launcher_apps_combo->setMinimumHeight(LAUNCH_ROW_HEIGHT);
- _launcher_apps_combo->setMaximumHeight(LAUNCH_ROW_HEIGHT);
- ui->launcher_tree->setItemWidget(launcher_parent, 1, _launcher_apps_combo);
-
- _launcher_apps_browse_button = new QPushButton();
- _launcher_apps_browse_button->setText("...");
- _launcher_apps_browse_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- _launcher_apps_browse_button->setMaximumWidth(LAUNCH_COLUMN2_SIZE);
- _launcher_apps_browse_button->setMinimumHeight(LAUNCH_ROW_HEIGHT);
- _launcher_apps_browse_button->setMaximumHeight(LAUNCH_ROW_HEIGHT);
- ui->launcher_tree->setItemWidget(launcher_parent, 2, _launcher_apps_browse_button);
- connect(_launcher_apps_combo, SIGNAL(currentIndexChanged(int)), this, SLOT(launchItemChanged(int)));
- connect(_launcher_apps_browse_button, SIGNAL(clicked()), this, SLOT(on_push_button_applications_clicked()));
-
- // Executable
- QTreeWidgetItem *launcher_executable_item = new QTreeWidgetItem();
- launcher_executable_item->setText(0, "Executable");
- launcher_parent->addChild(launcher_executable_item);
-
- _launcher_executable = new QLineEdit();
- _launcher_executable->setMinimumHeight(LAUNCH_ROW_HEIGHT);
- _launcher_executable->setMaximumHeight(LAUNCH_ROW_HEIGHT);
- ui->launcher_tree->setItemWidget(launcher_executable_item, 1, _launcher_executable);
- _launcher_executable->setReadOnly(false);
-
- _launcher_executable_browse_button = new QPushButton();
- _launcher_executable_browse_button->setText("...");
- _launcher_executable_browse_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- _launcher_executable_browse_button->setMaximumWidth(LAUNCH_COLUMN2_SIZE);
- _launcher_executable_browse_button->setMinimumHeight(LAUNCH_ROW_HEIGHT);
- _launcher_executable_browse_button->setMaximumHeight(LAUNCH_ROW_HEIGHT);
- ui->launcher_tree->setItemWidget(launcher_executable_item, 2, _launcher_executable_browse_button);
- connect(_launcher_executable, SIGNAL(textEdited(const QString &)), this, SLOT(launchChangeExecutable(const QString &)));
- connect(_launcher_executable_browse_button, SIGNAL(clicked()), this, SLOT(launchSetExecutable()));
-
- // Working folder
- QTreeWidgetItem *launcher_folder_item = new QTreeWidgetItem();
- launcher_folder_item->setText(0, "Working Directory");
- launcher_parent->addChild(launcher_folder_item);
-
- _launcher_working = new QLineEdit();
- _launcher_working->setMinimumHeight(LAUNCH_ROW_HEIGHT);
- _launcher_working->setMaximumHeight(LAUNCH_ROW_HEIGHT);
- ui->launcher_tree->setItemWidget(launcher_folder_item, 1, _launcher_working);
- _launcher_working->setReadOnly(false);
-
- _launcher_working_browse_button = new QPushButton();
- _launcher_working_browse_button->setText("...");
- _launcher_working_browse_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- _launcher_working_browse_button->setMaximumWidth(LAUNCH_COLUMN2_SIZE);
- _launcher_working_browse_button->setMinimumHeight(LAUNCH_ROW_HEIGHT);
- _launcher_working_browse_button->setMaximumHeight(LAUNCH_ROW_HEIGHT);
- ui->launcher_tree->setItemWidget(launcher_folder_item, 2, _launcher_working_browse_button);
- connect(_launcher_working, SIGNAL(textEdited(const QString &)), this, SLOT(launchChangeWorkingFolder(const QString &)));
- connect(_launcher_working_browse_button, SIGNAL(clicked()), this, SLOT(launchSetWorkingFolder()));
-
- // Command line arguments
- QTreeWidgetItem *launcher_arguments_item = new QTreeWidgetItem();
- launcher_arguments_item->setText(0, "Command-line Arguments");
- launcher_parent->addChild(launcher_arguments_item);
-
- _launcher_arguments = new QLineEdit();
- _launcher_arguments->setMinimumHeight(LAUNCH_ROW_HEIGHT);
- _launcher_arguments->setMaximumHeight(LAUNCH_ROW_HEIGHT);
- ui->launcher_tree->setItemWidget(launcher_arguments_item, 1, _launcher_arguments);
- connect(_launcher_arguments, SIGNAL(textEdited(const QString &)), this, SLOT(launchArgsEdited(const QString &)));
-
- // Log file
- QTreeWidgetItem *launcher_log_file_item = new QTreeWidgetItem();
- launcher_log_file_item->setText(0, "Output Log");
- launcher_parent->addChild(launcher_log_file_item);
-
- _launcher_log_file_edit = new QLineEdit();
- _launcher_log_file_edit->setMinimumHeight(LAUNCH_ROW_HEIGHT);
- _launcher_log_file_edit->setMaximumHeight(LAUNCH_ROW_HEIGHT);
- ui->launcher_tree->setItemWidget(launcher_log_file_item, 1, _launcher_log_file_edit);
- connect(_launcher_log_file_edit, SIGNAL(textEdited(const QString &)), this, SLOT(launchChangeLogFile(const QString &)));
-
- _launcher_log_file_browse_button = new QPushButton();
- _launcher_log_file_browse_button->setText("...");
- _launcher_log_file_browse_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- _launcher_log_file_browse_button->setMaximumWidth(LAUNCH_COLUMN2_SIZE);
- ui->launcher_tree->setItemWidget(launcher_log_file_item, 2, _launcher_log_file_browse_button);
- connect(_launcher_log_file_browse_button, SIGNAL(clicked()), this, SLOT(launchSetLogFile()));
-
- // Launcher tree
- ui->launcher_tree->setMinimumHeight(LAUNCH_ROW_HEIGHT * 5 + 6);
- ui->launcher_tree->setMaximumHeight(LAUNCH_ROW_HEIGHT * 5 + 6);
-
- ui->launcher_tree->setColumnWidth(0, LAUNCH_COLUMN0_SIZE);
- ui->launcher_tree->setColumnWidth(
- 1, ui->launcher_tree->rect().width() - LAUNCH_COLUMN0_SIZE - LAUNCH_COLUMN2_SIZE - LAUNCH_SPACING_SIZE);
- ui->launcher_tree->setColumnWidth(2, LAUNCH_COLUMN2_SIZE);
-
- if (Configurator::Get().environment.Get(LAYOUT_LAUNCHER_COLLAPSED) == "true")
- launchItemCollapsed(nullptr);
- else
- ui->launcher_tree->expandItem(launcher_parent);
-
- ui->launcher_tree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- ui->launcher_tree->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-}
-
-// Expanding the tree also grows the tree to match
-void MainWindow::launchItemExpanded(QTreeWidgetItem *item) {
- (void)item;
- ui->launcher_tree->setMinimumHeight(LAUNCH_ROW_HEIGHT * 5 + 6);
- ui->launcher_tree->setMaximumHeight(LAUNCH_ROW_HEIGHT * 5 + 6);
- Configurator::Get().environment.Set(LAYOUT_LAUNCHER_COLLAPSED, QByteArray("false"));
-}
-
-// Collapsing the tree also shrinks the tree to match and show only the first line
-void MainWindow::launchItemCollapsed(QTreeWidgetItem *item) {
- (void)item;
- ui->launcher_tree->setMinimumHeight(LAUNCH_ROW_HEIGHT + 6);
- ui->launcher_tree->setMaximumHeight(LAUNCH_ROW_HEIGHT + 6);
- Configurator::Get().environment.Set(LAYOUT_LAUNCHER_COLLAPSED, QByteArray("true"));
-}
-
-void MainWindow::OnLauncherLoaderMessageChanged(int level) {
- Configurator &configurator = Configurator::Get();
-
- configurator.environment.SetLoaderMessageTypes(GetLoaderMessageFlags(static_cast(level)));
-
- if (ui->check_box_clear_on_launch->isChecked()) {
- this->UpdateUI();
- }
-}
-
-void MainWindow::launchSetExecutable() {
- int current_application_index = _launcher_apps_combo->currentIndex();
- assert(current_application_index >= 0);
-
- Configurator &configurator = Configurator::Get();
- Application &application = configurator.environment.GetApplication(current_application_index);
- std::string new_path = _launcher_executable->text().toStdString();
- if (!QFileInfo(ReplaceBuiltInVariable(new_path).c_str()).exists()) {
- new_path = application.executable_path.c_str();
- }
-
- const std::string selected_path = configurator.path.SelectPath(this, PATH_EXECUTABLE, ReplaceBuiltInVariable(new_path));
-
- // The user has cancel the operation
- if (selected_path.empty()) {
- return;
- }
-
- // The path didn't change, preserve the built-in variables
- if (ReplaceBuiltInVariable(new_path) == selected_path) {
- return;
- }
-
- application.executable_path = selected_path;
- _launcher_executable->setText(selected_path.c_str());
-}
-
-void MainWindow::launchSetLogFile() {
- int current_application_index = _launcher_apps_combo->currentIndex();
- assert(current_application_index >= 0);
-
- Configurator &configurator = Configurator::Get();
- Application &application = configurator.environment.GetApplication(current_application_index);
- std::string new_path = _launcher_log_file_edit->text().toStdString();
- if (!QFileInfo(ReplaceBuiltInVariable(new_path).c_str()).exists()) {
- new_path = application.log_file.c_str();
- }
-
- const std::string selected_path = configurator.path.SelectPath(this, PATH_LAUNCHER_LOG_FILE, ReplaceBuiltInVariable(new_path));
-
- // The user has cancel the operation
- if (selected_path.empty()) {
- return;
- }
-
- // The path didn't change, preserve the built-in variables
- if (ReplaceBuiltInVariable(new_path) == selected_path) {
- return;
- }
-
- application.log_file = selected_path;
- _launcher_log_file_edit->setText(selected_path.c_str());
-}
-
-void MainWindow::launchSetWorkingFolder() {
- int current_application_index = _launcher_apps_combo->currentIndex();
- assert(current_application_index >= 0);
-
- Configurator &configurator = Configurator::Get();
- Application &application = configurator.environment.GetApplication(current_application_index);
- std::string new_path = _launcher_working->text().toStdString();
- if (!QFileInfo(ReplaceBuiltInVariable(new_path).c_str()).exists()) {
- new_path = application.working_folder.c_str();
- }
-
- const std::string selected_path = configurator.path.SelectPath(this, PATH_WORKING_DIR, ReplaceBuiltInVariable(new_path));
-
- // The user has cancel the operation
- if (selected_path.empty()) {
- return;
- }
-
- // The path didn't change, preserve the built-in variables
- if (ReplaceBuiltInVariable(new_path) == selected_path) {
- return;
- }
-
- application.working_folder = selected_path;
- _launcher_working->setText(selected_path.c_str());
-}
-
-// Log file path edited manually.
-void MainWindow::launchChangeLogFile(const QString &log_file) {
- int current_application_index = _launcher_apps_combo->currentIndex();
- assert(current_application_index >= 0);
-
- const std::string replaced_path = ReplaceBuiltInVariable(log_file.toStdString());
-
- if (QFileInfo(replaced_path.c_str()).exists()) {
- Application &application = Configurator::Get().environment.GetApplication(current_application_index);
- application.log_file = log_file.toStdString();
- }
-}
-
-void MainWindow::launchChangeExecutable(const QString &exe_path) {
- int current_application_index = _launcher_apps_combo->currentIndex();
- assert(current_application_index >= 0);
-
- const std::string replaced_path = ReplaceBuiltInVariable(exe_path.toStdString());
-
- if (QFileInfo(replaced_path.c_str()).exists()) {
- Application &application = Configurator::Get().environment.GetApplication(current_application_index);
- application.executable_path = exe_path.toStdString();
- }
-}
-
-void MainWindow::launchChangeWorkingFolder(const QString &working_folder) {
- int current_application_index = _launcher_apps_combo->currentIndex();
- assert(current_application_index >= 0);
-
- const std::string replaced_path = ReplaceBuiltInVariable(working_folder.toStdString());
-
- if (QFileInfo(replaced_path.c_str()).exists()) {
- Application &application = Configurator::Get().environment.GetApplication(current_application_index);
- application.working_folder = working_folder.toStdString();
- }
-}
-
-void MainWindow::UpdateApplicationUI(const Application &application) {
- _launcher_executable->setText(application.executable_path.c_str());
- _launcher_executable->setToolTip(ReplaceBuiltInVariable(application.executable_path.c_str()).c_str());
- _launcher_arguments->setText(application.arguments.c_str());
- _launcher_working->setText(application.working_folder.c_str());
- _launcher_working->setToolTip(ReplaceBuiltInVariable(application.working_folder.c_str()).c_str());
- _launcher_log_file_edit->setText(application.log_file.c_str());
- _launcher_log_file_edit->setToolTip(ReplaceBuiltInVariable(application.log_file.c_str()).c_str());
-}
-
-// Launch app change
-void MainWindow::launchItemChanged(int application_index) {
- if (application_index < 0) return;
-
- Environment &environment = Configurator::Get().environment;
-
- environment.SelectActiveApplication(application_index);
-
- const Application &application = environment.GetApplication(application_index);
- this->UpdateApplicationUI(application);
-}
-
-/// New command line arguments. Update them.
-void MainWindow::launchArgsEdited(const QString &arguments) {
- int application_index = _launcher_apps_combo->currentIndex();
- if (application_index < 0) return;
-
- Application &application = Configurator::Get().environment.GetApplication(application_index);
- application.arguments = arguments.toStdString();
-}
-
-// Clear the browser window
-void MainWindow::ClearLog() {
- if (ui->check_box_clear_on_launch->isChecked()) {
- on_push_button_clear_log_clicked();
- }
-}
-
-void MainWindow::on_push_button_clear_log_clicked() {
- ui->log_browser->clear();
- ui->log_browser->update();
- ui->push_button_clear_log->setEnabled(false);
-}
-
-void MainWindow::on_push_button_status_clicked() { this->UpdateStatus(); }
-
-void MainWindow::UpdateStatus() {
- ui->push_button_clear_log->setEnabled(true);
-
- QString text = ("Vulkan Development Status:\n" + GenerateVulkanStatus() + "\n").c_str();
-
- if (!ui->check_box_clear_on_launch->isChecked()) {
- text += ui->log_browser->toPlainText();
- }
-
- ui->log_browser->setPlainText(text);
-}
-
-const Layer *GetLayer(QTreeWidget *tree, QTreeWidgetItem *item) {
- if (item == tree->invisibleRootItem()) return nullptr;
- if (item == nullptr) return nullptr;
-
- const std::string &text = item->text(0).toStdString().c_str();
- if (!text.empty()) {
- Configurator &configurator = Configurator::Get();
-
- for (std::size_t i = 0, n = configurator.layers.selected_layers.size(); i < n; ++i) {
- const Layer &layer = configurator.layers.selected_layers[i];
- if (text.find(layer.key) != std::string::npos) return &layer;
- }
- }
-
- return GetLayer(tree, item->parent());
-}
-
-bool MainWindow::eventFilter(QObject *target, QEvent *event) {
- if (event->type() == QEvent::Wheel) {
- return true;
- }
-
- // Launch tree does some fancy resizing and since it's down in
- // layouts and splitters, we can't just rely on the resize method
- // of this window. Any resize coming through needs to trigger this
- // or we get drawing artifacts on macOS.
- if (event->type() == QEvent::Resize) {
- const QRect rect = ui->launcher_tree->rect();
- ui->launcher_tree->setColumnWidth(0, LAUNCH_COLUMN0_SIZE);
- ui->launcher_tree->setColumnWidth(1, rect.width() - LAUNCH_COLUMN0_SIZE - LAUNCH_COLUMN2_SIZE - LAUNCH_SPACING_SIZE);
- ui->launcher_tree->setColumnWidth(2, LAUNCH_COLUMN2_SIZE);
- return false;
- }
-
- Configurator &configurator = Configurator::Get();
-
- // Context menus for layer configuration files
- if (target == ui->settings_tree) {
- QContextMenuEvent *right_click = dynamic_cast(event);
- if (right_click) {
- bool require_update_ui = false;
-
- QTreeWidgetItem *setting_item = ui->settings_tree->itemAt(right_click->pos());
-
- // std::string layer_name = setting_item->toolTip(0).toStdString();
- std::string setting_text = setting_item->text(0).toStdString();
- if (setting_text == "Vulkan Applications") {
- return false;
- }
- if (setting_text == "Vulkan Drivers") {
- return false;
- }
- if (setting_text == "Excluded Layers:") {
- return false;
- }
-
- const Layer *layer = GetLayer(ui->settings_tree, setting_item);
- std::string layer_name = setting_text;
-
- if (layer != nullptr) {
- layer_name = layer->key;
- }
-
- // Create context menu here
- QMenu menu(ui->settings_tree);
- QFont subtitle_font = menu.font();
- subtitle_font.setBold(true);
-
- QAction *title_action = new QAction(layer_name.c_str(), nullptr);
- title_action->setEnabled(layer != nullptr);
- title_action->setFont(subtitle_font);
- menu.addAction(title_action);
-
- QAction *visit_layer_website_action = new QAction("Visit Layer Website...", nullptr);
- visit_layer_website_action->setEnabled(layer != nullptr ? !layer->url.empty() : false);
- menu.addAction(visit_layer_website_action);
-
- QAction *export_html_action = new QAction("Open Layer HTML Documentation...", nullptr);
- export_html_action->setEnabled(layer != nullptr);
- menu.addAction(export_html_action);
-
- QAction *export_markdown_action = new QAction("Open Layer Markdown Documentation...", nullptr);
- export_markdown_action->setEnabled(layer != nullptr);
- menu.addAction(export_markdown_action);
-
- static const char *table[] = {
- "N/A", // LAYER_STATE_APPLICATION_CONTROLLED
- "Exclude Layer", // LAYER_STATE_OVERRIDDEN
- "Override Layer" // LAYER_STATE_EXCLUDED
- };
- static_assert(countof(table) == LAYER_STATE_COUNT,
- "The tranlation table size doesn't match the enum number of elements");
-
- Configuration *configuration = configurator.configurations.FindActiveConfiguration();
-
- Parameter *parameter = nullptr;
- for (std::size_t i = 0, n = configuration->parameters.size(); i < n; ++i) {
- if (layer_name.find(configuration->parameters[i].key) != std::string::npos) {
- parameter = &configuration->parameters[i];
- break;
- }
- }
-
- QAction *export_settings_action = new QAction("Open Layer vk_layers_settings.txt...", nullptr);
- export_settings_action->setEnabled(layer != nullptr ? parameter->state == LAYER_STATE_OVERRIDDEN : false);
- menu.addAction(export_settings_action);
-
- QAction *layer_state_action = new QAction(layer != nullptr ? table[parameter->state] : "Remove Layer", nullptr);
- if (layer == nullptr) {
- layer_state_action->setFont(subtitle_font);
- }
- menu.addAction(layer_state_action);
-
- menu.addSeparator();
-
- QAction *show_advanced_setting_action = new QAction("View Advanced Settings", nullptr);
- show_advanced_setting_action->setEnabled(layer != nullptr);
- show_advanced_setting_action->setCheckable(true);
- show_advanced_setting_action->setChecked(configuration->view_advanced_settings);
- menu.addAction(show_advanced_setting_action);
-
- QPoint point(right_click->globalX(), right_click->globalY());
- QAction *action = menu.exec(point);
-
- if (action == title_action) {
- Alert::LayerProperties(layer);
- } else if (action == visit_layer_website_action) {
- QDesktopServices::openUrl(QUrl(layer->url.c_str()));
- } else if (action == layer_state_action) {
- switch (parameter->state) {
- case LAYER_STATE_OVERRIDDEN:
- parameter->state = LAYER_STATE_EXCLUDED;
- break;
- case LAYER_STATE_EXCLUDED:
- parameter->state = LAYER_STATE_OVERRIDDEN;
- break;
- default:
- assert(0);
- break;
- }
- configuration->setting_tree_state.clear();
-
- configurator.ActivateConfiguration(configuration->key);
-
- require_update_ui = true;
- } else if (action == show_advanced_setting_action) {
- configuration->view_advanced_settings = action->isChecked();
- configuration->setting_tree_state.clear();
- } else if (action == export_html_action) {
- const std::string path = format("%s/%s.html", GetPath(BUILTIN_PATH_APPDATA).c_str(), layer->key.c_str());
- ExportHtmlDoc(*layer, path);
- QDesktopServices::openUrl(QUrl(("file:///" + path).c_str()));
- } else if (action == export_markdown_action) {
- const std::string path = format("%s/%s.md", GetPath(BUILTIN_PATH_APPDATA).c_str(), layer->key.c_str());
- ExportMarkdownDoc(*layer, path);
- QDesktopServices::openUrl(QUrl(("file:///" + path).c_str()));
- } else if (action == export_settings_action) {
- std::vector layers = {*layer};
- const std::string path = GetPath(BUILTIN_PATH_OVERRIDE_SETTINGS);
- ExportSettingsDoc(layers, *configuration, path);
- QDesktopServices::openUrl(QUrl(("file:///" + path).c_str()));
- } else {
- return false; // Unknown action
- }
-
- if (require_update_ui) {
- this->UpdateUI();
- }
-
- // Do not pass on
- return true;
- }
- } else if (target == ui->configuration_tree) {
- QContextMenuEvent *right_click = dynamic_cast(event);
- if (right_click) { // && event->type() == QEvent::ContextMenu) {
- // Which item were we over?
- QTreeWidgetItem *configuration_item = ui->configuration_tree->itemAt(right_click->pos());
- ConfigurationListItem *item = dynamic_cast(configuration_item);
-
- const Environment &environment = configurator.environment;
- const std::string &active_contiguration_name = environment.GetSelectedConfiguration();
-
- const bool active = environment.GetMode() != LAYERS_MODE_BY_APPLICATIONS && !active_contiguration_name.empty();
-
- // Create context menu here
- QMenu menu(ui->configuration_tree);
-
- QAction *rename_action = new QAction("Rename", nullptr);
- rename_action->setEnabled(active && item != nullptr);
- menu.addAction(rename_action);
-
- menu.addSeparator();
-
- QAction *import_action = new QAction("Import...", nullptr);
- import_action->setEnabled(true);
- menu.addAction(import_action);
-
- QAction *export_action = new QAction("Export...", nullptr);
- export_action->setEnabled(active && item != nullptr);
- menu.addAction(export_action);
-
- menu.addSeparator();
-
- QAction *reset_action = new QAction("Reset", nullptr);
- reset_action->setEnabled(active && item != nullptr);
- menu.addAction(reset_action);
-
- menu.addSeparator();
-
- QAction *reload_default_action = new QAction("Reload Default Configurations", nullptr);
- reload_default_action->setEnabled(true);
- menu.addAction(reload_default_action);
-
- QPoint point(right_click->globalX(), right_click->globalY());
- QAction *action = menu.exec(point);
-
- if (action == rename_action) {
- RenameClicked(item);
- } else if (action == reset_action) {
- ResetClicked(item);
- } else if (action == export_action) {
- ExportClicked(item);
- } else if (action == import_action) {
- ImportClicked(item);
- } else if (action == reload_default_action) {
- ReloadDefaultClicked(item);
- } else {
- return false; // Unknown action
- }
-
- // Do not pass on
- return true;
- }
- }
-
- // Pass it on
- return false;
-}
-
-bool MainWindow::SelectConfigurationItem(const std::string &configuration_name) {
- assert(!configuration_name.empty());
-
- for (int i = 0, n = ui->configuration_tree->topLevelItemCount(); i < n; ++i) {
- ConfigurationListItem *item = dynamic_cast(ui->configuration_tree->topLevelItem(i));
- assert(item != nullptr);
- assert(!item->configuration_name.empty());
- if (item->configuration_name == configuration_name) {
- ui->configuration_tree->setCurrentItem(item);
- return true;
- }
- }
-
- assert(0);
- return false;
-}
-
-void MainWindow::ResetLaunchApplication() {
- if (_launch_application) {
- _launch_application->kill();
- _launch_application->waitForFinished();
- _launch_application.reset();
-
- ui->push_button_launcher->setText("Launch");
-
- _settings_tree_manager.launched_application = false;
- }
-}
-
-QStringList MainWindow::BuildEnvVariables() const {
- Configurator &configurator = Configurator::Get();
-
- QStringList env = QProcess::systemEnvironment();
- env << (QString("VK_LOADER_DEBUG=") + ::GetLoaderMessageTokens(configurator.environment.GetLoaderMessageTypes()).c_str());
- return env;
-}
-
-void MainWindow::on_push_button_launcher_clicked() {
- // Are we already monitoring a running app? If so, terminate it
- if (_launch_application != nullptr) {
- ResetLaunchApplication();
- return;
- }
-
- std::string launch_log;
-
- // Update the Vulkan Developemnt status to record the system configuration
- QString vulkan_status = ("Vulkan Development Status:\n" + GenerateVulkanStatus() + "\n").c_str();
- launch_log += vulkan_status.toStdString();
-
- // We are logging, let's add that we've launched a new application
- launch_log += "Launching Vulkan Application:\n";
-
- Configurator &configurator = Configurator::Get();
- const Application &active_application = configurator.environment.GetActiveApplication();
-
- assert(!active_application.app_name.empty());
- launch_log += format("- Application: %s\n", active_application.app_name.c_str());
- assert(!active_application.executable_path.empty());
-
- launch_log += format("- Executable: %s\n", ReplaceBuiltInVariable(_launcher_executable->text().toStdString()).c_str());
- if (!QFileInfo(ReplaceBuiltInVariable(_launcher_executable->text().toStdString()).c_str()).exists()) {
- Alert::PathInvalid(ReplaceBuiltInVariable(_launcher_executable->text().toStdString()).c_str(),
- format("The '%s' application will fail to launch.", active_application.app_name.c_str()).c_str());
- }
-
- launch_log += format("- Working Directory: %s\n", ReplaceBuiltInVariable(_launcher_working->text().toStdString()).c_str());
- if (!QFileInfo(ReplaceBuiltInVariable(_launcher_working->text().toStdString()).c_str()).exists()) {
- Alert::PathInvalid(ReplaceBuiltInVariable(_launcher_working->text().toStdString()).c_str(),
- format("The '%s' application will fail to launch.", active_application.app_name.c_str()).c_str());
- }
-
- if (!_launcher_arguments->text().isEmpty()) {
- launch_log += format("- Command-line Arguments: %s\n", _launcher_arguments->text().toStdString().c_str());
- }
-
- const std::string actual_log_file = ReplaceBuiltInVariable(_launcher_log_file_edit->text().toStdString());
- if (!actual_log_file.empty()) {
- launch_log += format("- Log file: %s\n", actual_log_file.c_str());
- }
-
- if (!actual_log_file.empty()) {
- // Start logging
- // Make sure the log file is not already opened. This can occur if the
- // launched application is closed from the applicaiton.
- if (!_log_file.isOpen()) {
- _log_file.setFileName(actual_log_file.c_str());
-
- // Open and append, or open and truncate?
- QIODevice::OpenMode mode = QIODevice::WriteOnly | QIODevice::Text;
- if (!ui->check_box_clear_on_launch->isChecked()) mode |= QIODevice::Append;
-
- if (!_log_file.open(mode)) {
- Alert::LogFileFailed();
- }
- }
- }
-
- if (ui->check_box_clear_on_launch->isChecked()) {
- ui->log_browser->clear();
- }
-
- Log(launch_log.c_str());
-
- // Launch the test application
- _launch_application.reset(new QProcess(this));
- connect(_launch_application.get(), SIGNAL(readyReadStandardOutput()), this, SLOT(standardOutputAvailable()));
- connect(_launch_application.get(), SIGNAL(readyReadStandardError()), this, SLOT(errorOutputAvailable()));
- connect(_launch_application.get(), SIGNAL(finished(int, QProcess::ExitStatus)), this,
- SLOT(processClosed(int, QProcess::ExitStatus)));
-
- _launch_application->setProgram(ReplaceBuiltInVariable(_launcher_executable->text().toStdString()).c_str());
- _launch_application->setWorkingDirectory(ReplaceBuiltInVariable(_launcher_working->text().toStdString()).c_str());
- _launch_application->setEnvironment(BuildEnvVariables());
-
- if (!_launcher_arguments->text().isEmpty()) {
- const QStringList args = ConvertString(SplitSpace(_launcher_arguments->text().toStdString()));
- _launch_application->setArguments(args);
- }
-
- ui->push_button_launcher->setText("Terminate");
- _launch_application->start(QIODevice::ReadOnly | QIODevice::Unbuffered);
- _launch_application->setProcessChannelMode(QProcess::MergedChannels);
- _launch_application->closeWriteChannel();
-
- // Wait... did we start? Give it 4 seconds, more than enough time
- if (!_launch_application->waitForStarted(4000)) {
- _launch_application->deleteLater();
- _launch_application = nullptr;
-
- ui->push_button_launcher->setText("Launch");
-
- const std::string failed_log =
- std::string("Failed to launch ") + ReplaceBuiltInVariable(_launcher_executable->text().toStdString()).c_str() + "!\n";
- Log(failed_log);
- } else {
- _settings_tree_manager.launched_application = true;
- }
-}
-
-/// The process we are following is closed. We don't actually care about the
-/// exit status/code, we just need to know to destroy the QProcess object
-/// and set it back to nullptr so that we know we can launch a new app.
-/// Also, if we are logging, it's time to close the log file.
-void MainWindow::processClosed(int exit_code, QProcess::ExitStatus status) {
- (void)exit_code;
- (void)status;
-
- assert(_launch_application);
-
- disconnect(_launch_application.get(), SIGNAL(finished(int, QProcess::ExitStatus)), this,
- SLOT(processClosed(int, QProcess::ExitStatus)));
- disconnect(_launch_application.get(), SIGNAL(readyReadStandardError()), this, SLOT(errorOutputAvailable()));
- disconnect(_launch_application.get(), SIGNAL(readyReadStandardOutput()), this, SLOT(standardOutputAvailable()));
-
- Log("Process terminated");
-
- if (_log_file.isOpen()) {
- _log_file.close();
- }
-
- ResetLaunchApplication();
-}
-
-/// This signal get's raised whenever the spawned Vulkan appliction writes
-/// to stdout and there is data to be read. The layers flush after all stdout
-/// writes, so we should see layer output here in realtime, as we just read
-/// the string and append it to the text browser.
-/// If a log file is open, we also write the output to the log.
-void MainWindow::standardOutputAvailable() {
- if (_launch_application) {
- Log(_launch_application->readAllStandardOutput().toStdString());
- }
-}
-
-void MainWindow::errorOutputAvailable() {
- if (_launch_application) {
- Log(_launch_application->readAllStandardError().toStdString());
- }
-}
-
-void MainWindow::Log(const std::string &log) {
- ui->log_browser->setPlainText(ui->log_browser->toPlainText() + "\n" + log.c_str());
- ui->push_button_clear_log->setEnabled(true);
-
- if (_log_file.isOpen()) {
- _log_file.write(log.c_str(), log.size());
- _log_file.flush();
- }
-}
diff --git a/vkconfig/mainwindow.h b/vkconfig/mainwindow.h
deleted file mode 100644
index d2abed0e83..0000000000
--- a/vkconfig/mainwindow.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#pragma once
-
-#include "configurator.h"
-#include "settings_tree.h"
-
-#include "ui_mainwindow.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-/// This just allows me to associate a specific profile definition
-/// with a list widget item.
-class ConfigurationListItem : public QTreeWidgetItem {
- public:
- ConfigurationListItem(const std::string &configuration_name) : configuration_name(configuration_name) {}
- std::string configuration_name;
- QRadioButton *radio_button;
-
- private:
- ConfigurationListItem(const ConfigurationListItem &) = delete;
- ConfigurationListItem &operator=(const ConfigurationListItem &) = delete;
-};
-
-enum Tool { TOOL_VULKAN_INFO, TOOL_VULKAN_INSTALL };
-
-class MainWindow : public QMainWindow {
- Q_OBJECT
-
- public:
- MainWindow(QWidget *parent = nullptr);
- ~MainWindow();
-
- void UpdateUI();
- void UpdateApplicationUI(const Application &application);
-
- private:
- SettingsTreeManager _settings_tree_manager;
-
- std::unique_ptr _launch_application; // Keeps track of the monitored app
- QFile _log_file; // Log file for layer output
-
- void LoadConfigurationList();
- void SetupLauncherTree();
-
- void closeEvent(QCloseEvent *event) override;
- void showEvent(QShowEvent *event) override;
- void resizeEvent(QResizeEvent *event) override;
- bool eventFilter(QObject *target, QEvent *event) override;
-
- std::unique_ptr vk_info_dialog;
- std::unique_ptr vk_installation_dialog;
-
- void Log(const std::string &log);
-
- ConfigurationListItem *GetCheckedItem();
-
- QComboBox *_launcher_apps_combo;
- QLineEdit *_launcher_executable;
- QLineEdit *_launcher_arguments;
- QLineEdit *_launcher_working;
- QLineEdit *_launcher_log_file_edit;
- QPushButton *_launcher_apps_browse_button;
- QPushButton *_launcher_executable_browse_button;
- QPushButton *_launcher_working_browse_button;
- QPushButton *_launcher_log_file_browse_button;
- QSystemTrayIcon *_tray_icon;
- QMenu *_tray_icon_menu;
- QAction *_tray_restore_action;
- QAction *_tray_layers_controlled_by_applications;
- QAction *_tray_layers_controlled_by_configurator;
- QAction *_tray_layers_disabled_by_configurator;
- QAction *_tray_quit_action;
-
- void RemoveClicked(ConfigurationListItem *item);
- void ResetClicked(ConfigurationListItem *item);
- void RenameClicked(ConfigurationListItem *item);
- void EditClicked(ConfigurationListItem *item);
- void DuplicateClicked(ConfigurationListItem *item);
- void ExportClicked(ConfigurationListItem *item);
- void ImportClicked(ConfigurationListItem *item);
- void ReloadDefaultClicked(ConfigurationListItem *item);
-
- private slots:
- void trayActionRestore();
- void trayActionControlledByApplications(bool checked);
- void trayActionControlledByConfigurator(bool checked);
- void trayActionDisabledByApplications(bool checked);
- void iconActivated(QSystemTrayIcon::ActivationReason reason);
-
- public Q_SLOTS:
- void toolsVulkanInfo(bool checked);
- void toolsVulkanInstallation(bool checked);
- void toolsResetToDefault(bool checked);
-
- void OnHelpFindLayers(bool checked);
- void OnHelpAbout(bool checked);
- void OnHelpReadme(bool checked);
- void OnHelpChangelog(bool checked);
- void OnHelpVulkanSpec(bool checked);
- void OnHelpLayerSpec(bool checked);
- void OnHelpGPUInfo(bool checked);
-
- void editorExpanded(QTreeWidgetItem *item);
-
- void launchItemExpanded(QTreeWidgetItem *item);
- void launchItemCollapsed(QTreeWidgetItem *item);
- void launchItemChanged(int index);
- void launchSetLogFile();
- void launchSetExecutable();
- void launchSetWorkingFolder();
- void launchChangeLogFile(const QString &new_text);
- void launchChangeExecutable(const QString &new_text);
- void launchChangeWorkingFolder(const QString &new_text);
- void launchArgsEdited(const QString &new_text);
-
- void on_push_button_launcher_clicked();
- void on_push_button_clear_log_clicked();
- void on_push_button_status_clicked();
- void on_check_box_apply_list_clicked();
- void on_check_box_persistent_clicked();
- void on_check_box_clear_on_launch_clicked();
- void on_push_button_applications_clicked();
- void on_push_button_edit_clicked();
- void on_push_button_new_clicked();
- void on_push_button_remove_clicked();
- void on_push_button_duplicate_clicked();
-
- void OnComboBoxModeChanged(int index);
- void OnConfigurationItemExpanded(QTreeWidgetItem *item);
- void OnConfigurationItemClicked(bool checked);
- void OnConfigurationTreeChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
- void OnConfigurationItemChanged(QTreeWidgetItem *item, int column);
- void OnConfigurationItemDoubleClicked(QTreeWidgetItem *item, int column);
- void OnConfigurationTreeClicked(QTreeWidgetItem *item, int column);
- void OnSettingsTreeClicked(QTreeWidgetItem *item, int column);
- void OnLauncherLoaderMessageChanged(int level);
-
- void standardOutputAvailable(); // stdout output is available
- void errorOutputAvailable(); // Layeroutput is available
- void processClosed(int exitCode, QProcess::ExitStatus status); // app died
-
- private:
- MainWindow(const MainWindow &) = delete;
- MainWindow &operator=(const MainWindow &) = delete;
-
- void InitTray();
- void UpdateTray();
-
- void RemoveConfiguration(const std::string &configuration_name);
- bool SelectConfigurationItem(const std::string &configuration_name);
- void ResetLaunchApplication();
- void StartTool(Tool tool);
- QStringList BuildEnvVariables() const;
- void UpdateStatus();
-
- void ClearLog();
-
- std::unique_ptr ui;
- bool been_warned_about_old_loader;
-};
-
-int run_gui(int argc, char *argv[]);
diff --git a/vkconfig/mainwindow.ui b/vkconfig/mainwindow.ui
deleted file mode 100644
index 330a4f750e..0000000000
--- a/vkconfig/mainwindow.ui
+++ /dev/null
@@ -1,820 +0,0 @@
-
-
- MainWindow
-
-
-
- 0
- 0
- 1200
- 720
-
-
-
-
- 1
- 1
-
-
-
-
- 1200
- 720
-
-
-
-
- 16777215
- 16777215
-
-
-
-
- Arial
- 10
-
-
-
- Vulkan Configurator
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- true
-
-
- 5
-
-
- false
-
-
-
- Qt::Vertical
-
-
-
-
- 16
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
-
- 4
- 1
-
-
-
-
- 0
- 135
-
-
-
-
- 16777215
- 135
-
-
-
- Vulkan Layers Management
-
-
- false
-
-
-
-
-
-
-
-
- Layers Controlled by the Vulkan Applications
-
-
- -
-
- Layers Controlled by the Vulkan Configurator
-
-
- -
-
- Layers Disabled by the Vulkan Configurator
-
-
-
-
- -
-
-
-
-
-
-
- 0
- 24
-
-
-
-
- Arial
- 10
-
-
-
- Keep Vulkan Configurator running in system tray
-
-
-
- -
-
-
-
- 0
- 24
-
-
-
-
- Arial
- 10
-
-
-
- Apply only to the Vulkan Applications List
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 150
- 26
-
-
-
-
- 136
- 16777215
-
-
-
-
- Arial
- 10
-
-
-
- Edit Applications...
-
-
-
-
-
-
-
-
- -
-
-
-
- 1
- 0
-
-
-
- Vulkan Layers Configurations
-
-
-
- 6
-
-
-
-
-
-
-
-
-
- Arial
- 10
-
-
-
- QAbstractItemView::NoEditTriggers
-
-
- false
-
-
- 5
-
-
- 2
-
-
- false
-
-
- 20
-
-
-
- 1
-
-
-
-
- 2
-
-
-
-
- -
-
-
- 5
-
-
- 5
-
-
- 5
-
-
- 5
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
- New...
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
-
- Arial
- 10
-
-
-
- Edit...
-
-
-
- -
-
-
- Duplicate
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
- Remove
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Expanding
-
-
-
- 20
- 40
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0
- 1
-
-
-
- Vulkan Application Launcher
-
-
- -
-
-
-
- 0
- 1
-
-
-
-
- 0
- 98
-
-
-
-
- 16777215
- 98
-
-
-
-
- Arial
- 10
-
-
-
- false
-
-
- QAbstractItemView::NoEditTriggers
-
-
- 3
-
-
- false
-
-
- true
-
-
- false
-
-
-
-
-
-
-
-
- 2
-
-
-
-
- 3
-
-
-
-
- -
-
-
-
- Consolas
- 9
-
-
-
- false
-
-
-
- -
-
-
-
- Arial
- 10
-
-
-
-
-
-
-
-
-
- true
-
-
-
- -
-
-
-
- Arial
- 10
-
-
-
- Clear
-
-
-
- -
-
-
- Status
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- Arial
- 10
-
-
-
- Launch
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- <html><head/><body><p>Vulkan loader debug messages level used by the VK_LOADER_DEBUG environment variable on launch. <br/><br/>Levels are:<br/>- error<br/>- warn (warnings)<br/>- info (information)<br/>- debug<br/>- layer (layer information)<br/>- implem (implementation/icd information)<br/>- all (report out all messages)</p></body></html>
-
-
-
-
- none
-
-
- -
-
- error
-
-
- -
-
- warn
-
-
- -
-
- info
-
-
- -
-
- debug
-
-
- -
-
- layer
-
-
- -
-
- implem
-
-
- -
-
- all
-
-
-
-
- -
-
-
- Vulkan Loader:
-
-
-
-
-
-
-
-
- Qt::Vertical
-
-
-
-
- 0
- 1
-
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
-
- 400
- 0
-
-
-
- Configuration Settings
-
-
- false
-
-
- false
-
-
-
- 9
-
- -
-
-
-
- 300
- 0
-
-
-
-
- Arial
- 10
-
-
-
- Qt::ScrollBarAlwaysOff
-
-
- QAbstractScrollArea::AdjustToContentsOnFirstShow
-
-
- QAbstractItemView::NoEditTriggers
-
-
- true
-
-
- false
-
-
- false
-
-
- 1
-
-
- false
-
-
- 160
-
-
- 200
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- History...
-
-
-
-
- Save Profile...
-
-
-
-
- Exit and Keep
-
-
-
-
- Exit
-
-
-
-
- Vulkan Info
-
-
-
-
- Vulkan Installation Analysis
-
-
-
-
- About Vulkan Configurator
-
-
-
-
- Vulkan Configurator Readme
-
-
-
-
- Test Environment...
-
-
-
-
- User-Defined Layers Paths...
-
-
-
-
- API Dump...
-
-
-
-
- Create Custom Profile..
-
-
-
-
- Reset To Default
-
-
-
-
- Vulkan Specification
-
-
-
-
- Vulkan Layer Specification
-
-
-
-
- Vulkan GPU Info Reports
-
-
-
-
- Vulkan Configurator Changelog
-
-
-
-
- Find More Layers!
-
-
-
-
-
-
diff --git a/vkconfig/resources.qrc b/vkconfig/resources.qrc
deleted file mode 100644
index 08a828c071..0000000000
--- a/vkconfig/resources.qrc
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
- resourcefiles/lunarg_logo.png
- resourcefiles/qt_logo.png
- resourcefiles/vulkan.ico
- resourcefiles/vkconfig-off.png
- resourcefiles/vkconfig-on.png
-
-
-
- ../vkconfig_core/configurations/2.2.2/API dump.json
- ../vkconfig_core/configurations/2.2.2/Frame Capture.json
- ../vkconfig_core/configurations/2.2.2/Portability.json
- ../vkconfig_core/configurations/2.2.2/Synchronization.json
- ../vkconfig_core/configurations/2.2.2/Validation.json
- ../vkconfig_core/configurations/2.2.2/Crash Diagnostic.json
-
-
-
- ../vkconfig_core/layers/layers_schema.json
- ../vkconfig_core/layers/validusage.json
-
-
-
- ../vkconfig_core/test/VK_LAYER_LUNARG_reference_1_2_1.json
-
-
-
- ../vkconfig_core/layers/130/VK_LAYER_KHRONOS_validation.json
- ../vkconfig_core/layers/130/VK_LAYER_LUNARG_api_dump.json
- ../vkconfig_core/layers/130/VK_LAYER_LUNARG_monitor.json
- ../vkconfig_core/layers/130/VK_LAYER_LUNARG_screenshot.json
-
-
-
- ../vkconfig_core/layers/135/VK_LAYER_KHRONOS_validation.json
- ../vkconfig_core/layers/135/VK_LAYER_LUNARG_api_dump.json
- ../vkconfig_core/layers/135/VK_LAYER_LUNARG_monitor.json
- ../vkconfig_core/layers/135/VK_LAYER_LUNARG_screenshot.json
-
-
-
- ../vkconfig_core/layers/141/VK_LAYER_KHRONOS_validation.json
- ../vkconfig_core/layers/141/VK_LAYER_LUNARG_api_dump.json
- ../vkconfig_core/layers/141/VK_LAYER_LUNARG_gfxreconstruct.json
- ../vkconfig_core/layers/141/VK_LAYER_LUNARG_monitor.json
- ../vkconfig_core/layers/141/VK_LAYER_LUNARG_screenshot.json
-
-
-
- ../vkconfig_core/layers/148/VK_LAYER_KHRONOS_validation.json
- ../vkconfig_core/layers/148/VK_LAYER_LUNARG_api_dump.json
- ../vkconfig_core/layers/148/VK_LAYER_LUNARG_gfxreconstruct.json
- ../vkconfig_core/layers/148/VK_LAYER_LUNARG_monitor.json
- ../vkconfig_core/layers/148/VK_LAYER_LUNARG_screenshot.json
-
-
-
- ../vkconfig_core/layers/154/VK_LAYER_KHRONOS_validation.json
- ../vkconfig_core/layers/154/VK_LAYER_LUNARG_api_dump.json
- ../vkconfig_core/layers/154/VK_LAYER_LUNARG_gfxreconstruct.json
- ../vkconfig_core/layers/154/VK_LAYER_LUNARG_monitor.json
- ../vkconfig_core/layers/154/VK_LAYER_LUNARG_screenshot.json
-
-
-
- ../vkconfig_core/layers/162/VK_LAYER_KHRONOS_validation.json
- ../vkconfig_core/layers/162/VK_LAYER_LUNARG_api_dump.json
- ../vkconfig_core/layers/162/VK_LAYER_LUNARG_gfxreconstruct.json
- ../vkconfig_core/layers/162/VK_LAYER_LUNARG_monitor.json
- ../vkconfig_core/layers/162/VK_LAYER_LUNARG_screenshot.json
-
-
-
- ../vkconfig_core/layers/170/VK_LAYER_KHRONOS_synchronization2.json
- ../vkconfig_core/layers/170/VK_LAYER_KHRONOS_validation.json
- ../vkconfig_core/layers/170/VK_LAYER_LUNARG_api_dump.json
- ../vkconfig_core/layers/170/VK_LAYER_LUNARG_gfxreconstruct.json
- ../vkconfig_core/layers/170/VK_LAYER_LUNARG_monitor.json
- ../vkconfig_core/layers/170/VK_LAYER_LUNARG_screenshot.json
-
-
diff --git a/vkconfig/settings_tree.cpp b/vkconfig/settings_tree.cpp
deleted file mode 100644
index 2a6d7cd98c..0000000000
--- a/vkconfig/settings_tree.cpp
+++ /dev/null
@@ -1,500 +0,0 @@
-/*
- * 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#include "configurator.h"
-#include "settings_tree.h"
-
-#include "widget_setting.h"
-#include "widget_setting_int.h"
-#include "widget_setting_float.h"
-#include "widget_setting_frames.h"
-#include "widget_setting_bool.h"
-#include "widget_setting_enum.h"
-#include "widget_setting_string.h"
-#include "widget_setting_flags.h"
-#include "widget_setting_filesystem.h"
-#include "widget_setting_list_element.h"
-#include "widget_setting_list.h"
-
-#include "../vkconfig_core/alert.h"
-#include "../vkconfig_core/version.h"
-#include "../vkconfig_core/platform.h"
-#include "../vkconfig_core/util.h"
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-static const char *TOOLTIP_ORDER =
- "Layers are executed between the Vulkan application and driver in the specific order represented here";
-
-SettingsTreeManager::SettingsTreeManager() : launched_application(false), tree(nullptr) {}
-
-void SettingsTreeManager::CreateGUI(QTreeWidget *build_tree) {
- assert(build_tree);
-
- // Do this first to make absolutely sure if these is an old configuration still active it's state gets saved.
- CleanupGUI();
-
- Configurator &configurator = Configurator::Get();
-
- this->tree = build_tree;
-
- Configuration *configuration = configurator.configurations.FindActiveConfiguration();
- if (configuration == nullptr) {
- return;
- }
-
- this->tree->blockSignals(true);
- this->tree->clear();
-
- QFont font_layer = this->tree->font();
- font_layer.setBold(true);
-
- QFont font_section = this->tree->font();
- font_section.setItalic(true);
-
- if (!configuration->HasOverride()) {
- QTreeWidgetItem *item = new QTreeWidgetItem();
- item->setText(0, "No overridden or excluded layer");
- item->setFont(0, font_section);
- item->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->tree->addTopLevelItem(item);
- } else {
- const std::size_t overridden_layer_count = CountOverriddenLayers(configuration->parameters);
-
- if (overridden_layer_count > 1) {
- QTreeWidgetItem *item = new QTreeWidgetItem();
- item->setText(0, "Vulkan Applications");
- item->setToolTip(0, TOOLTIP_ORDER);
- item->setTextAlignment(0, Qt::AlignCenter);
- item->setFont(0, font_section);
- item->setDisabled(true);
- this->tree->addTopLevelItem(item);
- }
-
- // There will be one top level item for each layer
- for (std::size_t i = 0, n = configuration->parameters.size(); i < n; ++i) {
- Parameter ¶meter = configuration->parameters[i];
- if (!IsPlatformSupported(parameter.platform_flags)) continue;
-
- if (parameter.state != LAYER_STATE_OVERRIDDEN) continue;
-
- const std::vector &selected_layers = configurator.layers.selected_layers;
- const Layer *layer = FindByKey(selected_layers, parameter.key.c_str());
-
- QTreeWidgetItem *layer_item = new QTreeWidgetItem();
- this->tree->addTopLevelItem(layer_item);
-
- std::string layer_text = parameter.key;
- if (layer == nullptr) {
- layer_text += " (Missing)";
- } else if (layer->status != STATUS_STABLE) {
- layer_text += std::string(" (") + GetToken(layer->status) + ")";
- }
-
- layer_item->setToolTip(0, parameter.key.c_str()); // Hack for the context menu to find the layer
- layer_item->setText(0, layer_text.c_str());
- layer_item->setFont(0, font_layer);
- layer_item->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- if (layer != nullptr) layer_item->setToolTip(0, layer->description.c_str());
- layer_item->setExpanded(true);
-
- if (layer == nullptr) continue;
-
- // Handle the case were we get off easy. No settings.
- if (parameter.settings.empty()) {
- QTreeWidgetItem *layer_child_item = new QTreeWidgetItem();
- layer_child_item->setText(0, "No User Settings");
- layer_item->addChild(layer_child_item);
- continue;
- }
-
- if (!layer->presets.empty()) {
- QTreeWidgetItem *presets_item = new QTreeWidgetItem();
- layer_item->addChild(presets_item);
- WidgetPreset *presets_combobox = new WidgetPreset(this->tree, presets_item, *layer, parameter);
- this->connect(presets_combobox, SIGNAL(itemChanged()), this, SLOT(OnPresetChanged()));
- }
-
- if (UseBuiltinValidationSettings(parameter)) {
- BuildValidationTree(layer_item, parameter);
- } else {
- BuildGenericTree(layer_item, parameter);
- }
- }
-
- if (overridden_layer_count > 1) {
- QTreeWidgetItem *item = new QTreeWidgetItem();
- item->setText(0, "Vulkan Drivers");
- item->setToolTip(0, TOOLTIP_ORDER);
- item->setTextAlignment(0, Qt::AlignCenter);
- item->setFont(0, font_section);
- item->setDisabled(true);
- this->tree->addTopLevelItem(item);
- }
-
- const std::size_t excluded_layer_count =
- CountExcludedLayers(configuration->parameters, configurator.layers.selected_layers);
-
- if (excluded_layer_count > 0) {
- // The last item is just the excluded layers
- QTreeWidgetItem *excluded_layers = new QTreeWidgetItem();
- this->tree->addTopLevelItem(excluded_layers);
- excluded_layers->setText(0, "Excluded Layers:");
- excluded_layers->setToolTip(0, "The following layers won't be executed.");
- excluded_layers->setFont(0, font_section);
- excluded_layers->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- excluded_layers->setExpanded(true);
-
- for (std::size_t i = 0, n = configuration->parameters.size(); i < n; ++i) {
- Parameter ¶meter = configuration->parameters[i];
- if (!IsPlatformSupported(parameter.platform_flags)) continue;
-
- if (parameter.state != LAYER_STATE_EXCLUDED) continue;
-
- const Layer *layer = FindByKey(configurator.layers.selected_layers, parameter.key.c_str());
- if (layer == nullptr) continue; // Do not display missing excluded layers
-
- QTreeWidgetItem *layer_item = new QTreeWidgetItem();
- layer_item->setText(0, parameter.key.c_str());
- layer_item->setFont(0, font_layer);
- layer_item->setToolTip(0, layer->description.c_str());
- excluded_layers->addChild(layer_item);
- }
-
- // None excluded layer were found
- if (excluded_layers->childCount() == 0) {
- QTreeWidgetItem *child = new QTreeWidgetItem();
- child->setText(0, "None");
- excluded_layers->addChild(child);
- }
- }
- }
-
- this->connect(this->tree, SIGNAL(expanded(const QModelIndex)), this, SLOT(OnExpandedChanged(const QModelIndex)));
- this->connect(this->tree, SIGNAL(collapsed(const QModelIndex)), this, SLOT(OnCollapsedChanged(const QModelIndex)));
-
- this->tree->resizeColumnToContents(0);
-
- if (!configuration->setting_tree_state.isEmpty()) {
- this->SetTreeState(configuration->setting_tree_state, 0, this->tree->invisibleRootItem());
- }
-
- this->tree->blockSignals(false);
-}
-
-void SettingsTreeManager::CleanupGUI() {
- if (this->tree == nullptr) // Was not initialized
- return;
-
- Configurator &configurator = Configurator::Get();
-
- Configuration *configuration = configurator.configurations.FindActiveConfiguration();
- if (configuration != nullptr) {
- configuration->setting_tree_state.clear();
- GetTreeState(configuration->setting_tree_state, this->tree->invisibleRootItem());
- }
-
- this->validation.reset();
-
- this->tree->clear();
- this->tree = nullptr;
-}
-
-void SettingsTreeManager::OnExpandedChanged(const QModelIndex &index) {
- (void)index;
-
- if (this->tree == nullptr) // Was not initialized
- return;
-
- Configurator &configurator = Configurator::Get();
-
- Configuration *configuration = configurator.configurations.FindActiveConfiguration();
- configuration->setting_tree_state.clear();
- GetTreeState(configuration->setting_tree_state, this->tree->invisibleRootItem());
-
- return;
-}
-
-void SettingsTreeManager::OnCollapsedChanged(const QModelIndex &index) {
- (void)index;
-
- if (this->tree == nullptr) // Was not initialized
- return;
-
- Configurator &configurator = Configurator::Get();
-
- Configuration *configuration = configurator.configurations.FindActiveConfiguration();
- configuration->setting_tree_state.clear();
- GetTreeState(configuration->setting_tree_state, this->tree->invisibleRootItem());
-
- return;
-}
-
-void SettingsTreeManager::BuildValidationTree(QTreeWidgetItem *parent, Parameter ¶meter) {
- Configurator &configurator = Configurator::Get();
- std::vector &selected_layers = configurator.layers.selected_layers;
- Layer *validation_layer = FindByKey(selected_layers, "VK_LAYER_KHRONOS_validation");
- assert(validation_layer != nullptr);
-
- QTreeWidgetItem *validation_areas_item = new QTreeWidgetItem();
- parent->addChild(validation_areas_item);
-
- // This just finds the enables and disables
- this->validation.reset(
- new WidgetSettingValidation(this->tree, validation_areas_item, validation_layer->settings, parameter.settings));
- this->connect(this->validation.get(), SIGNAL(itemChanged()), this, SLOT(OnSettingChanged()));
-
- SettingMetaSet &settings = validation_layer->settings;
- for (std::size_t i = 0, n = settings.size(); i < n; ++i) {
- this->BuildTreeItem(parent, parameter, *settings[i]);
- }
-}
-
-static bool IsBuiltinValidationSetting(const Parameter ¶meter, const std::string &key) {
- if (parameter.key != "VK_LAYER_KHRONOS_validation") return false;
-
- std::vector keys;
- keys.push_back("enables");
- keys.push_back("disables");
-
- if (parameter.api_version.GetPatch() < 242) {
- keys.push_back("printf_to_stdout");
- keys.push_back("printf_verbose");
- keys.push_back("printf_buffer_size");
- keys.push_back("gpuav_buffer_oob");
- keys.push_back("warn_on_robust_oob");
- keys.push_back("validate_draw_indirect");
- keys.push_back("vma_linear_output");
- keys.push_back("fine_grained_locking");
- }
-
- return IsStringFound(keys, key);
-}
-
-void SettingsTreeManager::BuildTreeItem(QTreeWidgetItem *parent, Parameter ¶meter, const SettingMeta &meta_object) {
- if (IsBuiltinValidationSetting(parameter, meta_object.key)) return;
- if (!IsPlatformSupported(meta_object.platform_flags)) return;
- if (meta_object.view == SETTING_VIEW_HIDDEN) return;
- if (meta_object.view == SETTING_VIEW_ADVANCED &&
- !Configurator::Get().configurations.FindActiveConfiguration()->view_advanced_settings)
- return;
-
- QTreeWidgetItem *item = new QTreeWidgetItem();
- item->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- parent->addChild(item);
-
- 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, tree->font());
- item->setExpanded(meta_object.expanded);
- } break;
- case SETTING_BOOL:
- case SETTING_BOOL_NUMERIC_DEPRECATED: {
- const SettingMetaBool &meta = static_cast(meta_object);
-
- WidgetSettingBool *widget = new WidgetSettingBool(tree, item, meta, parameter.settings);
- this->connect(widget, SIGNAL(itemChanged()), this, SLOT(OnSettingChanged()));
- } break;
-
- case SETTING_INT: {
- const SettingMetaInt &meta = static_cast(meta_object);
-
- WidgetSettingInt *widget = new WidgetSettingInt(tree, item, meta, parameter.settings);
- this->connect(widget, SIGNAL(itemChanged()), this, SLOT(OnSettingChanged()));
- } break;
-
- case SETTING_FLOAT: {
- const SettingMetaFloat &meta = static_cast(meta_object);
-
- WidgetSettingFloat *widget = new WidgetSettingFloat(tree, item, meta, parameter.settings);
- this->connect(widget, SIGNAL(itemChanged()), this, SLOT(OnSettingChanged()));
- } break;
-
- case SETTING_FRAMES: {
- const SettingMetaFrames &meta = static_cast(meta_object);
-
- WidgetSettingFrames *widget = new WidgetSettingFrames(tree, item, meta, parameter.settings);
- this->connect(widget, SIGNAL(itemChanged()), this, SLOT(OnSettingChanged()));
- } break;
-
- case SETTING_SAVE_FILE:
- case SETTING_LOAD_FILE:
- case SETTING_SAVE_FOLDER:
- case SETTING_LOAD_FOLDER: {
- const SettingMetaFilesystem &meta = static_cast(meta_object);
-
- WidgetSettingFilesystem *widget = new WidgetSettingFilesystem(tree, item, meta, parameter.settings);
- this->connect(widget, SIGNAL(itemChanged()), this, SLOT(OnSettingChanged()));
- } break;
-
- case SETTING_ENUM: {
- const SettingMetaEnum &meta = static_cast(meta_object);
-
- WidgetSettingEnum *enum_widget = new WidgetSettingEnum(tree, item, meta, parameter.settings);
- this->connect(enum_widget, SIGNAL(itemChanged()), this, SLOT(OnSettingChanged()));
-
- for (std::size_t i = 0, n = meta.enum_values.size(); i < n; ++i) {
- const SettingEnumValue &value = meta.enum_values[i];
-
- if (!IsPlatformSupported(value.platform_flags)) continue;
- if (value.view == SETTING_VIEW_HIDDEN) continue;
-
- for (std::size_t i = 0, n = value.settings.size(); i < n; ++i) {
- this->BuildTreeItem(item, parameter, *value.settings[i]);
- }
- }
- } break;
-
- case SETTING_FLAGS: {
- const SettingMetaFlags &meta = static_cast(meta_object);
-
- item->setText(0, meta.label.c_str());
- item->setToolTip(0, meta.description.c_str());
- item->setExpanded(meta.expanded);
-
- for (std::size_t i = 0, n = meta.enum_values.size(); i < n; ++i) {
- const SettingEnumValue &value = meta.enum_values[i];
-
- if (!IsPlatformSupported(value.platform_flags)) continue;
- if (value.view == SETTING_VIEW_HIDDEN) continue;
-
- QTreeWidgetItem *child = new QTreeWidgetItem();
- item->addChild(child);
-
- WidgetSettingFlag *widget = new WidgetSettingFlag(tree, child, meta, parameter.settings, value.key.c_str());
- this->connect(widget, SIGNAL(itemChanged()), this, SLOT(OnSettingChanged()));
-
- for (std::size_t j = 0, o = value.settings.size(); j < o; ++j) {
- this->BuildTreeItem(child, parameter, *value.settings[j]);
- }
- }
- } break;
-
- case SETTING_STRING: {
- const SettingMetaString &meta = static_cast(meta_object);
-
- WidgetSettingString *widget = new WidgetSettingString(tree, item, meta, parameter.settings);
- this->connect(widget, SIGNAL(itemChanged()), this, SLOT(OnSettingChanged()));
- } break;
-
- case SETTING_LIST: {
- const SettingMetaList &meta = static_cast(meta_object);
-
- WidgetSettingList *widget = new WidgetSettingList(tree, item, meta, parameter.settings);
- this->connect(widget, SIGNAL(itemChanged()), this, SLOT(OnSettingChanged()));
- } break;
-
- default: {
- item->setText(0, "Unknown setting");
- assert(0); // Unknown setting
- } break;
- }
-
- for (std::size_t i = 0, n = meta_object.children.size(); i < n; ++i) {
- this->BuildTreeItem(item, parameter, *meta_object.children[i]);
- }
-}
-
-void SettingsTreeManager::BuildGenericTree(QTreeWidgetItem *parent, Parameter ¶meter) {
- std::vector &selected_layers = Configurator::Get().layers.selected_layers;
-
- const SettingMetaSet &settings = FindByKey(selected_layers, parameter.key.c_str())->settings;
- for (std::size_t i = 0, n = settings.size(); i < n; ++i) {
- this->BuildTreeItem(parent, parameter, *settings[i]);
- }
-}
-
-void SettingsTreeManager::GetTreeState(QByteArray &byte_array, QTreeWidgetItem *top_item) {
- byte_array.push_back(top_item->isExpanded() ? '1' : '0');
-
- for (int i = 0, n = top_item->childCount(); i < n; ++i) {
- GetTreeState(byte_array, top_item->child(i));
- }
-}
-
-int SettingsTreeManager::SetTreeState(QByteArray &byte_array, int index, QTreeWidgetItem *top_item) {
- // We very well could run out, on initial run, expand everything
- if (index > byte_array.length())
- top_item->setExpanded(true);
- else {
- top_item->setExpanded(byte_array[index++] == '1');
- }
-
- // Walk the children
- if (top_item->childCount() != 0) {
- for (int i = 0, n = top_item->childCount(); i < n; ++i) {
- index = SetTreeState(byte_array, index, top_item->child(i));
- }
- }
-
- return index;
-}
-
-void SettingsTreeManager::OnPresetChanged() { this->Refresh(REFRESH_ENABLE_AND_STATE); }
-
-void SettingsTreeManager::OnSettingChanged() { this->Refresh(REFRESH_ENABLE_ONLY); }
-
-void SettingsTreeManager::Refresh(RefreshAreas refresh_areas) {
- this->tree->blockSignals(true);
-
- QTreeWidgetItem *root_item = this->tree->invisibleRootItem();
- for (int i = 0, n = root_item->childCount(); i < n; ++i) {
- this->RefreshItem(refresh_areas, root_item->child(i));
- }
-
- this->tree->blockSignals(false);
-
- if (this->launched_application) {
- QSettings settings;
- if (!settings.value(VKCONFIG_KEY_MESSAGE_NEED_APPLICATION_RESTART, false).toBool()) {
- settings.setValue(VKCONFIG_KEY_MESSAGE_NEED_APPLICATION_RESTART, true);
-
- Alert::ConfiguratorRestart();
- }
- }
-
- // Refresh layer configuration
- Configurator &configurator = Configurator::Get();
- configurator.configurations.Configure(configurator.layers.selected_layers);
-}
-
-void SettingsTreeManager::RefreshItem(RefreshAreas refresh_areas, QTreeWidgetItem *parent) {
- QWidget *widget = this->tree->itemWidget(parent, 0);
- if (widget != nullptr) {
- WidgetSettingBase *widget_base = dynamic_cast(widget);
- if (widget_base != nullptr) widget_base->Refresh(refresh_areas);
- }
-
- for (int i = 0, n = parent->childCount(); i < n; ++i) {
- QTreeWidgetItem *child = parent->child(i);
- if (child == nullptr) continue;
-
- this->RefreshItem(refresh_areas, child);
- }
-}
diff --git a/vkconfig/settings_tree.h b/vkconfig/settings_tree.h
deleted file mode 100644
index 9979d53134..0000000000
--- a/vkconfig/settings_tree.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#pragma once
-
-#include "settings_validation_areas.h"
-#include "widget_setting_flags.h"
-#include "widget_setting_filesystem.h"
-#include "widget_preset.h"
-
-#include "../vkconfig_core/configuration.h"
-
-#include
-#include
-
-#include
-#include
-
-class SettingsTreeManager : QObject {
- Q_OBJECT
- public:
- SettingsTreeManager();
-
- bool launched_application;
-
- void CreateGUI(QTreeWidget *build_tree);
- void CleanupGUI();
-
- void GetTreeState(QByteArray &byte_array, QTreeWidgetItem *top_item);
- int SetTreeState(QByteArray &byte_array, int index, QTreeWidgetItem *top_item);
-
- void Refresh(RefreshAreas refresh_areas);
-
- public Q_SLOTS:
- void OnSettingChanged();
- void OnPresetChanged();
- void OnExpandedChanged(const QModelIndex &index);
- void OnCollapsedChanged(const QModelIndex &index);
-
- private:
- SettingsTreeManager(const SettingsTreeManager &) = delete;
- SettingsTreeManager &operator=(const SettingsTreeManager &) = delete;
-
- void BuildValidationTree(QTreeWidgetItem *parent, Parameter ¶meter);
- void BuildGenericTree(QTreeWidgetItem *parent, Parameter ¶meter);
- void BuildTreeItem(QTreeWidgetItem *parent, Parameter ¶meter, const SettingMeta &meta);
-
- void RefreshItem(RefreshAreas refresh_areas, QTreeWidgetItem *parent);
-
- QTreeWidget *tree;
- std::unique_ptr validation;
-};
diff --git a/vkconfig/settings_validation_areas.cpp b/vkconfig/settings_validation_areas.cpp
deleted file mode 100644
index f5e35a7799..0000000000
--- a/vkconfig/settings_validation_areas.cpp
+++ /dev/null
@@ -1,977 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#include "widget_setting.h"
-#include "settings_validation_areas.h"
-#include "configurator.h"
-
-#include "../vkconfig_core/version.h"
-#include "../vkconfig_core/platform.h"
-#include "../vkconfig_core/util.h"
-#include "../vkconfig_core/setting_bool.h"
-
-#include
-#include
-
-static const char *TOKEN_CORE = "VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT";
-static const char *TOKEN_CORE_LAYOUT = "VALIDATION_CHECK_DISABLE_IMAGE_LAYOUT_VALIDATION";
-static const char *TOKEN_CORE_CMD = "VALIDATION_CHECK_DISABLE_COMMAND_BUFFER_STATE";
-static const char *TOKEN_CORE_OBJECT = "VALIDATION_CHECK_DISABLE_OBJECT_IN_USE";
-static const char *TOKEN_CORE_QUERY = "VALIDATION_CHECK_DISABLE_QUERY_VALIDATION";
-static const char *TOKEN_CORE_DESC = "VALIDATION_CHECK_DISABLE_IDLE_DESCRIPTOR_SET";
-static const char *TOKEN_CORE_SHADER = "VK_VALIDATION_FEATURE_DISABLE_SHADERS_EXT";
-static const char *TOKEN_CORE_PUSH = "VALIDATION_CHECK_DISABLE_PUSH_CONSTANT_RANGE";
-static const char *TOKEN_CORE_CACHING = "VK_VALIDATION_FEATURE_DISABLE_SHADER_VALIDATION_CACHE_EXT";
-
-static const char *TOKEN_MISC_THREAD = "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT";
-static const char *TOKEN_MISC_UNIQUE = "VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT";
-static const char *TOKEN_MISC_LIFETIMES = "VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT";
-static const char *TOKEN_MISC_PARAM = "VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT";
-
-static const char *TOKEN_SHADER_GPU = "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT";
-static const char *TOKEN_SHADER_GPU_RESERVE = "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT";
-static const char *TOKEN_SHADER_PRINTF = "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT";
-
-static const char *TOKEN_SYNC = "VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT";
-static const char *TOKEN_SYNC_QUEUE_SUBMIT = "VALIDATION_CHECK_ENABLE_SYNCHRONIZATION_VALIDATION_QUEUE_SUBMIT";
-
-static const char *TOKEN_BEST = "VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT";
-static const char *TOKEN_BEST_ARM = "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_ARM";
-static const char *TOKEN_BEST_AMD = "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_AMD";
-static const char *TOKEN_BEST_IMG = "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_IMG";
-static const char *TOKEN_BEST_NVIDIA = "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_NVIDIA";
-
-QCheckBox *WidgetSettingValidation::CreateWidget(QTreeWidgetItem *parent, QTreeWidgetItem **item, const char *key,
- const char *flag) {
- const SettingEnumValue *value = this->GetMetaFlag(key, flag);
-
- if (!IsSupported(value)) {
- return nullptr;
- }
-
- const std::string status = value->status == STATUS_STABLE ? "" : std::string(" (") + GetToken(value->status) + ")";
-
- *item = new QTreeWidgetItem();
- (*item)->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- parent->addChild(*item);
- (*item)->setExpanded(true);
-
- QCheckBox *widget = new QCheckBox(this);
- widget->setText((value->label + status).c_str());
- widget->setToolTip(value->description.c_str());
- this->tree->setItemWidget(*item, 0, widget);
- return widget;
-}
-
-WidgetSettingValidation::WidgetSettingValidation(QTreeWidget *tree, QTreeWidgetItem *item, const SettingMetaSet &meta_set,
- SettingDataSet &data_set)
- : WidgetSettingBase(tree, item),
- item_core(nullptr),
- widget_core(nullptr),
- item_core_layout(nullptr),
- widget_core_layout(nullptr),
- item_core_command(nullptr),
- widget_core_cmd(nullptr),
- item_core_object(nullptr),
- widget_core_object(nullptr),
- item_core_query(nullptr),
- widget_core_query(nullptr),
- item_core_desc(nullptr),
- widget_core_desc(nullptr),
- item_core_shader(nullptr),
- widget_core_shader(nullptr),
- item_core_push(nullptr),
- widget_core_push(nullptr),
- item_misc_thread(nullptr),
- widget_misc_thread(nullptr),
- item_misc_unique(nullptr),
- widget_misc_unique(nullptr),
- item_misc_lifetimes(nullptr),
- widget_misc_lifetimes(nullptr),
- item_misc_param(nullptr),
- widget_misc_param(nullptr),
-
- item_shader(nullptr),
- widget_shader(nullptr),
- item_shader_gpu(nullptr),
- widget_shader_gpu(nullptr),
- item_shader_gpu_reserve(nullptr),
- widget_shader_gpu_reserve(nullptr),
- item_shader_gpu_oob(nullptr),
- widget_shader_gpu_oob(nullptr),
- item_shader_gpu_robust_oob(nullptr),
- widget_shader_gpu_robust_oob(nullptr),
- item_shader_gpu_desc_indexing(nullptr),
- widget_shader_gpu_desc_indexing(nullptr),
- item_shader_gpu_indirect(nullptr),
- widget_shader_gpu_indirect(nullptr),
- item_shader_dispatch_indirect(nullptr),
- widget_shader_dispatch_indirect(nullptr),
- item_shader_gpu_vma_linear_output(nullptr),
- widget_shader_gpu_vma_linear_output(nullptr),
- item_shader_printf(nullptr),
- widget_shader_printf(nullptr),
-
- item_shader_printf_to_stdout(nullptr),
- widget_shader_printf_to_stdout(nullptr),
- item_shader_printf_verbose(nullptr),
- widget_shader_printf_verbose(nullptr),
- item_shader_printf_size(nullptr),
- widget_debug_printf_size(nullptr),
-
- item_sync(nullptr),
- widget_sync(nullptr),
- item_sync_queue_submit(nullptr),
- widget_sync_queue_submit(nullptr),
- item_best(nullptr),
- widget_best(nullptr),
- item_best_arm(nullptr),
- widget_best_arm(nullptr),
- item_best_amd(nullptr),
- widget_best_amd(nullptr),
- item_best_img(nullptr),
- widget_best_img(nullptr),
- item_best_nvidia(nullptr),
- widget_best_nvidia(nullptr),
-
- meta_set(meta_set),
- data_set(data_set) {
- assert(FindSetting(meta_set, "enables") != nullptr);
- assert(FindSetting(meta_set, "disables") != nullptr);
- assert(FindSetting(data_set, "enables") != nullptr);
- assert(FindSetting(data_set, "disables") != nullptr);
-
- this->item->setText(0, "Validation Areas");
- this->item->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item->setExpanded(false);
-
- // Core
- this->widget_core = this->CreateWidget(this->item, &this->item_core, "disables", TOKEN_CORE);
- if (this->widget_core != nullptr) {
- this->connect(this->widget_core, SIGNAL(clicked(bool)), this, SLOT(OnCoreChecked(bool)));
-
- Configurator &configurator = Configurator::Get();
- Configuration *configuration = configurator.configurations.FindActiveConfiguration();
-
- if (configuration->view_advanced_settings) {
- this->widget_core_layout = this->CreateWidget(this->item_core, &this->item_core_layout, "disables", TOKEN_CORE_LAYOUT);
- if (this->widget_core_layout != nullptr)
- this->connect(this->widget_core_layout, SIGNAL(clicked(bool)), this, SLOT(OnCoreLayoutChecked(bool)));
-
- this->widget_core_cmd = this->CreateWidget(this->item_core, &this->item_core_command, "disables", TOKEN_CORE_CMD);
- if (this->widget_core_cmd != nullptr)
- this->connect(this->widget_core_cmd, SIGNAL(clicked(bool)), this, SLOT(OnCoreCommandChecked(bool)));
-
- this->widget_core_object = this->CreateWidget(this->item_core, &this->item_core_object, "disables", TOKEN_CORE_OBJECT);
- if (this->widget_core_object != nullptr)
- this->connect(this->widget_core_object, SIGNAL(clicked(bool)), this, SLOT(OnCoreObjectChecked(bool)));
-
- this->widget_core_query = this->CreateWidget(this->item_core, &this->item_core_query, "disables", TOKEN_CORE_QUERY);
- if (this->widget_core_query != nullptr)
- this->connect(this->widget_core_query, SIGNAL(clicked(bool)), this, SLOT(OnCoreQueryChecked(bool)));
-
- this->widget_core_desc = this->CreateWidget(this->item_core, &this->item_core_desc, "disables", TOKEN_CORE_DESC);
- if (this->widget_core_desc != nullptr)
- this->connect(this->widget_core_desc, SIGNAL(clicked(bool)), this, SLOT(OnCoreDescChecked(bool)));
-
- this->widget_core_shader = this->CreateWidget(this->item_core, &this->item_core_shader, "disables", TOKEN_CORE_SHADER);
- if (this->widget_core_shader != nullptr) {
- this->connect(this->widget_core_shader, SIGNAL(clicked(bool)), this, SLOT(OnCoreShaderChecked(bool)));
-
- this->widget_core_caching =
- this->CreateWidget(this->item_core_shader, &this->item_core_caching, "disables", TOKEN_CORE_CACHING);
- if (this->widget_core_caching != nullptr)
- this->connect(this->widget_core_caching, SIGNAL(clicked(bool)), this, SLOT(OnCoreCachingChecked(bool)));
- }
-
- this->widget_core_push = this->CreateWidget(this->item_core, &this->item_core_push, "disables", TOKEN_CORE_PUSH);
- if (this->widget_core_push != nullptr)
- this->connect(this->widget_core_push, SIGNAL(clicked(bool)), this, SLOT(OnCorePushChecked(bool)));
- }
- }
-
- // Misc: VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT
- this->widget_misc_thread = this->CreateWidget(this->item, &this->item_misc_thread, "disables", TOKEN_MISC_THREAD);
- if (this->widget_misc_thread != nullptr)
- this->connect(this->widget_misc_thread, SIGNAL(clicked(bool)), this, SLOT(OnMiscThreadChecked(bool)));
-
- // Misc: VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT
- this->widget_misc_unique = this->CreateWidget(this->item, &this->item_misc_unique, "disables", TOKEN_MISC_UNIQUE);
- if (this->widget_misc_unique != nullptr)
- this->connect(this->widget_misc_unique, SIGNAL(clicked(bool)), this, SLOT(OnMiscUniqueChecked(bool)));
-
- // Misc: VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT
- this->widget_misc_lifetimes = this->CreateWidget(this->item, &this->item_misc_lifetimes, "disables", TOKEN_MISC_LIFETIMES);
- if (this->widget_misc_lifetimes != nullptr)
- this->connect(this->widget_misc_lifetimes, SIGNAL(clicked(bool)), this, SLOT(OnMiscLifetimesChecked(bool)));
-
- // Misc: VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT
- this->widget_misc_param = this->CreateWidget(this->item, &this->item_misc_param, "disables", TOKEN_MISC_PARAM);
- if (this->widget_misc_param != nullptr)
- this->connect(this->widget_misc_param, SIGNAL(clicked(bool)), this, SLOT(OnMiscParamChecked(bool)));
-
- // Shader-based
- {
- const SettingEnumValue *value_gpu = GetMetaFlag("enables", TOKEN_SHADER_GPU);
- const SettingEnumValue *value_printf = GetMetaFlag("enables", TOKEN_SHADER_PRINTF);
- if (IsSupported(value_gpu) && IsSupported(value_printf)) {
- this->item_shader = new QTreeWidgetItem();
- this->item_shader->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item->addChild(this->item_shader);
-
- this->widget_shader = new QCheckBox(this);
- this->widget_shader->setText("Shader-Based");
- this->tree->setItemWidget(this->item_shader, 0, this->widget_shader);
- this->connect(this->widget_shader, SIGNAL(clicked(bool)), this, SLOT(OnShaderBasedChecked(bool)));
-
- this->item_shader_gpu = new QTreeWidgetItem();
- this->item_shader_gpu->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item_shader->addChild(this->item_shader_gpu);
- this->item_shader->setExpanded(true);
- this->item_shader_gpu->setExpanded(true);
-
- this->widget_shader_gpu = new QRadioButton(this);
- this->widget_shader_gpu->setText(value_gpu->label.c_str());
- this->widget_shader_gpu->setToolTip(value_gpu->description.c_str());
- this->tree->setItemWidget(this->item_shader_gpu, 0, this->widget_shader_gpu);
- this->connect(this->widget_shader_gpu, SIGNAL(toggled(bool)), this, SLOT(OnShaderGPUChecked(bool)));
-
- this->widget_shader_gpu_reserve =
- this->CreateWidget(this->item_shader_gpu, &this->item_shader_gpu_reserve, "enables", TOKEN_SHADER_GPU_RESERVE);
-
- if (this->widget_shader_gpu_reserve != nullptr)
- this->connect(this->widget_shader_gpu_reserve, SIGNAL(clicked(bool)), this, SLOT(OnShaderGPUReserveChecked(bool)));
-
- {
- const SettingMetaBool *value = FindSetting(meta_set, "gpuav_descriptor_indexing");
- if (IsSupported(value)) {
- this->item_shader_gpu_desc_indexing = new QTreeWidgetItem();
- this->item_shader_gpu_desc_indexing->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item_shader_gpu->addChild(this->item_shader_gpu_desc_indexing);
- this->item_shader_gpu->setExpanded(true);
-
- this->widget_shader_gpu_desc_indexing = new QCheckBox(this);
- this->widget_shader_gpu_desc_indexing->setText(value->label.c_str());
- this->widget_shader_gpu_desc_indexing->setToolTip(value->description.c_str());
- this->tree->setItemWidget(this->item_shader_gpu_desc_indexing, 0, this->widget_shader_gpu_desc_indexing);
- this->connect(this->widget_shader_gpu_desc_indexing, SIGNAL(clicked(bool)), this,
- SLOT(OnShaderGPUDescIndexingChecked(bool)));
- }
- }
-
- {
- const SettingMetaBool *value = FindSetting(meta_set, "gpuav_buffer_oob");
- if (IsSupported(value)) {
- this->item_shader_gpu_oob = new QTreeWidgetItem();
- this->item_shader_gpu_oob->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item_shader_gpu->addChild(this->item_shader_gpu_oob);
- this->item_shader_gpu->setExpanded(true);
-
- this->widget_shader_gpu_oob = new QCheckBox(this);
- this->widget_shader_gpu_oob->setText(value->label.c_str());
- this->widget_shader_gpu_oob->setToolTip(value->description.c_str());
- this->tree->setItemWidget(this->item_shader_gpu_oob, 0, this->widget_shader_gpu_oob);
- this->connect(this->widget_shader_gpu_oob, SIGNAL(clicked(bool)), this, SLOT(OnShaderGPUOOBChecked(bool)));
-
- {
- const SettingMetaBool *value = FindSetting(meta_set, "warn_on_robust_oob");
- if (IsSupported(value)) {
- this->item_shader_gpu_robust_oob = new QTreeWidgetItem();
- this->item_shader_gpu_robust_oob->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item_shader_gpu_oob->addChild(this->item_shader_gpu_robust_oob);
- this->item_shader_gpu_oob->setExpanded(true);
-
- this->widget_shader_gpu_robust_oob = new QCheckBox(this);
- this->widget_shader_gpu_robust_oob->setText(value->label.c_str());
- this->widget_shader_gpu_robust_oob->setToolTip(value->description.c_str());
- this->tree->setItemWidget(this->item_shader_gpu_robust_oob, 0, this->widget_shader_gpu_robust_oob);
- this->connect(this->widget_shader_gpu_robust_oob, SIGNAL(clicked(bool)), this,
- SLOT(OnShaderGPURobustOOBChecked(bool)));
- }
- }
- }
- }
-
- {
- const SettingMetaBool *value = FindSetting(meta_set, "validate_draw_indirect");
- if (IsSupported(value)) {
- this->item_shader_gpu_indirect = new QTreeWidgetItem();
- this->item_shader_gpu_indirect->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item_shader_gpu->addChild(this->item_shader_gpu_indirect);
- this->item_shader_gpu->setExpanded(true);
-
- this->widget_shader_gpu_indirect = new QCheckBox(this);
- this->widget_shader_gpu_indirect->setText(value->label.c_str());
- this->widget_shader_gpu_indirect->setToolTip(value->description.c_str());
- this->tree->setItemWidget(this->item_shader_gpu_indirect, 0, this->widget_shader_gpu_indirect);
- this->connect(this->widget_shader_gpu_indirect, SIGNAL(clicked(bool)), this,
- SLOT(OnShaderGPUIndirectChecked(bool)));
- }
- }
-
- {
- const SettingMetaBool *value = FindSetting(meta_set, "validate_dispatch_indirect");
- if (IsSupported(value)) {
- this->item_shader_dispatch_indirect = new QTreeWidgetItem();
- this->item_shader_dispatch_indirect->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item_shader_gpu->addChild(this->item_shader_dispatch_indirect);
- this->item_shader_gpu->setExpanded(true);
-
- this->widget_shader_dispatch_indirect = new QCheckBox(this);
- this->widget_shader_dispatch_indirect->setText(value->label.c_str());
- this->widget_shader_dispatch_indirect->setToolTip(value->description.c_str());
- this->tree->setItemWidget(this->item_shader_dispatch_indirect, 0, this->widget_shader_dispatch_indirect);
- this->connect(this->widget_shader_dispatch_indirect, SIGNAL(clicked(bool)), this,
- SLOT(OnShaderDispatchIndirectChecked(bool)));
- }
- }
-
- {
- const SettingMetaBool *value = FindSetting(meta_set, "vma_linear_output");
- if (IsSupported(value)) {
- this->item_shader_gpu_vma_linear_output = new QTreeWidgetItem();
- this->item_shader_gpu_vma_linear_output->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item_shader_gpu->addChild(this->item_shader_gpu_vma_linear_output);
- this->item_shader_gpu->setExpanded(true);
-
- this->widget_shader_gpu_vma_linear_output = new QCheckBox(this);
- this->widget_shader_gpu_vma_linear_output->setText(value->label.c_str());
- this->widget_shader_gpu_vma_linear_output->setToolTip(value->description.c_str());
- this->tree->setItemWidget(this->item_shader_gpu_vma_linear_output, 0,
- this->widget_shader_gpu_vma_linear_output);
- this->connect(this->widget_shader_gpu_vma_linear_output, SIGNAL(clicked(bool)), this,
- SLOT(OnShaderGPUVMALinearOutput(bool)));
- }
- }
-
- this->item_shader_printf = new QTreeWidgetItem();
- this->item_shader_printf->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item_shader->addChild(this->item_shader_printf);
- this->item_shader->setExpanded(true);
- this->item_shader_printf->setExpanded(true);
-
- this->widget_shader_printf = new QRadioButton(this);
- this->widget_shader_printf->setText(value_printf->label.c_str());
- this->widget_shader_printf->setToolTip(value_printf->description.c_str());
- this->tree->setItemWidget(this->item_shader_printf, 0, this->widget_shader_printf);
- this->connect(this->widget_shader_printf, SIGNAL(toggled(bool)), this, SLOT(OnShaderPrintfChecked(bool)));
-
- {
- const SettingMetaBool *value = FindSetting(meta_set, "printf_to_stdout");
- if (IsSupported(value)) {
- this->item_shader_printf_to_stdout = new QTreeWidgetItem();
- this->item_shader_printf_to_stdout->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item_shader_printf->addChild(this->item_shader_printf_to_stdout);
- this->item_shader_printf->setExpanded(true);
-
- this->widget_shader_printf_to_stdout = new QCheckBox(this);
- this->widget_shader_printf_to_stdout->setText(value->label.c_str());
- this->widget_shader_printf_to_stdout->setToolTip(value->description.c_str());
- this->tree->setItemWidget(this->item_shader_printf_to_stdout, 0, this->widget_shader_printf_to_stdout);
- this->connect(this->widget_shader_printf_to_stdout, SIGNAL(clicked(bool)), this,
- SLOT(OnShaderPrintfStdoutChecked(bool)));
- }
- }
-
- {
- const SettingMetaBool *value = FindSetting(meta_set, "printf_verbose");
- if (IsSupported(value)) {
- this->item_shader_printf_verbose = new QTreeWidgetItem();
- this->item_shader_printf_verbose->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item_shader_printf->addChild(this->item_shader_printf_verbose);
- this->item_shader_printf->setExpanded(true);
-
- this->widget_shader_printf_verbose = new QCheckBox(this);
- this->widget_shader_printf_verbose->setText(value->label.c_str());
- this->widget_shader_printf_verbose->setToolTip(value->description.c_str());
- this->tree->setItemWidget(this->item_shader_printf_verbose, 0, this->widget_shader_printf_verbose);
- this->connect(this->widget_shader_printf_verbose, SIGNAL(clicked(bool)), this,
- SLOT(OnShaderPrintfVerboseChecked(bool)));
- }
- }
-
- {
- const SettingMetaInt *value = FindSetting(meta_set, "printf_buffer_size");
- if (IsSupported(value)) {
- this->item_shader_printf_size = new QTreeWidgetItem();
- this->item_shader_printf->addChild(this->item_shader_printf_size);
- this->item_shader_printf->setExpanded(true);
-
- this->widget_debug_printf_size = new WidgetSettingInt(tree, this->item_shader_printf_size, *value, data_set);
- this->connect(this->widget_debug_printf_size, SIGNAL(itemChanged()), this, SLOT(OnSettingChanged()));
- }
- }
- } else if (IsSupported(value_gpu)) {
- this->widget_shader = this->CreateWidget(this->item, &this->item_shader, "enables", TOKEN_SHADER_GPU);
- this->connect(this->widget_shader, SIGNAL(clicked(bool)), this, SLOT(OnShaderGPUChecked(bool)));
-
- this->widget_shader_gpu_reserve =
- this->CreateWidget(this->item_shader, &this->item_shader_gpu_reserve, "enables", TOKEN_SHADER_GPU_RESERVE);
- if (this->widget_shader_gpu_reserve != nullptr)
- this->connect(this->widget_shader_gpu_reserve, SIGNAL(clicked(bool)), this, SLOT(OnShaderGPUReserveChecked(bool)));
- }
- }
-
- // Synchronization
- this->widget_sync = this->CreateWidget(this->item, &this->item_sync, "enables", TOKEN_SYNC);
- if (this->widget_sync != nullptr) {
- this->connect(this->widget_sync, SIGNAL(clicked(bool)), this, SLOT(OnSyncChecked(bool)));
-
- this->widget_sync_queue_submit =
- this->CreateWidget(this->item_sync, &this->item_sync_queue_submit, "enables", TOKEN_SYNC_QUEUE_SUBMIT);
- if (this->widget_sync_queue_submit != nullptr)
- this->connect(this->widget_sync_queue_submit, SIGNAL(clicked(bool)), this, SLOT(OnSyncQueueSubmitChecked(bool)));
- }
-
- // Best Practices
- this->widget_best = this->CreateWidget(this->item, &this->item_best, "enables", TOKEN_BEST);
- if (this->widget_best != nullptr) {
- this->connect(this->widget_best, SIGNAL(clicked(bool)), this, SLOT(OnBestChecked(bool)));
-
- this->widget_best_amd = this->CreateWidget(this->item_best, &this->item_best_amd, "enables", TOKEN_BEST_AMD);
- if (this->widget_best_amd != nullptr)
- this->connect(this->widget_best_amd, SIGNAL(clicked(bool)), this, SLOT(OnBestAmdChecked(bool)));
-
- this->widget_best_arm = this->CreateWidget(this->item_best, &this->item_best_arm, "enables", TOKEN_BEST_ARM);
- if (this->widget_best_arm != nullptr)
- this->connect(this->widget_best_arm, SIGNAL(clicked(bool)), this, SLOT(OnBestArmChecked(bool)));
-
- this->widget_best_img = this->CreateWidget(this->item_best, &this->item_best_img, "enables", TOKEN_BEST_IMG);
- if (this->widget_best_img != nullptr)
- this->connect(this->widget_best_img, SIGNAL(clicked(bool)), this, SLOT(OnBestImgChecked(bool)));
-
- this->widget_best_nvidia = this->CreateWidget(this->item_best, &this->item_best_nvidia, "enables", TOKEN_BEST_NVIDIA);
- if (this->widget_best_nvidia != nullptr)
- this->connect(this->widget_best_nvidia, SIGNAL(clicked(bool)), this, SLOT(OnBestNvidiaChecked(bool)));
- }
-
- this->tree->setItemWidget(this->item, 0, this);
- this->Refresh(REFRESH_ENABLE_AND_STATE);
-}
-
-void WidgetSettingValidation::OnCoreChecked(bool checked) {
- if (checked && !CheckOverhead(OVERHEAD_CORE)) {
- this->widget_core->setChecked(false);
- return;
- }
-
- if (!checked)
- this->UpdateFlag("disables", TOKEN_CORE, true);
- else {
- this->UpdateFlag("disables", TOKEN_CORE, false);
- this->UpdateFlag("disables", TOKEN_CORE_LAYOUT, false);
- this->UpdateFlag("disables", TOKEN_CORE_CMD, false);
- this->UpdateFlag("disables", TOKEN_CORE_OBJECT, false);
- this->UpdateFlag("disables", TOKEN_CORE_QUERY, false);
- this->UpdateFlag("disables", TOKEN_CORE_DESC, false);
- this->UpdateFlag("disables", TOKEN_CORE_SHADER, false);
- this->UpdateFlag("disables", TOKEN_CORE_PUSH, false);
- this->UpdateFlag("disables", TOKEN_CORE_CACHING, false);
- }
-
- if (widget_core_layout != nullptr) {
- widget_core_layout->setChecked(!HasDataFlag("disables", TOKEN_CORE_LAYOUT));
- }
- if (widget_core_cmd != nullptr) {
- widget_core_cmd->setChecked(!HasDataFlag("disables", TOKEN_CORE_CMD));
- }
- if (widget_core_object != nullptr) {
- widget_core_object->setChecked(!HasDataFlag("disables", TOKEN_CORE_OBJECT));
- }
- if (widget_core_query != nullptr) {
- widget_core_query->setChecked(!HasDataFlag("disables", TOKEN_CORE_QUERY));
- }
- if (widget_core_desc != nullptr) {
- widget_core_desc->setChecked(!HasDataFlag("disables", TOKEN_CORE_DESC));
- }
- if (widget_core_shader != nullptr) {
- widget_core_shader->setChecked(!HasDataFlag("disables", TOKEN_CORE_SHADER));
- if (widget_core_caching != nullptr) {
- widget_core_caching->setChecked(!HasDataFlag("disables", TOKEN_CORE_CACHING));
- }
- }
- if (widget_core_push != nullptr) {
- widget_core_push->setChecked(!HasDataFlag("disables", TOKEN_CORE_PUSH));
- }
-
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnCoreLayoutChecked(bool checked) {
- this->UpdateFlag("disables", TOKEN_CORE_LAYOUT, !checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnCoreCommandChecked(bool checked) {
- this->UpdateFlag("disables", TOKEN_CORE_CMD, !checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnCoreObjectChecked(bool checked) {
- this->UpdateFlag("disables", TOKEN_CORE_OBJECT, !checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnCoreQueryChecked(bool checked) {
- this->UpdateFlag("disables", TOKEN_CORE_QUERY, !checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnCoreDescChecked(bool checked) {
- this->UpdateFlag("disables", TOKEN_CORE_DESC, !checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnCoreShaderChecked(bool checked) {
- this->UpdateFlag("disables", TOKEN_CORE_SHADER, !checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnCorePushChecked(bool checked) {
- this->UpdateFlag("disables", TOKEN_CORE_PUSH, !checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnCoreCachingChecked(bool checked) {
- this->UpdateFlag("disables", TOKEN_CORE_CACHING, !checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnMiscThreadChecked(bool checked) {
- this->UpdateFlag("disables", TOKEN_MISC_THREAD, !checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnMiscUniqueChecked(bool checked) {
- this->UpdateFlag("disables", TOKEN_MISC_UNIQUE, !checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnMiscLifetimesChecked(bool checked) {
- this->UpdateFlag("disables", TOKEN_MISC_LIFETIMES, !checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnMiscParamChecked(bool checked) {
- this->UpdateFlag("disables", TOKEN_MISC_PARAM, !checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnShaderBasedChecked(bool checked) {
- if (checked && !CheckOverhead(OVERHEAD_SHADER)) {
- this->widget_shader->setChecked(false);
- return;
- }
-
- if (!checked) {
- this->UpdateFlag("enables", TOKEN_SHADER_GPU, false);
- this->UpdateFlag("enables", TOKEN_SHADER_PRINTF, false);
- } else if (this->widget_shader_printf->isChecked()) {
- this->UpdateFlag("enables", TOKEN_SHADER_GPU, false);
- this->UpdateFlag("enables", TOKEN_SHADER_PRINTF, true);
- } else {
- if (!this->widget_shader_gpu->isChecked()) this->widget_shader_gpu->setChecked(true);
- this->UpdateFlag("enables", TOKEN_SHADER_GPU, true);
- this->UpdateFlag("enables", TOKEN_SHADER_PRINTF, false);
- }
-
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnShaderGPUChecked(bool checked) {
- this->UpdateFlag("enables", TOKEN_SHADER_GPU, checked);
- this->UpdateFlag("enables", TOKEN_SHADER_PRINTF, !checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnShaderGPUReserveChecked(bool checked) {
- this->UpdateFlag("enables", TOKEN_SHADER_GPU_RESERVE, checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnShaderGPUDescIndexingChecked(bool checked) {
- static_cast(FindSetting(this->data_set, "gpuav_descriptor_indexing"))->value = checked;
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnShaderGPUOOBChecked(bool checked) {
- static_cast(FindSetting(this->data_set, "gpuav_buffer_oob"))->value = checked;
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnShaderGPURobustOOBChecked(bool checked) {
- static_cast(FindSetting(this->data_set, "warn_on_robust_oob"))->value = checked;
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnShaderGPUIndirectChecked(bool checked) {
- static_cast(FindSetting(this->data_set, "validate_draw_indirect"))->value = checked;
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnShaderDispatchIndirectChecked(bool checked) {
- static_cast(FindSetting(this->data_set, "validate_dispatch_indirect"))->value = checked;
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnShaderGPUVMALinearOutput(bool checked) {
- static_cast(FindSetting(this->data_set, "vma_linear_output"))->value = checked;
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnShaderPrintfChecked(bool checked) {
- this->UpdateFlag("enables", TOKEN_SHADER_PRINTF, checked);
- this->UpdateFlag("enables", TOKEN_SHADER_GPU, !checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnShaderPrintfStdoutChecked(bool checked) {
- static_cast(FindSetting(this->data_set, "printf_to_stdout"))->value = checked;
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnShaderPrintfVerboseChecked(bool checked) {
- static_cast(FindSetting(this->data_set, "printf_verbose"))->value = checked;
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnSyncChecked(bool checked) {
- if (checked && !CheckOverhead(OVERHEAD_SYNC)) {
- this->widget_sync->setChecked(false);
- return;
- }
-
- this->UpdateFlag("enables", TOKEN_SYNC, checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnSyncQueueSubmitChecked(bool checked) {
- this->UpdateFlag("enables", TOKEN_SYNC_QUEUE_SUBMIT, checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnBestChecked(bool checked) {
- if (checked && !CheckOverhead(OVERHEAD_BEST)) {
- this->widget_best->setChecked(false);
- return;
- }
-
- this->UpdateFlag("enables", TOKEN_BEST, checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnBestArmChecked(bool checked) {
- this->UpdateFlag("enables", TOKEN_BEST_ARM, checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnBestAmdChecked(bool checked) {
- this->UpdateFlag("enables", TOKEN_BEST_AMD, checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnBestImgChecked(bool checked) {
- this->UpdateFlag("enables", TOKEN_BEST_IMG, checked);
- this->OnSettingChanged();
-}
-
-void WidgetSettingValidation::OnBestNvidiaChecked(bool checked) {
- this->UpdateFlag("enables", TOKEN_BEST_NVIDIA, checked);
- this->OnSettingChanged();
-}
-
-bool WidgetSettingValidation::CheckOverhead(Overhead candidate) const {
- QSettings settings;
- if (settings.value("VKCONFIG_WARN_CORE_SHADER_IGNORE").toBool() == false) {
- const bool features_to_run_alone[] = {
- this->widget_core != nullptr ? this->widget_core->isChecked() || candidate == OVERHEAD_CORE : false,
- this->widget_shader != nullptr ? this->widget_shader->isChecked() || candidate == OVERHEAD_SHADER : false,
- this->widget_sync != nullptr ? this->widget_sync->isChecked() || candidate == OVERHEAD_SYNC : false,
- this->widget_best != nullptr ? this->widget_best->isChecked() || candidate == OVERHEAD_BEST : false};
-
- static const char *LABELS[]{
- "Core Validation", // OVERHEAD_CORE
- "Shader Based Validation", // OVERHEAD_SHADER
- "Synchronization Validation", // OVERHEAD_SYNC
- "Best Practices Warnings" // OVERHEAD_BEST
- };
- static_assert(countof(LABELS) == OVERHEAD_COUNT, "The tranlation table size doesn't match the enum number of elements");
-
- int count_enabled_features = 0;
- for (std::size_t i = 0, n = countof(features_to_run_alone); i < n; ++i)
- count_enabled_features += features_to_run_alone[i] ? 1 : 0;
-
- if (count_enabled_features > 1) {
- QMessageBox alert(this->tree);
- alert.setWindowTitle("High Validation Layer Overhead");
- alert.setText(format("Using %s, %s, %s and %s simultanously results in high performance degradation.",
- LABELS[OVERHEAD_CORE], LABELS[OVERHEAD_SHADER], LABELS[OVERHEAD_SYNC], LABELS[OVERHEAD_BEST])
- .c_str());
- alert.setInformativeText(format("Do you want to add %s anyway?", LABELS[candidate]).c_str());
- alert.setIcon(QMessageBox::Warning);
- alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
- alert.setDefaultButton(QMessageBox::Yes);
- alert.setCheckBox(new QCheckBox("Do not show again."));
- const bool result = alert.exec() == QMessageBox::Yes;
- if (alert.checkBox()->isChecked()) {
- settings.setValue("VKCONFIG_WARN_CORE_SHADER_IGNORE", true);
- }
- return result;
- }
- }
-
- return true;
-}
-
-void WidgetSettingValidation::OnSettingChanged() { emit itemChanged(); }
-
-void WidgetSettingValidation::UpdateFlag(const char *key, const char *flag, bool append) {
- SettingDataFlags *data = static_cast(FindSetting(this->data_set, key));
- assert(data != nullptr);
-
- if (append) {
- AppendString(data->value, flag);
- } else {
- RemoveString(data->value, flag);
- }
-}
-
-bool WidgetSettingValidation::HasDataBool(const char *key) const {
- return static_cast(FindSetting(this->data_set, key))->value;
-}
-
-bool WidgetSettingValidation::HasDataFlag(const char *key, const char *flag) const {
- const SettingDataFlags *data = static_cast(FindSetting(this->data_set, key));
-
- return IsStringFound(data->value, flag);
-}
-
-const SettingEnumValue *WidgetSettingValidation::GetMetaFlag(const char *key, const char *flag) const {
- return FindByKey(static_cast(FindSetting(this->meta_set, key))->enum_values, flag);
-}
-
-void WidgetSettingValidation::Refresh(RefreshAreas refresh_areas) {
- const bool core_enabled = !HasDataFlag("disables", TOKEN_CORE);
-
- if (this->widget_core != nullptr) {
- this->widget_core->setChecked(core_enabled);
- }
-
- if (this->widget_core_layout != nullptr) {
- this->widget_core_layout->setEnabled(core_enabled);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_core_layout->setChecked(!HasDataFlag("disables", TOKEN_CORE_LAYOUT));
- }
-
- if (this->widget_core_cmd != nullptr) {
- this->widget_core_cmd->setEnabled(core_enabled);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE) this->widget_core_cmd->setChecked(!HasDataFlag("disables", TOKEN_CORE_CMD));
- }
-
- if (this->widget_core_object != nullptr) {
- this->widget_core_object->setEnabled(core_enabled);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_core_object->setChecked(!HasDataFlag("disables", TOKEN_CORE_OBJECT));
- }
-
- if (this->widget_core_query != nullptr) {
- this->widget_core_query->setEnabled(core_enabled);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_core_query->setChecked(!HasDataFlag("disables", TOKEN_CORE_QUERY));
- }
-
- if (this->widget_core_desc != nullptr) {
- this->widget_core_desc->setEnabled(core_enabled);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_core_desc->setChecked(!HasDataFlag("disables", TOKEN_CORE_DESC));
- }
-
- if (this->widget_core_shader != nullptr) {
- this->widget_core_shader->setEnabled(core_enabled);
-
- const bool shader_enabled = !HasDataFlag("disables", TOKEN_CORE_SHADER);
-
- if (refresh_areas == REFRESH_ENABLE_AND_STATE) this->widget_core_shader->setChecked(shader_enabled);
-
- if (this->widget_core_caching != nullptr) {
- this->widget_core_caching->setEnabled(core_enabled && shader_enabled);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_core_caching->setChecked(!HasDataFlag("disables", TOKEN_CORE_CACHING));
- }
- }
-
- if (this->widget_core_push != nullptr) {
- this->widget_core_push->setEnabled(core_enabled);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_core_push->setChecked(!HasDataFlag("disables", TOKEN_CORE_PUSH));
- }
-
- if (this->widget_misc_thread != nullptr && refresh_areas == REFRESH_ENABLE_AND_STATE) {
- this->widget_misc_thread->setChecked(!HasDataFlag("disables", TOKEN_MISC_THREAD));
- }
-
- if (this->widget_misc_unique != nullptr && refresh_areas == REFRESH_ENABLE_AND_STATE) {
- this->widget_misc_unique->setChecked(!HasDataFlag("disables", TOKEN_MISC_UNIQUE));
- }
-
- if (this->widget_misc_lifetimes != nullptr && refresh_areas == REFRESH_ENABLE_AND_STATE) {
- this->widget_misc_lifetimes->setChecked(!HasDataFlag("disables", TOKEN_MISC_LIFETIMES));
- }
-
- if (this->widget_misc_param != nullptr && refresh_areas == REFRESH_ENABLE_AND_STATE) {
- this->widget_misc_param->setChecked(!HasDataFlag("disables", TOKEN_MISC_PARAM));
- }
-
- if (this->widget_shader != nullptr) {
- const bool shader_gpu = HasDataFlag("enables", TOKEN_SHADER_GPU);
- const bool shader_printf = HasDataFlag("enables", TOKEN_SHADER_PRINTF);
-
- if (GetMetaFlag("enables", TOKEN_SHADER_GPU) != nullptr && GetMetaFlag("enables", TOKEN_SHADER_PRINTF) != nullptr) {
- const bool shader_enabled = this->widget_shader->isChecked() || shader_gpu || shader_printf;
- if (shader_enabled && refresh_areas == REFRESH_ENABLE_AND_STATE) {
- this->widget_shader->setChecked(shader_gpu || shader_printf);
- }
-
- if (this->widget_shader_gpu != nullptr) {
- this->widget_shader_gpu->setEnabled(this->widget_shader->isChecked());
- if (refresh_areas == REFRESH_ENABLE_AND_STATE) this->widget_shader_gpu->setChecked(shader_gpu);
- }
-
- if (this->widget_shader_gpu_reserve != nullptr) {
- this->widget_shader_gpu_reserve->setEnabled(shader_gpu);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_shader_gpu_reserve->setChecked(this->HasDataFlag("enables", TOKEN_SHADER_GPU_RESERVE));
- }
-
- if (this->widget_shader_gpu_desc_indexing != nullptr) {
- this->widget_shader_gpu_desc_indexing->setEnabled(shader_gpu);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_shader_gpu_desc_indexing->setChecked(this->HasDataBool("gpuav_descriptor_indexing"));
- }
-
- if (this->widget_shader_gpu_oob != nullptr) {
- this->widget_shader_gpu_oob->setEnabled(shader_gpu);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_shader_gpu_oob->setChecked(this->HasDataBool("gpuav_buffer_oob"));
-
- if (this->widget_shader_gpu_robust_oob != nullptr) {
- this->widget_shader_gpu_robust_oob->setEnabled(shader_gpu && this->HasDataBool("gpuav_buffer_oob"));
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_shader_gpu_robust_oob->setChecked(this->HasDataBool("warn_on_robust_oob"));
- }
- }
-
- if (this->widget_shader_gpu_indirect != nullptr) {
- this->widget_shader_gpu_indirect->setEnabled(shader_gpu);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_shader_gpu_indirect->setChecked(this->HasDataBool("validate_draw_indirect"));
- }
-
- if (this->widget_shader_dispatch_indirect != nullptr) {
- this->widget_shader_dispatch_indirect->setEnabled(shader_gpu);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_shader_dispatch_indirect->setChecked(this->HasDataBool("validate_dispatch_indirect"));
- }
-
- if (this->widget_shader_gpu_vma_linear_output != nullptr) {
- this->widget_shader_gpu_vma_linear_output->setEnabled(shader_gpu);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_shader_gpu_vma_linear_output->setChecked(this->HasDataBool("vma_linear_output"));
- }
-
- if (this->widget_shader_printf != nullptr) {
- this->widget_shader_printf->setEnabled(this->widget_shader->isChecked());
- if (refresh_areas == REFRESH_ENABLE_AND_STATE) this->widget_shader_printf->setChecked(shader_printf);
- }
-
- if (this->widget_shader_printf_to_stdout != nullptr) {
- this->widget_shader_printf_to_stdout->setEnabled(shader_printf);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_shader_printf_to_stdout->setChecked(this->HasDataBool("printf_to_stdout"));
- }
-
- if (this->widget_shader_printf_verbose != nullptr) {
- this->widget_shader_printf_verbose->setEnabled(shader_printf);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_shader_printf_verbose->setChecked(this->HasDataBool("printf_verbose"));
- }
-
- if (this->widget_debug_printf_size != nullptr) {
- this->widget_debug_printf_size->setEnabled(shader_printf);
- }
- } else if (GetMetaFlag("enables", TOKEN_SHADER_GPU) != nullptr) {
- if (refresh_areas == REFRESH_ENABLE_AND_STATE) {
- this->widget_shader->setChecked(HasDataFlag("enables", TOKEN_SHADER_GPU));
- }
-
- if (this->widget_shader_gpu_reserve != nullptr) {
- this->widget_shader_gpu_reserve->setEnabled(shader_gpu);
- if (refresh_areas == REFRESH_ENABLE_AND_STATE)
- this->widget_shader_gpu_reserve->setChecked(HasDataFlag("enables", TOKEN_SHADER_GPU));
- }
- }
- }
-
- if (this->widget_sync != nullptr && refresh_areas == REFRESH_ENABLE_AND_STATE) {
- this->widget_sync->setChecked(HasDataFlag("enables", TOKEN_SYNC));
- }
-
- if (this->widget_sync_queue_submit != nullptr) {
- this->widget_sync_queue_submit->setEnabled(HasDataFlag("enables", TOKEN_SYNC));
- if (refresh_areas == REFRESH_ENABLE_AND_STATE) {
- this->widget_sync_queue_submit->setChecked(HasDataFlag("enables", TOKEN_SYNC_QUEUE_SUBMIT));
- }
- }
-
- if (this->widget_best != nullptr && refresh_areas == REFRESH_ENABLE_AND_STATE) {
- this->widget_best->setChecked(HasDataFlag("enables", TOKEN_BEST));
- }
-
- if (this->widget_best_arm != nullptr) {
- this->widget_best_arm->setEnabled(HasDataFlag("enables", TOKEN_BEST));
- if (refresh_areas == REFRESH_ENABLE_AND_STATE) {
- this->widget_best_arm->setChecked(HasDataFlag("enables", TOKEN_BEST_ARM));
- }
- }
-
- if (this->widget_best_amd != nullptr) {
- this->widget_best_amd->setEnabled(HasDataFlag("enables", TOKEN_BEST));
- if (refresh_areas == REFRESH_ENABLE_AND_STATE) {
- this->widget_best_amd->setChecked(HasDataFlag("enables", TOKEN_BEST_AMD));
- }
- }
-
- if (this->widget_best_img != nullptr) {
- this->widget_best_img->setEnabled(HasDataFlag("enables", TOKEN_BEST));
- if (refresh_areas == REFRESH_ENABLE_AND_STATE) {
- this->widget_best_img->setChecked(HasDataFlag("enables", TOKEN_BEST_IMG));
- }
- }
-
- if (this->widget_best_nvidia != nullptr) {
- this->widget_best_nvidia->setEnabled(HasDataFlag("enables", TOKEN_BEST));
- if (refresh_areas == REFRESH_ENABLE_AND_STATE) {
- this->widget_best_nvidia->setChecked(HasDataFlag("enables", TOKEN_BEST_NVIDIA));
- }
- }
-
- this->blockSignals(false);
-}
diff --git a/vkconfig/settings_validation_areas.h b/vkconfig/settings_validation_areas.h
deleted file mode 100644
index c621e562ce..0000000000
--- a/vkconfig/settings_validation_areas.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#pragma once
-
-#include "../vkconfig_core/layer.h"
-
-#include "widget_setting_int.h"
-#include "widget_setting_flags.h"
-
-#include "widget_setting.h"
-#include
-#include
-
-#include
-
-class WidgetSettingValidation : public WidgetSettingBase {
- Q_OBJECT
-
- public:
- explicit WidgetSettingValidation(QTreeWidget *tree, QTreeWidgetItem *item, const SettingMetaSet &meta_set,
- SettingDataSet &data_set);
-
- void Refresh(RefreshAreas refresh_areas) override;
-
- private:
- QTreeWidgetItem *item_core;
- QCheckBox *widget_core;
-
- QTreeWidgetItem *item_core_layout;
- QCheckBox *widget_core_layout;
-
- QTreeWidgetItem *item_core_command;
- QCheckBox *widget_core_cmd;
-
- QTreeWidgetItem *item_core_object;
- QCheckBox *widget_core_object;
-
- QTreeWidgetItem *item_core_query;
- QCheckBox *widget_core_query;
-
- QTreeWidgetItem *item_core_desc;
- QCheckBox *widget_core_desc;
-
- QTreeWidgetItem *item_core_shader;
- QCheckBox *widget_core_shader;
-
- QTreeWidgetItem *item_core_push;
- QCheckBox *widget_core_push;
-
- QTreeWidgetItem *item_core_caching;
- QCheckBox *widget_core_caching;
-
- QTreeWidgetItem *item_misc_thread;
- QCheckBox *widget_misc_thread;
-
- QTreeWidgetItem *item_misc_unique;
- QCheckBox *widget_misc_unique;
-
- QTreeWidgetItem *item_misc_lifetimes;
- QCheckBox *widget_misc_lifetimes;
-
- QTreeWidgetItem *item_misc_param;
- QCheckBox *widget_misc_param;
-
- QTreeWidgetItem *item_shader;
- QCheckBox *widget_shader;
-
- QTreeWidgetItem *item_shader_gpu;
- QRadioButton *widget_shader_gpu;
-
- QTreeWidgetItem *item_shader_gpu_reserve;
- QCheckBox *widget_shader_gpu_reserve;
-
- QTreeWidgetItem *item_shader_gpu_oob;
- QCheckBox *widget_shader_gpu_oob;
-
- QTreeWidgetItem *item_shader_gpu_robust_oob;
- QCheckBox *widget_shader_gpu_robust_oob;
-
- QTreeWidgetItem *item_shader_gpu_desc_indexing;
- QCheckBox *widget_shader_gpu_desc_indexing;
-
- QTreeWidgetItem *item_shader_gpu_indirect;
- QCheckBox *widget_shader_gpu_indirect;
-
- QTreeWidgetItem *item_shader_dispatch_indirect;
- QCheckBox *widget_shader_dispatch_indirect;
-
- QTreeWidgetItem *item_shader_gpu_vma_linear_output;
- QCheckBox *widget_shader_gpu_vma_linear_output;
-
- QTreeWidgetItem *item_shader_printf;
- QRadioButton *widget_shader_printf;
-
- QTreeWidgetItem *item_shader_printf_to_stdout;
- QCheckBox *widget_shader_printf_to_stdout;
-
- QTreeWidgetItem *item_shader_printf_verbose;
- QCheckBox *widget_shader_printf_verbose;
-
- QTreeWidgetItem *item_shader_printf_size;
- WidgetSettingInt *widget_debug_printf_size;
-
- QTreeWidgetItem *item_sync;
- QCheckBox *widget_sync;
-
- QTreeWidgetItem *item_sync_queue_submit;
- QCheckBox *widget_sync_queue_submit;
-
- QTreeWidgetItem *item_best;
- QCheckBox *widget_best;
-
- QTreeWidgetItem *item_best_arm;
- QCheckBox *widget_best_arm;
-
- QTreeWidgetItem *item_best_amd;
- QCheckBox *widget_best_amd;
-
- QTreeWidgetItem *item_best_img;
- QCheckBox *widget_best_img;
-
- QTreeWidgetItem *item_best_nvidia;
- QCheckBox *widget_best_nvidia;
-
- QCheckBox *CreateWidget(QTreeWidgetItem *parent, QTreeWidgetItem **item, const char *key, const char *flag);
-
- public Q_SLOTS:
- void OnCoreChecked(bool checked);
-
- void OnCoreLayoutChecked(bool checked);
- void OnCoreCommandChecked(bool checked);
- void OnCoreObjectChecked(bool checked);
- void OnCoreQueryChecked(bool checked);
- void OnCoreDescChecked(bool checked);
- void OnCoreShaderChecked(bool checked);
- void OnCorePushChecked(bool checked);
- void OnCoreCachingChecked(bool checked);
-
- void OnMiscThreadChecked(bool checked);
- void OnMiscUniqueChecked(bool checked);
- void OnMiscLifetimesChecked(bool checked);
- void OnMiscParamChecked(bool checked);
-
- void OnShaderBasedChecked(bool checked);
-
- void OnShaderGPUChecked(bool checked);
- void OnShaderGPUReserveChecked(bool checked);
- void OnShaderGPUDescIndexingChecked(bool checked);
- void OnShaderGPUOOBChecked(bool checked);
- void OnShaderGPURobustOOBChecked(bool checked);
- void OnShaderGPUIndirectChecked(bool checked);
- void OnShaderDispatchIndirectChecked(bool checked);
- void OnShaderGPUVMALinearOutput(bool checked);
-
- void OnShaderPrintfChecked(bool checked);
- void OnShaderPrintfStdoutChecked(bool checked);
- void OnShaderPrintfVerboseChecked(bool checked);
-
- void OnSyncChecked(bool checked);
- void OnSyncQueueSubmitChecked(bool checked);
-
- void OnBestChecked(bool checked);
- void OnBestArmChecked(bool checked);
- void OnBestAmdChecked(bool checked);
- void OnBestImgChecked(bool checked);
- void OnBestNvidiaChecked(bool checked);
-
- void OnSettingChanged();
-
- Q_SIGNALS:
- void itemChanged();
-
- private:
- WidgetSettingValidation(const WidgetSettingValidation &) = delete;
- WidgetSettingValidation &operator=(const WidgetSettingValidation &) = delete;
-
- enum Overhead {
- OVERHEAD_CORE = 0,
- OVERHEAD_SHADER,
- OVERHEAD_SYNC,
- OVERHEAD_BEST,
-
- OVERHEAD_FIRST = OVERHEAD_CORE,
- OVERHEAD_LAST = OVERHEAD_BEST,
- };
-
- enum { OVERHEAD_COUNT = OVERHEAD_LAST - OVERHEAD_FIRST + 1 };
-
- bool CheckOverhead(Overhead candidate) const;
-
- void UpdateFlag(const char *key, const char *flag, bool append);
- bool HasDataBool(const char *key) const;
- bool HasDataFlag(const char *key, const char *flag) const;
- const SettingEnumValue *GetMetaFlag(const char *key, const char *flag) const;
-
- const SettingMetaSet &meta_set;
- SettingDataSet &data_set;
-};
diff --git a/vkconfig/vkconfig.pro b/vkconfig/vkconfig.pro
deleted file mode 100644
index d116c1d1f8..0000000000
--- a/vkconfig/vkconfig.pro
+++ /dev/null
@@ -1,203 +0,0 @@
-QT += core gui
-
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets network
-
-CONFIG += c++11
-CONFIG += sdk_no_version_check
-
-INCLUDEPATH += ../external/Vulkan-Headers/include
-INCLUDEPATH += ../Vulkan-Headers/include
-
-# Ignore JSON validation
-DEFINES += JSON_VALIDATION_OFF
-
-# The following define makes your compiler emit warnings if you use
-# any Qt feature that has been marked deprecated (the exact warnings
-# depend on your compiler). Please consult the documentation of the
-# deprecated API in order to know how to port your code away from it.
-DEFINES += QT_DEPRECATED_WARNINGS
-
-# You can also make your code fail to compile if it uses deprecated APIs.
-# In order to do so, uncomment the following line.
-# You can also select to disable deprecated APIs only up to a certain version of Qt.
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-
-DEFINES += WIN32_LEAN_AND_MEAN
-
-DEFINES += NOMINMAX
-
-Release: DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT
-
-linux: QMAKE_CXXFLAGS += -Wunused-variable
-
-SOURCES += \
- ../vkconfig_core/alert.cpp \
- ../vkconfig_core/application.cpp \
- ../vkconfig_core/application_singleton.cpp \
- ../vkconfig_core/command_line.cpp \
- ../vkconfig_core/configuration.cpp \
- ../vkconfig_core/configuration_manager.cpp \
- ../vkconfig_core/doc.cpp \
- ../vkconfig_core/date.cpp \
- ../vkconfig_core/environment.cpp \
- ../vkconfig_core/header.cpp \
- ../vkconfig_core/help.cpp \
- ../vkconfig_core/json.cpp \
- ../vkconfig_core/json_validator.cpp \
- ../vkconfig_core/layer.cpp \
- ../vkconfig_core/layer_manager.cpp \
- ../vkconfig_core/layer_preset.cpp \
- ../vkconfig_core/layer_state.cpp \
- ../vkconfig_core/layer_type.cpp \
- ../vkconfig_core/override.cpp \
- ../vkconfig_core/parameter.cpp \
- ../vkconfig_core/path.cpp \
- ../vkconfig_core/path_manager.cpp \
- ../vkconfig_core/platform.cpp \
- ../vkconfig_core/registry.cpp \
- ../vkconfig_core/setting.cpp \
- ../vkconfig_core/setting_bool.cpp \
- ../vkconfig_core/setting_filesystem.cpp \
- ../vkconfig_core/setting_flags.cpp \
- ../vkconfig_core/setting_float.cpp \
- ../vkconfig_core/setting_frames.cpp \
- ../vkconfig_core/setting_group.cpp \
- ../vkconfig_core/setting_int.cpp \
- ../vkconfig_core/setting_list.cpp \
- ../vkconfig_core/setting_string.cpp \
- ../vkconfig_core/util.cpp \
- ../vkconfig_core/version.cpp \
- vulkan_util.cpp \
- widget_preset.cpp \
- widget_setting.cpp \
- widget_setting_bool.cpp \
- widget_setting_enum.cpp \
- widget_setting_filesystem.cpp \
- widget_setting_flags.cpp \
- widget_setting_float.cpp \
- widget_setting_int.cpp \
- widget_setting_frames.cpp \
- widget_setting_string.cpp \
- widget_setting_list_element.cpp \
- widget_setting_list.cpp \
- widget_tree_friendly_combobox.cpp \
- dialog_about.cpp \
- dialog_applications.cpp \
- dialog_layers.cpp \
- dialog_vulkan_analysis.cpp \
- dialog_vulkan_info.cpp \
- main.cpp \
- main_gui.cpp \
- main_signal.cpp \
- main_reset.cpp \
- main_layers.cpp \
- main_doc.cpp \
- mainwindow.cpp \
- settings_tree.cpp \
- settings_validation_areas.cpp \
- configurator.cpp
-
-HEADERS += \
- ../vkconfig_core/alert.h \
- ../vkconfig_core/application.h \
- ../vkconfig_core/application_singleton.h \
- ../vkconfig_core/command_line.h \
- ../vkconfig_core/configuration.h \
- ../vkconfig_core/configuration_manager.h \
- ../vkconfig_core/doc.h \
- ../vkconfig_core/date.h \
- ../vkconfig_core/environment.h \
- ../vkconfig_core/header.h \
- ../vkconfig_core/help.h \
- ../vkconfig_core/json.h \
- ../vkconfig_core/json_validator.h \
- ../vkconfig_core/layer.h \
- ../vkconfig_core/layer_manager.h \
- ../vkconfig_core/layer_preset.h \
- ../vkconfig_core/layer_state.h \
- ../vkconfig_core/layer_type.h \
- ../vkconfig_core/override.h \
- ../vkconfig_core/parameter.h \
- ../vkconfig_core/path.h \
- ../vkconfig_core/path_manager.h \
- ../vkconfig_core/platform.h \
- ../vkconfig_core/registry.h \
- ../vkconfig_core/setting.h \
- ../vkconfig_core/setting_bool.h \
- ../vkconfig_core/setting_filesystem.h \
- ../vkconfig_core/setting_flags.h \
- ../vkconfig_core/setting_float.h \
- ../vkconfig_core/setting_frames.h \
- ../vkconfig_core/setting_group.h \
- ../vkconfig_core/setting_int.h \
- ../vkconfig_core/setting_list.h \
- ../vkconfig_core/setting_string.h \
- ../vkconfig_core/util.h \
- ../vkconfig_core/version.h \
- vulkan_util.h \
- widget_preset.h \
- widget_setting.h \
- widget_setting_bool.h \
- widget_setting_enum.h \
- widget_setting_filesystem.h \
- widget_setting_flags.h \
- widget_setting_float.h \
- widget_setting_int.h \
- widget_setting_frames.h \
- widget_setting_string.h \
- widget_setting_list_element.h \
- widget_setting_list.h \
- widget_tree_friendly_combobox.h \
- dialog_about.h \
- dialog_applications.h \
- dialog_layers.h \
- dialog_vulkan_analysis.h \
- dialog_vulkan_info.h \
- main_gui.h \
- main_signal.h \
- main_reset.h \
- main_layers.h \
- main_doc.h \
- mainwindow.h \
- settings_validation_areas.h \
- settings_tree.h \
- configurator.h
-
-FORMS += \
- dialog_about.ui \
- dialog_applications.ui \
- dialog_layers.ui \
- dialog_vulkan_analysis.ui \
- dialog_vulkan_info.ui \
- mainwindow.ui
-
-TRANSLATIONS += \
- vkconfig_en_US.ts
-
-
-win32: {
- LIBS += Advapi32.lib
- LIBS += Cfgmgr32.lib
- LIBS += User32.lib
- RC_ICONS = resourcefiles/vulkan.ico
-}
-
-macx: {
-#CONFIG += file_copies
-#COPIES += shellScript
-#shellScript.files = $$files(macOS/vkconfig.sh)
-#shellScript.path = $$OUT_PWD/VkConfig.app/Contents/MacOS
-
-QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10
-
-QMAKE_INFO_PLIST = macOS/Info.plist
-RC_FILE = macOS/Resources/VulkanIcon.icns
-}
-
-# Default rules for deployment.
-qnx: target.path = /tmp/$${TARGET}/bin
-else: unix:!android: target.path = /opt/$${TARGET}/bin
-!isEmpty(target.path): INSTALLS += target
-
-RESOURCES += \
- resources.qrc
diff --git a/vkconfig/widget_setting.cpp b/vkconfig/widget_setting.cpp
deleted file mode 100644
index 4036caa5f1..0000000000
--- a/vkconfig/widget_setting.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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.h"
-
-WidgetSettingBase::WidgetSettingBase(QTreeWidget* tree, QTreeWidgetItem* item) : tree(tree), item(item) {
- assert(tree != nullptr);
- assert(item != nullptr);
-}
-
-void WidgetSettingBase::DisplayOverride(QWidget* widget, const SettingMeta& meta) const {
- QCursor cursor = widget->cursor();
- cursor.setShape(Qt::WhatsThisCursor);
- widget->setCursor(cursor);
-
- QPalette palette;
- palette.setColor(QPalette::Active, QPalette::WindowText, QColor(255, 0, 0));
- palette.setColor(QPalette::Active, QPalette::Text, QColor(255, 0, 0));
- palette.setColor(QPalette::Inactive, QPalette::WindowText, QColor(255, 0, 0));
- palette.setColor(QPalette::Inactive, QPalette::Text, QColor(255, 0, 0));
- palette.setColor(QPalette::Disabled, QPalette::WindowText, QColor(192, 128, 128));
- palette.setColor(QPalette::Disabled, QPalette::Text, QColor(192, 128, 128));
-
- widget->setPalette(palette);
-
- const std::string tip =
- format("Overridden by '%s' environment variable set to: '%s'", meta.env.c_str(), GetSettingOverride(meta).c_str());
-
- widget->setToolTip(tip.c_str());
-}
-
-int HorizontalAdvance(const QFontMetrics& fm, const QString& string) {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
- return fm.horizontalAdvance(string);
-#else
- return fm.width(string);
-#endif
-}
-
-std::string GetLabel(const SettingMeta& meta) {
- if (meta.status == STATUS_STABLE) {
- return meta.label;
- } else {
- return meta.label + " (" + GetToken(meta.status) + ")";
- }
-}
diff --git a/vkconfig/widget_setting_float.cpp b/vkconfig/widget_setting_float.cpp
deleted file mode 100644
index 2cab7e00c1..0000000000
--- a/vkconfig/widget_setting_float.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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_float.h"
-
-#include
-#include
-#include
-#include
-
-#include
-
-static const int MIN_FIELD_WIDTH = 80;
-
-WidgetSettingFloat::WidgetSettingFloat(QTreeWidget* tree, QTreeWidgetItem* item, const SettingMetaFloat& meta,
- SettingDataSet& data_set)
- : WidgetSettingBase(tree, item),
- meta(meta),
- data_set(data_set),
- field(new QLineEdit(this)),
- timer_error(new QTimer(this)),
- timer_valid(new QTimer(this)) {
- const std::string unit = meta.unit.empty() ? "" : format(" (%s)", meta.unit.c_str());
- const std::string status = meta.status == STATUS_STABLE ? "" : std::string(" (") + GetToken(this->meta.status) + ")";
-
- this->field->setFont(tree->font());
- this->field->setToolTip(format("[%f, %f]", meta.min_value, meta.max_value).c_str());
- this->field->setAlignment(Qt::AlignRight);
- this->field->show();
- this->default_palette = this->field->palette();
-
- this->connect(this->field, SIGNAL(textEdited(const QString&)), this, SLOT(OnTextEdited(const QString&)));
- this->connect(this->timer_error, &QTimer::timeout, this, &WidgetSettingFloat::OnErrorValue);
- this->connect(this->timer_valid, &QTimer::timeout, this, &WidgetSettingFloat::OnValidValue);
-
- this->item->setText(0, (this->meta.label + unit + status).c_str());
- this->item->setFont(0, this->tree->font());
- this->item->setToolTip(0, meta.description.c_str());
- this->item->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item->setExpanded(this->meta.expanded);
- this->tree->setItemWidget(this->item, 0, this);
-
- this->Refresh(REFRESH_ENABLE_AND_STATE);
-}
-
-WidgetSettingFloat::~WidgetSettingFloat() {
- this->timer_error->stop();
- this->timer_valid->stop();
-}
-
-void WidgetSettingFloat::Refresh(RefreshAreas refresh_areas) {
- const SettingDependenceMode enabled = ::CheckDependence(this->meta, data_set);
-
- this->item->setHidden(enabled == SETTING_DEPENDENCE_HIDE);
- this->item->setDisabled(enabled != SETTING_DEPENDENCE_ENABLE);
- this->field->setEnabled(enabled == SETTING_DEPENDENCE_ENABLE);
- this->setEnabled(enabled == SETTING_DEPENDENCE_ENABLE);
-
- if (refresh_areas == REFRESH_ENABLE_AND_STATE) {
- if (::CheckSettingOverridden(this->meta)) {
- this->DisplayOverride(this->field, this->meta);
- }
-
- const std::string float_format = meta.GetFloatFormat();
-
- this->field->blockSignals(true);
- this->field->setText(format(float_format.c_str(), this->data().value).c_str());
- this->field->blockSignals(false);
- }
-}
-
-void WidgetSettingFloat::resizeEvent(QResizeEvent* event) {
- this->resize = event->size();
- this->Resize();
-}
-
-void WidgetSettingFloat::OnErrorValue() {
- QPalette palette;
- palette.setColor(QPalette::Base, QColor(255, 192, 192));
- this->field->setPalette(palette);
-
- QSettings settings;
- if (settings.value("VKCONFIG_WIDGET_SETTING_FLOAT").toBool() == false) {
- const std::string float_format = this->meta.GetFloatFormat();
- const std::string info = format("Do you want to reset to the setting default value? '%s'", float_format.c_str());
- const std::string range = this->meta.HasRange()
- ? format("Enter a number in the range [%s, %s].", float_format.c_str(), float_format.c_str())
- : std::string("Enter a floating point number.");
-
- std::string text;
- switch (this->ProcessInputValue()) {
- default:
- case SETTING_INPUT_NO_ERROR: {
- assert(0);
- break;
- }
- case SETTING_INPUT_ERROR_EMPTY: {
- text = format(("'%s' value is empty. " + range).c_str(), this->meta.label.c_str(), this->meta.min_value,
- this->meta.max_value);
- break;
- }
- case SETTING_INPUT_ERROR_SYNTAX: {
- text = format(("'%s' value has invalid characters. " + range).c_str(), this->meta.label.c_str(),
- this->meta.min_value, this->meta.max_value);
- break;
- }
- case SETTING_INPUT_ERROR_SEMENTICS: {
- text = format(("'%s' value is out of range. " + range).c_str(), this->meta.label.c_str(), this->meta.min_value,
- this->meta.max_value);
- break;
- }
- }
-
- QMessageBox alert;
- alert.setWindowTitle(format("Invalid '%s' setting value", meta.label.c_str()).c_str());
- alert.setText(text.c_str());
- alert.setInformativeText(format(info.c_str(), this->meta.default_value).c_str());
- alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
- alert.setDefaultButton(QMessageBox::Yes);
- alert.setIcon(QMessageBox::Critical);
- alert.setCheckBox(new QCheckBox("Do not show again."));
- if (alert.exec() == QMessageBox::Yes) {
- const std::string field_value = format(this->meta.GetFloatFormat().c_str(), this->meta.default_value);
-
- this->data().value = this->meta.default_value;
- this->field->setText(field_value.c_str());
- this->field->setPalette(default_palette);
- this->Resize();
- }
- if (alert.checkBox()->isChecked()) {
- settings.setValue("VKCONFIG_WIDGET_SETTING_FLOAT", true);
- }
- }
-
- this->timer_error->stop();
-}
-
-void WidgetSettingFloat::OnValidValue() {
- emit itemChanged();
-
- this->timer_valid->stop();
-}
-
-void WidgetSettingFloat::Resize() {
- const QFontMetrics fm = this->field->fontMetrics();
- const int width = std::max(HorizontalAdvance(fm, this->field->text() + "00"), MIN_FIELD_WIDTH);
-
- const QRect button_rect = QRect(this->resize.width() - width, 0, width, this->resize.height());
- this->field->setGeometry(button_rect);
-}
-
-SettingInputError WidgetSettingFloat::ProcessInputValue() { return this->data().ProcessInput(this->value_buffer); }
-
-void WidgetSettingFloat::OnTextEdited(const QString& new_value) {
- this->timer_error->stop();
- this->timer_valid->stop();
-
- this->value_buffer = new_value.toStdString();
- this->Resize();
-
- if (this->ProcessInputValue() == SETTING_INPUT_NO_ERROR) {
- this->field->setPalette(default_palette);
- this->timer_valid->start(500);
- } else {
- this->timer_error->start(2000);
- }
-
- emit itemChanged();
-}
-
-SettingDataFloat& WidgetSettingFloat::data() {
- SettingDataFloat* data = FindSetting(this->data_set, this->meta.key.c_str());
- assert(data != nullptr);
- return *data;
-}
diff --git a/vkconfig/widget_setting_frames.cpp b/vkconfig/widget_setting_frames.cpp
deleted file mode 100644
index b9276dd73d..0000000000
--- a/vkconfig/widget_setting_frames.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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_frames.h"
-#include "widget_setting.h"
-
-#include "../vkconfig_core/util.h"
-
-#include
-#include
-#include
-#include
-
-#include
-
-static const int MIN_FIELD_WIDTH = 80;
-
-WidgetSettingFrames::WidgetSettingFrames(QTreeWidget* tree, QTreeWidgetItem* item, const SettingMetaFrames& meta,
- SettingDataSet& data_set)
- : WidgetSettingBase(tree, item),
- meta(meta),
- data_set(data_set),
- field(new QLineEdit(this)),
- timer_error(new QTimer(this)),
- timer_valid(new QTimer(this)) {
- this->field->setFont(tree->font());
- this->field->setToolTip("Use list of comma separated integer ranges. Example: '0-2,16'.");
- this->field->setAlignment(Qt::AlignRight);
- this->field->show();
- this->default_palette = this->field->palette();
-
- this->connect(this->field, SIGNAL(textEdited(const QString&)), this, SLOT(OnTextEdited(const QString&)));
- this->connect(this->timer_error, &QTimer::timeout, this, &WidgetSettingFrames::OnErrorValue);
- this->connect(this->timer_valid, &QTimer::timeout, this, &WidgetSettingFrames::OnValidValue);
-
- this->item->setText(0, GetLabel(this->meta).c_str());
- this->item->setFont(0, this->tree->font());
- this->item->setToolTip(0, meta.description.c_str());
- this->item->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item->setExpanded(this->meta.expanded);
- this->tree->setItemWidget(this->item, 0, this);
-
- this->Refresh(REFRESH_ENABLE_AND_STATE);
-}
-
-WidgetSettingFrames::~WidgetSettingFrames() {
- this->timer_error->stop();
- this->timer_valid->stop();
-}
-
-void WidgetSettingFrames::Refresh(RefreshAreas refresh_areas) {
- const SettingDependenceMode enabled = ::CheckDependence(this->meta, data_set);
-
- this->item->setHidden(enabled == SETTING_DEPENDENCE_HIDE);
- this->item->setDisabled(enabled != SETTING_DEPENDENCE_ENABLE);
- this->setEnabled(enabled == SETTING_DEPENDENCE_ENABLE);
- this->field->setEnabled(enabled == SETTING_DEPENDENCE_ENABLE);
-
- if (refresh_areas == REFRESH_ENABLE_AND_STATE) {
- if (::CheckSettingOverridden(this->meta)) {
- this->DisplayOverride(this->field, this->meta);
- }
-
- this->field->blockSignals(true);
- this->field->setText(this->data().GetValue());
- this->field->blockSignals(false);
- }
-}
-
-void WidgetSettingFrames::resizeEvent(QResizeEvent* event) {
- this->resize = event->size();
- this->Resize();
-}
-
-void WidgetSettingFrames::OnErrorValue() {
- QPalette palette;
- palette.setColor(QPalette::Base, QColor(255, 192, 192));
- this->field->setPalette(palette);
-
- QSettings settings;
- if (settings.value("VKCONFIG_WIDGET_SETTING_FRAMES").toBool() == false) {
- const std::string text =
- format("The setting input '%s' is invalid. Use list of comma separated integer ranges. Example: '0-2,16'.",
- this->data().GetValue());
- const std::string info =
- format("Do you want to reset to the setting default value? '%s'", this->meta.default_value.c_str());
-
- QMessageBox alert;
- alert.setWindowTitle(format("Invalid '%s' setting value", meta.label.c_str()).c_str());
- alert.setText(text.c_str());
- alert.setInformativeText(info.c_str());
- alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
- alert.setDefaultButton(QMessageBox::Yes);
- alert.setIcon(QMessageBox::Critical);
- alert.setCheckBox(new QCheckBox("Do not show again."));
- if (alert.exec() == QMessageBox::Yes) {
- this->data().SetValue(this->meta.default_value.c_str());
- this->field->setText(this->meta.default_value.c_str());
- this->field->setPalette(default_palette);
- this->Resize();
- }
- if (alert.checkBox()->isChecked()) {
- settings.setValue("VKCONFIG_WIDGET_SETTING_FRAMES", true);
- }
- }
-
- this->timer_error->stop();
-}
-
-void WidgetSettingFrames::OnValidValue() {
- emit itemChanged();
-
- this->timer_valid->stop();
-}
-
-void WidgetSettingFrames::Resize() {
- const QFontMetrics fm = this->field->fontMetrics();
- const int width = std::max(HorizontalAdvance(fm, this->field->text() + "00"), MIN_FIELD_WIDTH);
-
- const QRect button_rect = QRect(this->resize.width() - width, 0, width, this->resize.height());
- this->field->setGeometry(button_rect);
-}
-
-SettingInputError WidgetSettingFrames::ProcessInputValue() { return this->data().ProcessInput(this->value_buffer); }
-
-void WidgetSettingFrames::OnTextEdited(const QString& new_value) {
- this->timer_error->stop();
- this->timer_valid->stop();
-
- this->value_buffer = new_value.toStdString();
- this->Resize();
-
- if (this->ProcessInputValue() == SETTING_INPUT_NO_ERROR) {
- this->field->setPalette(default_palette);
- this->timer_valid->start(500);
- } else {
- this->timer_error->start(3000);
- }
-
- emit itemChanged();
-}
-
-SettingDataFrames& WidgetSettingFrames::data() {
- SettingDataFrames* data = FindSetting(this->data_set, this->meta.key.c_str());
- assert(data != nullptr);
- return *data;
-}
diff --git a/vkconfig/widget_setting_int.cpp b/vkconfig/widget_setting_int.cpp
deleted file mode 100644
index 63603d1c02..0000000000
--- a/vkconfig/widget_setting_int.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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_int.h"
-
-#include
-#include
-#include
-#include
-
-#include
-
-static const int MIN_FIELD_WIDTH = 80;
-
-WidgetSettingInt::WidgetSettingInt(QTreeWidget* tree, QTreeWidgetItem* item, const SettingMetaInt& meta, SettingDataSet& data_set)
- : WidgetSettingBase(tree, item),
- meta(meta),
- data_set(data_set),
- field(new QLineEdit(this)),
- timer_error(new QTimer(this)),
- timer_valid(new QTimer(this)) {
- const std::string unit = meta.unit.empty() ? "" : format(" (%s)", meta.unit.c_str());
- const std::string status = meta.status == STATUS_STABLE ? "" : std::string(" (") + GetToken(this->meta.status) + ")";
-
- this->field->setFont(tree->font());
- this->field->setToolTip(format("[%d, %d]", meta.min_value, meta.max_value).c_str());
- this->field->setAlignment(Qt::AlignRight);
- this->field->show();
- this->default_palette = this->field->palette();
-
- this->connect(this->field, SIGNAL(textEdited(const QString&)), this, SLOT(OnTextEdited(const QString&)));
- this->connect(this->timer_error, &QTimer::timeout, this, &WidgetSettingInt::OnErrorValue);
- this->connect(this->timer_valid, &QTimer::timeout, this, &WidgetSettingInt::OnValidValue);
-
- this->item->setText(0, (meta.label + unit + status).c_str());
- this->item->setFont(0, this->tree->font());
- this->item->setToolTip(0, meta.description.c_str());
- this->item->setSizeHint(0, QSize(0, ITEM_HEIGHT));
- this->item->setExpanded(this->meta.expanded);
- this->tree->setItemWidget(this->item, 0, this);
-
- this->Refresh(REFRESH_ENABLE_AND_STATE);
-}
-
-WidgetSettingInt::~WidgetSettingInt() {
- this->timer_error->stop();
- this->timer_valid->stop();
-}
-
-void WidgetSettingInt::Refresh(RefreshAreas refresh_areas) {
- const SettingDependenceMode enabled = ::CheckDependence(this->meta, data_set);
-
- this->item->setHidden(enabled == SETTING_DEPENDENCE_HIDE);
- this->item->setDisabled(enabled != SETTING_DEPENDENCE_ENABLE);
- this->field->setEnabled(enabled == SETTING_DEPENDENCE_ENABLE);
- this->setEnabled(enabled == SETTING_DEPENDENCE_ENABLE);
-
- if (refresh_areas == REFRESH_ENABLE_AND_STATE) {
- if (::CheckSettingOverridden(this->meta)) {
- this->DisplayOverride(this->field, this->meta);
- }
-
- this->field->blockSignals(true);
- this->field->setText(format("%d", this->data().value).c_str());
- this->field->blockSignals(false);
- }
-}
-
-void WidgetSettingInt::resizeEvent(QResizeEvent* event) {
- this->resize = event->size();
- this->Resize();
-}
-
-void WidgetSettingInt::OnErrorValue() {
- QPalette palette;
- palette.setColor(QPalette::Base, QColor(255, 192, 192));
- this->field->setPalette(palette);
-
- QSettings settings;
- if (settings.value("VKCONFIG_WIDGET_SETTING_INT").toBool() == false) {
- const std::string info = format("Do you want to reset to the setting default value? '%d'", this->meta.default_value);
- const std::string range = format("Enter a number in the range [%d, %d].", this->meta.min_value, this->meta.max_value);
-
- std::string text;
- switch (this->ProcessInputValue()) {
- default:
- case SETTING_INPUT_NO_ERROR: {
- assert(0);
- break;
- }
- case SETTING_INPUT_ERROR_EMPTY: {
- text = format("'%s' value is empty. %s", meta.label.c_str(), range.c_str());
- break;
- }
- case SETTING_INPUT_ERROR_SYNTAX: {
- text = format("'%s' value has invalid characters. %s", meta.label.c_str(), range.c_str());
- break;
- }
- case SETTING_INPUT_ERROR_SEMENTICS: {
- text = format("'%s' value is out of range. %s", meta.label.c_str(), range.c_str());
- break;
- }
- }
-
- QMessageBox alert;
- alert.setWindowTitle(format("Invalid '%s' setting value", meta.label.c_str()).c_str());
- alert.setText(text.c_str());
- alert.setInformativeText(info.c_str());
- alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
- alert.setDefaultButton(QMessageBox::Yes);
- alert.setIcon(QMessageBox::Critical);
- alert.setCheckBox(new QCheckBox("Do not show again."));
- if (alert.exec() == QMessageBox::Yes) {
- this->data().value = this->meta.default_value;
- this->field->setText(format("%d", this->meta.default_value).c_str());
- this->field->setPalette(default_palette);
- this->Resize();
- }
- if (alert.checkBox()->isChecked()) {
- settings.setValue("VKCONFIG_WIDGET_SETTING_INT", true);
- }
- }
-
- this->timer_error->stop();
-}
-
-void WidgetSettingInt::OnValidValue() {
- emit itemChanged();
-
- this->timer_valid->stop();
-}
-
-void WidgetSettingInt::Resize() {
- const QFontMetrics fm = this->field->fontMetrics();
- const int width = std::max(HorizontalAdvance(fm, this->field->text() + "00"), MIN_FIELD_WIDTH);
-
- const QRect button_rect = QRect(this->resize.width() - width, 0, width, this->resize.height());
- this->field->setGeometry(button_rect);
-}
-
-SettingInputError WidgetSettingInt::ProcessInputValue() { return this->data().ProcessInput(this->value_buffer); }
-
-void WidgetSettingInt::OnTextEdited(const QString& new_value) {
- this->timer_error->stop();
- this->timer_valid->stop();
-
- this->value_buffer = new_value.toStdString();
- this->Resize();
-
- if (this->ProcessInputValue() == SETTING_INPUT_NO_ERROR) {
- this->field->setPalette(default_palette);
- this->timer_valid->start(500);
- } else {
- this->timer_error->start(2000);
- }
-
- emit itemChanged();
-}
-
-SettingDataInt& WidgetSettingInt::data() {
- SettingDataInt* data = FindSetting(this->data_set, this->meta.key.c_str());
- assert(data != nullptr);
- return *data;
-}
diff --git a/vkconfig/widget_tree_friendly_combobox.cpp b/vkconfig/widget_tree_friendly_combobox.cpp
deleted file mode 100644
index 6e9242158b..0000000000
--- a/vkconfig/widget_tree_friendly_combobox.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#include "widget_tree_friendly_combobox.h"
-
-#include
-
-WidgetTreeFriendlyComboBox::WidgetTreeFriendlyComboBox(QTreeWidgetItem *item) : QComboBox(), item(item) {
- assert(item);
-
- setFocusPolicy(Qt::StrongFocus);
-
- connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(indexChanged(int)));
-}
-
-void WidgetTreeFriendlyComboBox::indexChanged(int index) { emit selectionMade(item, index); }
diff --git a/vkconfig/widget_tree_friendly_combobox.h b/vkconfig/widget_tree_friendly_combobox.h
deleted file mode 100644
index 2afd18c57d..0000000000
--- a/vkconfig/widget_tree_friendly_combobox.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#pragma once
-
-#include
-#include
-#include
-
-class WidgetTreeFriendlyComboBox : public QComboBox {
- Q_OBJECT
- public:
- WidgetTreeFriendlyComboBox(QTreeWidgetItem *item);
-
- void wheelEvent(QWheelEvent *e) {
- if (hasFocus()) QComboBox::wheelEvent(e);
- }
-
- public Q_SLOTS:
- void indexChanged(int nIndex);
-
- Q_SIGNALS:
- void selectionMade(QTreeWidgetItem *tree_item, int index);
-
- private:
- WidgetTreeFriendlyComboBox(const WidgetTreeFriendlyComboBox &) = delete;
- WidgetTreeFriendlyComboBox &operator=(const WidgetTreeFriendlyComboBox &) = delete;
-
- QTreeWidgetItem *item;
-};
diff --git a/vkconfig3/CHANGELOG.md b/vkconfig3/CHANGELOG.md
deleted file mode 100644
index ba55cfc8f5..0000000000
--- a/vkconfig3/CHANGELOG.md
+++ /dev/null
@@ -1,290 +0,0 @@
-
-
-Copyright � 2015-2022 LunarG, Inc.
-
-[![Creative Commons][3]][4]
-
-[3]: https://i.creativecommons.org/l/by-nd/4.0/88x31.png "Creative Commons License"
-[4]: https://creativecommons.org/licenses/by-nd/4.0/
-
-
-
-# Release notes
-
-## [Vulkan Configurator 3.0.0](https://github.com/LunarG/VulkanTools/tree/main) - ??? 202?
-
-### Features:
-- Redesign main window UI around tabs
-- Add check box to disable all Vulkan Layers
-
-## [Vulkan Configurator 2.5.6](https://github.com/LunarG/VulkanTools/tree/main) - March 2024
-
-### Fixes:
-- Fix confusing synchronization built-in configuration
-
-## [Vulkan Configurator 2.5.5](https://github.com/LunarG/VulkanTools/tree/main) - January 2024
-
-### Improvements:
-- Add `LOAD_FOLDER` setting type
-
-### Fixes:
-- Remove default settings values from built-in layer configurations
-- Fix doc generator using default environment variable names
-
-## [Vulkan Configurator 2.5.4](https://github.com/LunarG/VulkanTools/tree/sdk-1.3.250.0) - May 2023
-
-### Improvements:
-- Display `deviceUUID` and `driverUUID` in the "Development Status" when available for each physical device
-
-## [Vulkan Configurator 2.5.3](https://github.com/LunarG/VulkanTools/tree/sdk-1.3.243.0) - March 2023
-
-### Improvements:
-- Enabling fully generic layer settings for the validation layer settings
-
-## [Vulkan Configurator 2.5.2](https://github.com/LunarG/VulkanTools/tree/sdk-1.3.236.0) - December 2022
-
-### Improvements:
-- Add `warn_on_robust_oob` validation layer setting handling
-
-## [Vulkan Configurator 2.5.1](https://github.com/LunarG/VulkanTools/tree/sdk-1.3.231.0) - October 2022
-
-### Features:
-- Add ENUM setting type children settings #1746
-
-### Improvements:
-- Allow disabling the validation layer settings built-in UI #1746
-
-### Fixes:
-- Fix override layer version when some layers are excluded or missing #1743
-
-## [Vulkan Configurator 2.5.0](https://github.com/LunarG/VulkanTools/tree/sdk-1.3.224.0) - August 2022
-
-### Features:
-- Add per layers-configuration user-defined layers paths #1711
-
-### Improvements:
-- Add reordering of configurations when renaming a configuration
-- Improve handling of missing layers
-
-## [Vulkan Configurator 2.4.6](https://github.com/LunarG/VulkanTools/tree/sdk-1.3.216.0) - June 2022
-
-### Features:
-- Add `VK_KHR_portability_enumeration` extension support
-
-### Improvements:
-- Allow using multiple layers built with different Vulkan header version when Loader 212 or newer is installed on the system
-
-## [Vulkan Configurator 2.4.5](https://github.com/LunarG/VulkanTools/tree/sdk-1.3.211.0) - April 2022
-
-### Features:
-- Add `VK_ADD_LAYER_PATH` Vulkan Loader variable handling
-- Remove built-in support of `VK_LAYER_LUNARG_device_simulation` layer #1628
- - Use `VK_LAYER_KHRONOS_profiles` layer instead
-
-### Improvements:
-- Improve the Portability built-in configuration to check only what's necessary, reducing validation overhead
-- Refinement of the layers window UI design
-
-## [Vulkan Configurator 2.4.4](https://github.com/LunarG/VulkanTools/tree/sdk-1.3.204.1) - March 2022
-
-### Features:
-- Add markdown documentation export
-- Add `vk_layer_settings.txt` documentation export
-- Add command line support of HTML, markdown and `vk_layer_settings.txt` documentation exports
-
-### Improvements:
-- Add button to create a new layers configuration
-
-### Fixes:
-- Fix layer presets that could be modified by accident #1653
-- Fix loading of profiles file from the UI #1653
-
-## [Vulkan Configurator 2.4.3](https://github.com/LunarG/VulkanTools/tree/sdk-1.3.204.0) - February 2022
-
-### Improvements:
-- Upgrade the built-in "Portability" to use the Profiles layer
-- Display the development status of a setting next to the setting label in the UI
-- Display a warning when using multiple layers built with different Vulkan Header version
- - It's a requirement by the Vulkan Loader
-
-### Fixes:
-- Fix ANY dependence when using FLAGS setting type
-
-## [Vulkan Configurator 2.4.2](https://github.com/LunarG/VulkanTools/tree/sdk-1.2.196.0) - November 2021
-
-### Improvements:
-- Discard applied layers configuration to ensure the layers never crash Vulkan Configurator
-
-### Fixes:
-- Fix 'Edit Layers' button being enabled when there is no active configuration #1616
-
-## [Vulkan Configurator 2.4.1](https://github.com/LunarG/VulkanTools/tree/sdk-1.2.189.0) - September 2021
-
-### Fixes:
-- Fix user-defined layer settings not loaded, for older Vulkan API than 1.2.176
-- Fix settings written in 'vk_layer_settings.txt' even when the dependence is not met #1582
-
-## [Vulkan Configurator 2.4.0](https://github.com/LunarG/VulkanTools/tree/sdk-1.2.182.0) - July 2021
-
-### Features:
-- Add support for `VK_LAYER_SETTINGS_PATH` override for 'vk_layer_settings.txt' path
-- Add 'vk_layer_settings.txt' path in the 'Vulkan Development Status'
-- Add ${VK_LOCAL} and ${VK_APPDATA} built-in variables
-- Add 'expanded' property to layer manifest settings and flags #1497
-- Add settings environment variables checking #1498
-- Add settings tree context menu #1501
-- Add layer generated user documentation #1510
-- Add build date in the title bar
-
-### Improvements:
-- Add link to [Vulkan Guide layers](https://github.com/KhronosGroup/Vulkan-Guide/blob/main/chapters/development_tools.md#vulkan-layers) list within the help menu
-- Update built-in VUIDs to the list included in SDK 1.2.176 #1511
-- Refactor the layer window to expose more layer documentation #1519
-- Add shader caching setting to validation built-in UI #1552
-- Add indirect parameter setting to validation built-in UI #1522
-- Improve user-defined paths dialog and workflow #1523
-- Improve UI labels #1551
-
-### Fixes:
-- Fix message box with no title displayed on macOS #1547
-- Hide excluded layers in configuration that are missing, these may not be supported on the platform #1551
-- Fix crash when renaming a configuration from the layers window #1551
-- Fix validation layer bool setting written in 'vk_layer-setting.txt' #1551
-- Fix upgrade of 'vkcube' path when the path is no longer valid
-
-## [Vulkan Configurator 2.3.0](https://github.com/LunarG/VulkanTools/tree/sdk-1.2.176.0) - May 2021
-
-### Features:
-- Add Vulkan loader debug message to application launcher #1372
-- Redesigned of the full layer settings UI #1420
-
-### Improvements:
-- Add display of layer execution order in the setting tree #1390
-- Add layer settings UI inputs checking
-- Add API dump presets #1414
-- Add validation layer VUIDs loading from Vulkan Header to keep it up to date #1434
-- Improve 'High Validation Layer Overhead' warning UI
-
-### Fixes:
-- Hide 'Callback' from validation layer 'Debug Action' debug action that is NOOP
-- Fix crash when SDK path is included in 'override_paths' of 'VkLayer_override.json'
-- Fix default value of validation layer 'Check Out of Bounds #1435
-- Fix duplicate configurations #1445
-- Fix layer reordering crash #1449
-- Fix Vulkan application crash when updating the Vulkan loader
-- Fix User-Defined layer path window 'Ok' button being disabled incorrectly
-- Fix blank setting tree after using the user-defined layer path window #1377
-- Fix 'Reset To Default' than wasn't bringing back notification pop-ups
-- Fix creating a new 'Configuration' can be cancelled
-
-## [Vulkan Configurator 2.2.0](https://github.com/LunarG/VulkanTools/tree/sdk-1.2.170.0) - March 2021
-
-### Features:
-- Add *Synchronization* default configuration #1304
-- Add *Portability* default configuration on *macOS* #1307
-- Add per-configuration reset in layers configuration context menu
-- Add per-configuration reset in layers window
-- Expose `modify_extension_list` and `modify_memory_flags` settings from devsim
-
-### Improvements:
-- Add display of `VK_LAYER_PATH` content in 'Vulkan Development Status'
-- Rename 'Custom Path' by 'User-Defined Path'
-- Add extension filters to load and save file layer settings #1317
-- Improve in application documentation of settings #1332
-- Display the layer status in the 'Vulkan Development Status' #1332
-- Refresh 'Vulkan Development Status' when the configuration changed #1366
-- Streamline 'configuration tree' UI usage #1370
-- Add 'Reload Default Configuration' to retrieve missing default configurations #1370
-- Add 'reset' command line argument to reset the platform layers configurations
-- Add possible recovery by resetting to default when a crash happened during last run
-
-### Fixes:
-- Fix export and import path being truncated when the path as '.' character
-- Fix crash when loading a JSON file as if it's a JSON layer file but it's not #1330
-- Fix validation layer 'printf buffer size' setting exposed as a 'bool' instead of a 'int' #1338
-- Fix crash when using older `VK_LAYER_KHRONOS_validation` versions
-- Fix *Vulkan Info* and *Vulkan Installation Analysis* dialog no longer running with overridden layers
-- Fix preset changed causing the setting tree to be rebuild #1300
-
-## [Vulkan Configurator 2.1.0](https://github.com/LunarG/VulkanTools/tree/sdk-1.2.162.1) - January 2021
-
-### Features:
-- Refactor built-in configurations #1247
-- Add layer settings presets #1271
-- Add *Portability* default configuration on Linux and Windows #1279
-
-### Improvements:
-- In case of crash or user interruption, remove the layers override #1278
-- Improve layers support since version 1.1.130
-- Improve layer configurations compatibilities between versions
-- Add more tool tips #1296
-- Display the 'Vulkan Development Status' each time the layers paths are changed
-
-### Fixes:
-- Expose missing `VK_LAYER_LUNARG_gfxreconstruct` 'Log Detailed' setting
-
-## [Vulkan Configurator 2.0.3](https://github.com/LunarG/VulkanTools/tree/sdk-1.2.162.0) - December 2020
-
-### Features:
-- Add command line arguments to manage layers override #1213
-
-### Improvements:
-- Test with *VS2015*, *VS2017* and *VS2019*
-- Test with *Qt 5.9* and *Qt 5.15* including *QMake* build
-- Test manually using a [use cases based template](https://docs.google.com/document/d/1z0WqfMp2IBko1fvDICkjDE_3JKnf8SrU5APQTqKRR-U/edit)
-
-### Fixes:
-- Fix manual layers ordering #1214
-- Fix layers override update when changing layers management options #1225
-- Fix reset button in layers window #1227
-- Fix warning about old loader when trying to use application list #1230
-- Fix initialization of added applications on macOS #1249
-
-## [Vulkan Configurator 2.0.2](https://github.com/LunarG/VulkanTools/tree/sdk-1.2.154.0) - October 2020
-
-### Features:
-- Add multiple debug actions simultaneously #1119
-- Add better representation of the layers execution order #1181
-
-### Improvements:
-- Streamline and clean up GUI
-- Add layers configuration description #1105
-- Add selected path from dialog window cache #1107
-- Add unit test framework #1100
-- Add button to browse working directory #1099
-- Add version in the title bar and show state #1109
-- Add default settings state in the layer configuration settings #1076
-- Make *Validation - Standard*, the default configuration #1076
-- Update `vkcube` to use the version from the same *Vulkan SDK* than *Vulkan Configurator* #1112
-- Expose `duplicate_message_limit` setting from `VK_LAYER_KHRONOS_validation` #1176
-
-### Fixes:
-- Fix disabled configurations that can't be reenabled or removed
-- Fix display of custom layer paths #1101
-- Fix inconsistent display of separators in paths #1107
-- Fix display of empty entries in the custom path dialog when opening Json files that are not layer json files #1103
-- Fix log file default location to `HOME` to ensure write access #1083
-- Fix log file not written to #1109
-- Fix `debug_output` setting displayed on Linux and macOS but not available #1086
-- Fix `numeric_bool` setting display #1166
-
-## [Vulkan Configurator 2.0.1](https://github.com/LunarG/VulkanTools/tree/sdk-1.2.148.1) - August 2020 (revision 1)
-
-### Fixes:
-- Fix *Shader Printf* built-in configuration that was setup for *GPU-Assisted* validation instead
-- Fix layer configurations selection on Linux
-- Fix debug output setting not working
-
-## [Vulkan Configurator 2.0.0](https://github.com/LunarG/VulkanTools/tree/sdk-1.2.148.0) - August 2020
-
-### Features:
-- Design GUI
-- Add built-in Vulkan layers configurations
-- Add user-defined Vulkan layers configurations
-- Add import and export of Vulkan layers configuration
-- Add `VK_LAYER_KHRONOS_validation` settings presets
-- Add message filtering using VUID and message IDs
-- Add an option to make layers overriding persistent on exit
-- Add an option to override only a selected list of applications
-- Add an application launcher
-- Add startup Vulkan status
diff --git a/vkconfig3/CONTRIBUTING.md b/vkconfig3/CONTRIBUTING.md
deleted file mode 100644
index 4fbc92b651..0000000000
--- a/vkconfig3/CONTRIBUTING.md
+++ /dev/null
@@ -1,98 +0,0 @@
-# Contributing to Vulkan Configurator
-
-## Contributions Welcome
-
-The easiest method for contributing to *Vulkan Configurator* is to examine the [issues list](https://github.com/LunarG/VulkanTools/issues) and the [roadmap](https://github.com/LunarG/VulkanTools/projects/2)
-and look for areas that are of interest.
-
-Furthermore:
-- If you have your own work in mind, please open an issue to describe it and assign it to yourself.
-- If you choose to work on an issue that is assigned, simply coordinate with the current assignee.
-
---------------
-## Building Vulkan Configurator
-
-It requires *[Qt 5](https://www.qt.io/download)* to be install and *Qt* `bin` directory to be added to the `PATH` environment variable. *Vulkan Configurator* is built as part of the [VulkanTools](https://github.com/LunarG/VulkanTools/blob/main/BUILD.md) using *CMake* build system or alternatively with `vkconfig.pro` using Qt Creator.
-
---------------
-## How to run Vulkan Configurator Unit Tests
-
-When submitting a PR, the unit tests will ran automatically.
-
-However, it's trivial and more effective to run the unit tests locally with the following commands:
-
-On Windows, from the build directory:
-```
-ctest -C Debug --output-on-failure --parallel 16
-ctest -C Release --output-on-failure --parallel 16
-```
-
-On Linux and macOS, from the build directory:
-```
-ctest --output-on-failure --parallel 16
-```
-
-`--parallel` runs the unit tests on the especified number of threads.
-
-`--output-on-failure` outputs unit tests details only on failed tests.
-
---------------
-## Submitting Fixes
-
-* **Ensure that the bug was not already reported or fixed** by searching on GitHub under [Issues](https://github.com/LunarG/VulkanTools/issues) and [Pull Requests](https://github.com/LunarG/VulkanTools/pulls).
-* Use the existing GitHub forking and pull request process.
- This will involve [forking the repository](https://help.github.com/articles/fork-a-repo/),
- creating a branch with your commits, and then [submitting a pull request](https://help.github.com/articles/using-pull-requests/).
-* Please read and adhere to the style and process [guidelines ](#coding-conventions-and-formatting) enumerated below.
-* Please base your fixes on the `main` branch. SDK branches are generally not updated except for critical fixes needed to repair an SDK release.
-* The resulting Pull Request will be assigned to a repository maintainer. Once the Pull Request has been approved and is passing internal CI, a repository maintainer
- will merge the PR.
-
-### Coding Conventions and Formatting
-* Use the **[Google style guide](https://google.github.io/styleguide/cppguide.html)** for source code with the following exceptions:
- * The column limit is 132 (as opposed to the default value 80). The clang-format tool will handle this. See below.
- * The indent is 4 spaces instead of the default 2 spaces. Again, the clang-format tool will handle this.
- * If you can justify a reason for violating a rule in the guidelines, then you are free to do so. Be prepared to defend your
-decision during code review. This should be used responsibly. An example of a bad reason is "I don't like that rule." An example of
-a good reason is "This violates the style guide, but it improves type safety."
-
-* Run **clang-format** on your changes to maintain consistent formatting
- * There are `.clang-format files` present in the repository to define clang-format settings
- which are found and used automatically by clang-format.
- * A sample git workflow may look like:
-
-> # Make changes to the source.
-> $ git add -u .
-> $ git clang-format --style=file
-> # Check to see if clang-format made any changes and if they are OK.
-> $ git add -u .
-> $ git commit
-
-* **Commit Messages**
- * Limit the subject line to 50 characters -- this allows the information to display correctly in git/Github logs
- * Begin subject line with a one-word component description followed by a colon (e.g. layer/tool name, tests, etc.)
- * Separate subject from body with a blank line
- * Wrap the body at 72 characters
- * Capitalize the subject line
- * Do not end the subject line with a period
- * Use the body to explain what and why vs. how
- * Use the imperative mode in the subject line. This just means to write it as a command (e.g. Fix the sprocket)
-
-Strive for commits that implement a single or related set of functionality, using as many commits as is necessary (more is better).
-That said, please ensure that the repository compiles and passes tests without error for each commit in your pull request. Note
-that to be accepted into the repository, the pull request must [pass all tests](#testing your changes) on all supported platforms
--- the automatic Github Travis and AppVeyor continuous integration features will assist in enforcing this requirement.
-
---------------
-## Contributor License Agreement (CLA)
-
-You will be prompted with a one-time "click-through" CLA dialog as part of submitting your pull request
-or other contribution to GitHub.
-
---------------
-## License and Copyrights
-
-All contributions made to the LunarG repositories need to have the Apache 2.0 license.
-Please see an existing file in this repository for an example.
-
-You can include your individual copyright after any existing copyrights.
diff --git a/vkconfig3/configurator.cpp b/vkconfig3/configurator.cpp
deleted file mode 100644
index c1fee594e9..0000000000
--- a/vkconfig3/configurator.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * 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:
- * - Lenny Komow
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#include "configurator.h"
-#include "vulkan_util.h"
-
-#include "../vkconfig_core/util.h"
-#include "../vkconfig_core/path.h"
-#include "../vkconfig_core/override.h"
-#include "../vkconfig_core/alert.h"
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-Configurator &Configurator::Get(const std::string &VULKAN_SDK) {
- static Configurator configurator(VULKAN_SDK);
- return configurator;
-}
-
-Configurator::Configurator(const std::string &VULKAN_SDK)
- : path(VULKAN_SDK, SUPPORTED_CONFIG_FILES), environment(path), layers(environment), configurations(environment) {}
-
-Configurator::~Configurator() {
- configurations.SaveAllConfigurations(layers.selected_layers);
-
- SurrenderConfiguration(environment);
-}
-
-bool Configurator::Init() {
- this->UpdateDevices();
-
- // Load simple app settings, the additional search paths, and the
- // override app list.
- this->layers.LoadAllInstalledLayers();
-
- QSettings settings;
- if (settings.value("crashed", QVariant(false)).toBool()) {
- settings.setValue("crashed", false);
-
- if (Alert::ConfiguratorCrashed() == QMessageBox::No) {
- this->configurations.LoadAllConfigurations(this->layers.selected_layers);
- }
- } else {
- this->configurations.LoadAllConfigurations(this->layers.selected_layers);
- }
-
- if (this->configurations.Empty()) {
- this->configurations.ResetDefaultsConfigurations(layers.selected_layers);
- } else {
- this->configurations.FirstDefaultsConfigurations(layers.selected_layers);
- }
-
- this->ActivateConfiguration(this->environment.GetSelectedConfiguration());
-
- return true;
-}
-
-void Configurator::ActivateConfiguration(const std::string &configuration_name) {
- Configuration *configuration = nullptr;
- if (!configuration_name.empty()) {
- configuration = FindByKey(this->configurations.available_configurations, configuration_name.c_str());
- }
-
- if (configuration_name.empty()) {
- this->environment.SetSelectedConfiguration("");
- this->configurations.Configure(this->layers.selected_layers);
- } else if (configuration == nullptr) {
- QMessageBox alert;
- alert.QDialog::setWindowTitle("Vulkan layers configuration is missing...");
- const std::string text = format("%s couldn't find '%s' layers configuration.", VKCONFIG_NAME, configuration_name.c_str());
- alert.setText(text.c_str());
- alert.setInformativeText("Vulkan Configurator is switching to Layers Controlled by Vulkan Application mode");
- alert.setIcon(QMessageBox::Critical);
- alert.exec();
-
- this->environment.SetSelectedConfiguration("");
- this->environment.SetMode(LAYERS_MODE_BY_APPLICATIONS);
- this->configurations.Configure(this->layers.selected_layers);
- } else {
- // If the layers paths are differents, we need to reload the layers and the configurations
- const std::vector paths = this->environment.GetUserDefinedLayersPaths(USER_DEFINED_LAYERS_PATHS_GUI);
- if (configuration->user_defined_paths != paths) {
- this->configurations.SaveAllConfigurations(this->layers.selected_layers);
- this->environment.SetPerConfigUserDefinedLayersPaths(configuration->user_defined_paths);
- this->layers.LoadAllInstalledLayers();
- this->configurations.LoadAllConfigurations(this->layers.selected_layers);
- }
-
- std::string missing_layer;
- if (::HasMissingLayer(configuration->parameters, layers.selected_layers, missing_layer)) {
- QMessageBox alert;
- alert.QDialog::setWindowTitle("Vulkan layer missing...");
- alert.setText(format("%s couldn't find '%s' layer required by '%s' configuration:", VKCONFIG_NAME,
- missing_layer.c_str(), configuration->key.c_str())
- .c_str());
- alert.setIcon(QMessageBox::Critical);
- alert.exec();
- } else {
- this->configurations.Configure(this->layers.selected_layers);
- }
-
- this->environment.SetSelectedConfiguration(configuration_name.c_str());
- }
-}
-
-void Configurator::UpdateDevices() {
- QLibrary library(GetVulkanLibrary());
-
- VkInstance instance = VK_NULL_HANDLE;
- VkResult err = CreateInstance(library, instance, false);
-
- if (err != VK_SUCCESS) {
- err = CreateInstance(library, instance, true);
- if (err != VK_SUCCESS) {
- return;
- }
- }
-
- PFN_vkEnumeratePhysicalDevices pfnEnumeratePhysicalDevices =
- (PFN_vkEnumeratePhysicalDevices)library.resolve("vkEnumeratePhysicalDevices");
- PFN_vkDestroyInstance pfnDestroyInstance = (PFN_vkDestroyInstance)library.resolve("vkDestroyInstance");
- PFN_vkGetPhysicalDeviceProperties pfnGetPhysicalDeviceProperties =
- (PFN_vkGetPhysicalDeviceProperties)library.resolve("vkGetPhysicalDeviceProperties");
-
- if (pfnEnumeratePhysicalDevices == nullptr || pfnDestroyInstance == nullptr || pfnGetPhysicalDeviceProperties == nullptr) {
- return;
- }
-
- uint32_t gpu_count = 0;
- err = pfnEnumeratePhysicalDevices(instance, &gpu_count, NULL);
- assert(!err);
-
- std::vector devices;
- if (gpu_count > 0) {
- devices.resize(gpu_count);
-
- err = pfnEnumeratePhysicalDevices(instance, &gpu_count, &devices[0]);
- assert(!err);
- }
-
- this->device_names.clear();
- for (std::size_t i = 0, n = devices.size(); i < n; ++i) {
- VkPhysicalDeviceProperties properties;
- pfnGetPhysicalDeviceProperties(devices[i], &properties);
-
- this->device_names.push_back(properties.deviceName);
- }
-
- pfnDestroyInstance(instance, NULL);
-}
-
-bool Configurator::SupportLoaderSettings(Version *return_loader_version) const {
- // Check loader version
- const Version version = GetVulkanLoaderVersion();
- assert(version != Version::VERSION_NULL);
-
- if (return_loader_version) {
- *return_loader_version = version;
- }
-
- return version >= Version("1.3.261");
-}
-
-void Configurator::ResetToDefault(bool hard) {
- if (hard) {
- this->environment.Reset(Environment::CLEAR);
- this->layers.LoadAllInstalledLayers();
- this->configurations.ResetDefaultsConfigurations(this->layers.selected_layers);
-
- this->ActivateConfiguration(this->environment.GetSelectedConfiguration());
- } else {
- this->configurations.ReloadDefaultsConfigurations(this->layers.selected_layers);
- }
-}
-
-std::vector Configurator::GetDeviceNames() const { return device_names; }
diff --git a/vkconfig3/configurator.h b/vkconfig3/configurator.h
deleted file mode 100644
index 6cdc5a62d6..0000000000
--- a/vkconfig3/configurator.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#pragma once
-
-#include "../vkconfig_core/version.h"
-#include "../vkconfig_core/layer.h"
-#include "../vkconfig_core/layer_manager.h"
-#include "../vkconfig_core/path_manager.h"
-#include "../vkconfig_core/environment.h"
-#include "../vkconfig_core/configuration_manager.h"
-#include "../vkconfig_core/platform.h"
-
-static const std::vector SUPPORTED_CONFIG_FILES = {"_2_2_3"};
-
-class Configurator {
- public:
- static Configurator& Get(const std::string& VULKAN_SDK = "");
- bool Init();
-
- // The list of applications affected
- public:
- bool SupportLoaderSettings(Version* return_loader_version = nullptr) const;
-
- void ActivateConfiguration(const std::string& configuration_name);
-
- void ResetToDefault(bool hard);
-
- std::vector GetDeviceNames() const;
-
- private:
- Configurator(const std::string& VULKAN_SDK);
- ~Configurator();
-
- Configurator(const Configurator&) = delete;
- Configurator& operator=(const Configurator&) = delete;
-
- void UpdateDevices();
-
- public:
- PathManager path;
- Environment environment;
- LayerManager layers;
- ConfigurationManager configurations;
- std::vector device_names;
-};
diff --git a/vkconfig3/dialog_applications.cpp b/vkconfig3/dialog_applications.cpp
deleted file mode 100644
index 7217f61939..0000000000
--- a/vkconfig3/dialog_applications.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (c) 2020-2021 Valve Corporation
- * Copyright (c) 2020-2021 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:
- * - Richard S. Wright Jr.
- * - Christophe Riccio
- */
-
-#include "dialog_applications.h"
-#include "configurator.h"
-
-#include "../vkconfig_core/alert.h"
-
-#include
-#include
-#include
-#include
-
-#include