Skip to content

Commit

Permalink
vkconfig: Notify risk when overriding implicit layer
Browse files Browse the repository at this point in the history
Change-Id: I6d271cbe3c8e825415713905b91531c0bcb82e32
  • Loading branch information
christophe-lunarg committed Sep 25, 2024
1 parent a24a94a commit 10d858b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions vkconfig/dialog_layers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ void LayersDialog::AddLayerItem(const Parameter &parameter) {
} 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;
if (parameter.state == LAYER_STATE_EXCLUDED) {
return;
}

decorated_name += " (Missing)";
}
Expand Down Expand Up @@ -600,13 +602,13 @@ void LayersDialog::layerUseChanged(QTreeWidgetItem *item, int selection) {
if (Alert::LayerProfiles() == QMessageBox::Yes) {
OverrideAllExplicitLayers();
}
} else if (layer_state == LAYER_STATE_EXCLUDED) {
} else if (layer_state != LAYER_STATE_APPLICATION_CONTROLLED) {
const std::vector<Layer> &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) {
if (Alert::LayerImplicit(tree_layer_item->layer_name.c_str()) == QMessageBox::No) {
layer_state = LAYER_STATE_APPLICATION_CONTROLLED;
}
}
Expand Down
8 changes: 4 additions & 4 deletions vkconfig_core/alert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ void Alert::PathInvalid(const char* path, const char* message) {
alert.exec();
}

QMessageBox::Button Alert::LayerImplicitExcluded(const char* layer_name) {
const char* text = "%s was excluded but it is an implicit layer. This may cause undefined behavior, including crashes.";
QMessageBox::Button Alert::LayerImplicit(const char* layer_name) {
const char* text = "%s was overridden but it is an implicit layer. This may cause undefined behavior, including crashes.";

QMessageBox alert;
alert.QDialog::setWindowTitle("Implicit layer excluded...");
alert.QDialog::setWindowTitle("Implicit layer was overridden...");
alert.setText(format(text, layer_name).c_str());
alert.setInformativeText("Do you want to continue?");
alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
alert.setIcon(QMessageBox::Warning);
alert.setIcon(QMessageBox::Critical);
return static_cast<QMessageBox::Button>(alert.exec());
}

Expand Down
2 changes: 1 addition & 1 deletion vkconfig_core/alert.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct Alert {
static void ApplicationListEmpty();

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

static void PathInvalid(const char* path, const char* message);
Expand Down

0 comments on commit 10d858b

Please sign in to comment.