Skip to content

Commit 7a06694

Browse files
vkconfig: Add setting debug view
1 parent e1218d0 commit 7a06694

13 files changed

Lines changed: 116 additions & 68 deletions

vkconfig_core/configurator.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ std::string Configurator::Log() const {
745745
}
746746

747747
log += format(" - Use system tray: %s\n", this->use_system_tray ? "true" : "false");
748-
log += format(" - Use layer developer mode: %s\n", this->use_layer_dev_mode ? "true" : "false");
748+
log += format(" - Use layer developer mode: %s\n", this->use_layer_debug_mode ? "true" : "false");
749749
log += format(" - ${VULKAN_BIN}: %s\n", ::Path(Path::BIN).AbsolutePath().c_str());
750750
log += format(" - ${VULKAN_PROFILES}: %s\n", ::Path(Path::PROFILES).AbsolutePath().c_str());
751751
log += format(" - ${VULKAN_HOME}: %s\n", ::Path(Path::HOME).AbsolutePath().c_str());
@@ -971,8 +971,8 @@ bool Configurator::Load() {
971971
if (json_interface_object.value(GetToken(TAB_PREFERENCES)) != QJsonValue::Undefined) {
972972
const QJsonObject& json_object = json_interface_object.value(GetToken(TAB_PREFERENCES)).toObject();
973973

974-
if (json_object.value("use_layer_dev_mode") != QJsonValue::Undefined) {
975-
this->use_layer_dev_mode = json_object.value("use_layer_dev_mode").toBool();
974+
if (json_object.value("use_layer_debug_mode") != QJsonValue::Undefined) {
975+
this->use_layer_debug_mode = json_object.value("use_layer_debug_mode").toBool();
976976
}
977977

978978
if (json_object.value("use_notify_releases") != QJsonValue::Undefined) {
@@ -1053,7 +1053,7 @@ bool Configurator::Save() const {
10531053
{
10541054
QJsonObject json_object;
10551055
json_object.insert("use_system_tray", this->use_system_tray);
1056-
json_object.insert("use_layer_dev_mode", this->use_layer_dev_mode);
1056+
json_object.insert("use_layer_debug_mode", this->use_layer_debug_mode);
10571057
json_object.insert("use_notify_releases", this->use_notify_releases);
10581058
json_object.insert("latest_sdk_version", this->latest_sdk_version.str().c_str());
10591059
json_object.insert("last_vkconfig_version", Version::VKCONFIG.str().c_str());
@@ -1122,9 +1122,9 @@ bool Configurator::GetUseSystemTray() const { return this->use_system_tray; }
11221122

11231123
void Configurator::SetUseSystemTray(bool enabled) { this->use_system_tray = enabled; }
11241124

1125-
bool Configurator::GetUseLayerDevMode() const { return this->use_layer_dev_mode; }
1125+
bool Configurator::GetUseLayerDebugMode() const { return this->use_layer_debug_mode; }
11261126

1127-
void Configurator::SetUseLayerDevMode(bool enabled) { this->use_layer_dev_mode = enabled; }
1127+
void Configurator::SetUseLayerDebugMode(bool enabled) { this->use_layer_debug_mode = enabled; }
11281128

11291129
bool Configurator::GetUseNotifyReleases() const { return this->use_notify_releases; }
11301130

vkconfig_core/configurator.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ class Configurator {
109109
bool GetUseSystemTray() const;
110110
void SetUseSystemTray(bool enabled);
111111

112-
bool GetUseLayerDevMode() const;
113-
void SetUseLayerDevMode(bool enabled);
112+
bool GetUseLayerDebugMode() const;
113+
void SetUseLayerDebugMode(bool enabled);
114114

115115
bool GetUseNotifyReleases() const;
116116
void SetUseNotifyReleases(bool enabled);
@@ -163,7 +163,7 @@ class Configurator {
163163
private:
164164
int hide_message_boxes_flags = 0;
165165
bool use_system_tray = false;
166-
bool use_layer_dev_mode = false;
166+
bool use_layer_debug_mode = false;
167167
bool use_notify_releases = true;
168168
bool show_external_layers_settings = true;
169169
ExecutableScope executable_scope = EXECUTABLE_ANY;

vkconfig_core/header.cpp

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2020-2021 Valve Corporation
3-
* Copyright (c) 2020-2021 LunarG, Inc.
2+
* Copyright (c) 2020-2025 Valve Corporation
3+
* Copyright (c) 2020-2025 LunarG, Inc.
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -19,37 +19,8 @@
1919
*/
2020

2121
#include "header.h"
22-
#include "util.h"
2322
#include "json.h"
2423

25-
#include <cassert>
26-
27-
SettingView GetSettingView(const char* token) {
28-
assert(token != nullptr);
29-
assert(std::strcmp(token, "") != 0);
30-
31-
for (int i = SETTING_VIEW_FIRST; i <= SETTING_VIEW_LAST; ++i) {
32-
const SettingView state = static_cast<SettingView>(i);
33-
if (ToUpperCase(token) == GetToken(state)) return state;
34-
}
35-
36-
assert(0); // Unknown token
37-
return static_cast<SettingView>(-1);
38-
}
39-
40-
const char* GetToken(SettingView state) {
41-
assert(state >= SETTING_VIEW_FIRST && state <= SETTING_VIEW_LAST);
42-
43-
static const char* table[] = {
44-
"STANDARD", // SETTING_VIEW_STANDARD
45-
"ADVANCED", // SETTING_VIEW_ADVANCED
46-
"HIDDEN", // SETTING_VIEW_HIDDEN
47-
};
48-
static_assert(std::size(table) == SETTING_VIEW_COUNT, "The tranlation table size doesn't match the enum number of elements");
49-
50-
return table[state];
51-
}
52-
5324
void LoadMetaHeader(Header& header, const QJsonObject& json_object) {
5425
header.label = ReadStringValue(json_object, "label");
5526
header.description = ReadStringValue(json_object, "description");

vkconfig_core/header.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,12 @@
2222

2323
#include "type_platform.h"
2424
#include "type_status.h"
25+
#include "type_view.h"
2526
#include "json.h"
2627
#include "path.h"
2728

2829
#include <string>
2930

30-
enum SettingView {
31-
SETTING_VIEW_STANDARD = 0,
32-
SETTING_VIEW_ADVANCED,
33-
SETTING_VIEW_HIDDEN,
34-
35-
SETTING_VIEW_FIRST = SETTING_VIEW_STANDARD,
36-
SETTING_VIEW_LAST = SETTING_VIEW_HIDDEN
37-
};
38-
39-
enum { SETTING_VIEW_COUNT = SETTING_VIEW_LAST - SETTING_VIEW_FIRST + 1 };
40-
41-
SettingView GetSettingView(const char* token);
42-
const char* GetToken(SettingView state);
43-
4431
struct Header {
4532
Header() : status(STATUS_STABLE), view(SETTING_VIEW_STANDARD), platform_flags(PLATFORM_DESKTOP_BIT), expanded(true) {}
4633

vkconfig_core/test/test_header.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2020-2021 Valve Corporation
3-
* Copyright (c) 2020-2021 LunarG, Inc.
2+
* Copyright (c) 2020-2025 Valve Corporation
3+
* Copyright (c) 2020-2025 LunarG, Inc.
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -36,3 +36,5 @@ TEST(test_header, get_setting_state_advanced) {
3636
EXPECT_EQ(SETTING_VIEW_ADVANCED, GetSettingView("ADVANCED"));
3737
EXPECT_STREQ("ADVANCED", GetToken(SETTING_VIEW_ADVANCED));
3838
}
39+
40+
TEST(test_header, get_setting_state_unknown) { EXPECT_EQ(SETTING_VIEW_STANDARD, GetSettingView("UNKNOWN")); }

vkconfig_core/type_status.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const char* GetToken(StatusType value) {
2828
"STABLE", // STATUS_STABLE
2929
"BETA", // STATUS_BETA
3030
"ALPHA", // STATUS_ALPHA
31-
"DEPRECATED" // STATUS_ALPHA
31+
"DEPRECATED" // STATUS_DEPRECATED
3232
};
3333
static_assert(std::size(TOKENS) == STATUS_COUNT, "The tranlation table size doesn't match the enum number of elements");
3434

@@ -47,5 +47,5 @@ StatusType GetStatusType(const char* token) {
4747
}
4848
}
4949

50-
return STATUS_INVALID;
50+
return STATUS_STABLE;
5151
}

vkconfig_core/type_status.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ enum StatusType {
2727
STATUS_DEPRECATED,
2828

2929
STATUS_FIRST = STATUS_STABLE,
30-
STATUS_LAST = STATUS_DEPRECATED,
31-
32-
STATUS_INVALID
30+
STATUS_LAST = STATUS_DEPRECATED
3331
};
3432

3533
enum { STATUS_COUNT = STATUS_LAST - STATUS_FIRST + 1 };

vkconfig_core/type_view.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2020-2025 Valve Corporation
3+
* Copyright (c) 2020-2025 LunarG, Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
* Authors:
18+
* - Christophe Riccio <christophe@lunarg.com>
19+
*/
20+
21+
#include "type_view.h"
22+
#include "util.h"
23+
24+
#include <cassert>
25+
26+
SettingView GetSettingView(const char* token) {
27+
assert(token != nullptr);
28+
assert(std::strcmp(token, "") != 0);
29+
30+
for (int i = SETTING_VIEW_FIRST; i <= SETTING_VIEW_LAST; ++i) {
31+
const SettingView state = static_cast<SettingView>(i);
32+
if (ToUpperCase(token) == GetToken(state)) {
33+
return state;
34+
}
35+
}
36+
37+
return SETTING_VIEW_STANDARD; // Unknown token
38+
}
39+
40+
const char* GetToken(SettingView state) {
41+
assert(state >= SETTING_VIEW_FIRST && state <= SETTING_VIEW_LAST);
42+
43+
static const char* table[] = {
44+
"STANDARD", // SETTING_VIEW_STANDARD
45+
"ADVANCED", // SETTING_VIEW_ADVANCED
46+
"DEBUG", // SETTING_VIEW_DEBUG
47+
"HIDDEN", // SETTING_VIEW_HIDDEN
48+
};
49+
static_assert(std::size(table) == SETTING_VIEW_COUNT);
50+
51+
return table[state];
52+
}

vkconfig_core/type_view.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2020-2025 Valve Corporation
3+
* Copyright (c) 2020-2025 LunarG, Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
* Authors:
18+
* - Christophe Riccio <christophe@lunarg.com>
19+
*/
20+
21+
#pragma once
22+
23+
enum SettingView {
24+
SETTING_VIEW_STANDARD = 0,
25+
SETTING_VIEW_ADVANCED, // Deprecated in favor of SETTING_VIEW_DEBUG
26+
SETTING_VIEW_DEBUG,
27+
SETTING_VIEW_HIDDEN,
28+
29+
SETTING_VIEW_FIRST = SETTING_VIEW_STANDARD,
30+
SETTING_VIEW_LAST = SETTING_VIEW_HIDDEN
31+
};
32+
33+
enum { SETTING_VIEW_COUNT = SETTING_VIEW_LAST - SETTING_VIEW_FIRST + 1 };
34+
35+
SettingView GetSettingView(const char* token);
36+
const char* GetToken(SettingView state);

vkconfig_gui/settings_tree.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void SettingsTreeManager::CreateGUI() {
157157
if (!IsPlatformSupported(layer_preset.platform_flags)) {
158158
continue;
159159
}
160-
if (configurator.GetUseLayerDevMode()) {
160+
if (configurator.GetUseLayerDebugMode()) {
161161
if (layer_preset.view == SETTING_VIEW_HIDDEN) {
162162
continue;
163163
}
@@ -250,7 +250,7 @@ void SettingsTreeManager::BuildTreeItem(QTreeWidgetItem *parent, const SettingMe
250250
}
251251

252252
Configurator &configurator = Configurator::Get();
253-
if (configurator.GetUseLayerDevMode()) {
253+
if (configurator.GetUseLayerDebugMode()) {
254254
if (meta_object.view == SETTING_VIEW_HIDDEN) {
255255
return;
256256
}
@@ -338,7 +338,7 @@ void SettingsTreeManager::BuildTreeItem(QTreeWidgetItem *parent, const SettingMe
338338
continue;
339339
}
340340

341-
if (configurator.GetUseLayerDevMode()) {
341+
if (configurator.GetUseLayerDebugMode()) {
342342
if (value.view == SETTING_VIEW_HIDDEN) {
343343
return;
344344
}
@@ -367,7 +367,7 @@ void SettingsTreeManager::BuildTreeItem(QTreeWidgetItem *parent, const SettingMe
367367
continue;
368368
}
369369

370-
if (configurator.GetUseLayerDevMode()) {
370+
if (configurator.GetUseLayerDebugMode()) {
371371
if (value.view == SETTING_VIEW_HIDDEN) {
372372
return;
373373
}

0 commit comments

Comments
 (0)