Skip to content

Commit

Permalink
vkconfig3: Don't allow implicit layer forced on
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe-lunarg committed Sep 26, 2024
1 parent 3b1a13a commit 8b5c70d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions vkconfig_core/alert.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct Alert {

static void LayerInvalid(const Path& path, const char* message);
static QMessageBox::Button LayerImplicit(const char* layer_name);

static QMessageBox::Button LayerProfiles();

static void PathInvalid(const Path& path, const char* message);
Expand Down
1 change: 1 addition & 0 deletions vkconfig_core/test/test_parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,3 +452,4 @@ TEST(test_parameter, OrderParameter_ImplicitLayer) {
EXPECT_STREQ(parameters[2].key.c_str(), "Layer E0");
EXPECT_STREQ(parameters[3].key.c_str(), "Layer I0");
}
*/
2 changes: 1 addition & 1 deletion vkconfig_core/type_layer_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
const char* GetToken(LayerControl control) {
static const char* TOKENS[] = {
"Auto", // LAYER_CONTROL_AUTO
"On", // LAYER_CONTROL_ON
"Off", // LAYER_CONTROL_OFF
"On", // LAYER_CONTROL_ON
"application_enabled_layers", // LAYER_CONTROL_APPLICATIONS
"unordered_layer_location" // LAYER_CONTROL_UNORDERED
};
Expand Down
9 changes: 6 additions & 3 deletions vkconfig_core/type_layer_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@

enum LayerControl {
LAYER_CONTROL_AUTO = 0,
LAYER_CONTROL_ON,
LAYER_CONTROL_OFF,
LAYER_CONTROL_ON,
LAYER_CONTROL_APPLICATIONS_API,
LAYER_CONTROL_APPLICATIONS_ENV,

LAYER_CONTROL_FIRST = LAYER_CONTROL_AUTO,
LAYER_CONTROL_LAST = LAYER_CONTROL_APPLICATIONS_ENV,

LAYER_CONTROL_UI_FIRST = LAYER_CONTROL_AUTO,
LAYER_CONTROL_UI_LAST = LAYER_CONTROL_OFF
LAYER_CONTROL_EXPLICIT_FIRST = LAYER_CONTROL_AUTO,
LAYER_CONTROL_EXPLICIT_LAST = LAYER_CONTROL_ON,

LAYER_CONTROL_IMPLICIT_FIRST = LAYER_CONTROL_AUTO,
LAYER_CONTROL_IMPLICIT_LAST = LAYER_CONTROL_OFF
};

enum { LAYER_CONTROL_COUNT = LAYER_CONTROL_LAST - LAYER_CONTROL_FIRST + 1 };
Expand Down
12 changes: 10 additions & 2 deletions vkconfig_gui/widget_tab_configurations_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,16 @@ ConfigurationLayerWidget::ConfigurationLayerWidget(TabConfigurations *tab, const
// this->layer_version->installEventFilter(this);

this->layer_state = new QComboBox(this);
for (int i = LAYER_CONTROL_UI_FIRST; i <= LAYER_CONTROL_UI_LAST; ++i) {
this->layer_state->addItem(GetToken(static_cast<LayerControl>(i)));
if (layer != nullptr) {
if (layer->type == LAYER_TYPE_EXPLICIT) {
for (int i = LAYER_CONTROL_EXPLICIT_FIRST; i <= LAYER_CONTROL_EXPLICIT_LAST; ++i) {
this->layer_state->addItem(GetToken(static_cast<LayerControl>(i)));
}
} else {
for (int i = LAYER_CONTROL_IMPLICIT_FIRST; i <= LAYER_CONTROL_IMPLICIT_LAST; ++i) {
this->layer_state->addItem(GetToken(static_cast<LayerControl>(i)));
}
}
}
this->layer_state->setEnabled(!layer_versions.empty());
this->layer_state->setCurrentIndex(parameter.control);
Expand Down

0 comments on commit 8b5c70d

Please sign in to comment.