citra_qt: Refuse to enable debug option if the layers are not available
This commit is contained in:
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QMessageBox>
|
||||||
#include "citra_qt/configuration/configure_debug.h"
|
#include "citra_qt/configuration/configure_debug.h"
|
||||||
#include "citra_qt/debugger/console.h"
|
#include "citra_qt/debugger/console.h"
|
||||||
#include "citra_qt/uisettings.h"
|
#include "citra_qt/uisettings.h"
|
||||||
@ -11,7 +12,9 @@
|
|||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
|
#include "qcheckbox.h"
|
||||||
#include "ui_configure_debug.h"
|
#include "ui_configure_debug.h"
|
||||||
|
#include "video_core/renderer_vulkan/vk_instance.h"
|
||||||
|
|
||||||
ConfigureDebug::ConfigureDebug(QWidget* parent)
|
ConfigureDebug::ConfigureDebug(QWidget* parent)
|
||||||
: QWidget(parent), ui(std::make_unique<Ui::ConfigureDebug>()) {
|
: QWidget(parent), ui(std::make_unique<Ui::ConfigureDebug>()) {
|
||||||
@ -23,6 +26,36 @@ ConfigureDebug::ConfigureDebug(QWidget* parent)
|
|||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(ui->toggle_renderer_debug, &QCheckBox::clicked, this, [this](bool checked) {
|
||||||
|
if (checked && Settings::values.graphics_api == Settings::GraphicsAPI::Vulkan) {
|
||||||
|
try {
|
||||||
|
Vulkan::Instance debug_inst{true};
|
||||||
|
} catch (vk::LayerNotPresentError& err) {
|
||||||
|
ui->toggle_renderer_debug->toggle();
|
||||||
|
QMessageBox::warning(
|
||||||
|
this, tr("Validation layer not available"),
|
||||||
|
tr("Unable to enable debug renderer because the layer "
|
||||||
|
"<strong>VK_LAYER_KHRONOS_validation</strong> is missing. "
|
||||||
|
"Please install the Vulkan SDK or the appropriate package of your distribution"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->toggle_dump_command_buffers, &QCheckBox::clicked, this, [this](bool checked) {
|
||||||
|
if (checked && Settings::values.graphics_api == Settings::GraphicsAPI::Vulkan) {
|
||||||
|
try {
|
||||||
|
Vulkan::Instance debug_inst{false, true};
|
||||||
|
} catch (vk::LayerNotPresentError& err) {
|
||||||
|
ui->toggle_dump_command_buffers->toggle();
|
||||||
|
QMessageBox::warning(
|
||||||
|
this, tr("Command buffer dumping not available"),
|
||||||
|
tr("Unable to enable command buffer dumping because the layer "
|
||||||
|
"<strong>VK_LAYER_LUNARG_api_dump</strong> is missing. "
|
||||||
|
"Please install the Vulkan SDK or the appropriate package of your distribution"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const bool is_powered_on = Core::System::GetInstance().IsPoweredOn();
|
const bool is_powered_on = Core::System::GetInstance().IsPoweredOn();
|
||||||
ui->toggle_cpu_jit->setEnabled(!is_powered_on);
|
ui->toggle_cpu_jit->setEnabled(!is_powered_on);
|
||||||
ui->toggle_renderer_debug->setEnabled(!is_powered_on);
|
ui->toggle_renderer_debug->setEnabled(!is_powered_on);
|
||||||
|
@ -22,5 +22,6 @@ public:
|
|||||||
void RetranslateUI();
|
void RetranslateUI();
|
||||||
void SetConfiguration();
|
void SetConfiguration();
|
||||||
|
|
||||||
|
private:
|
||||||
std::unique_ptr<Ui::ConfigureDebug> ui;
|
std::unique_ptr<Ui::ConfigureDebug> ui;
|
||||||
};
|
};
|
||||||
|
@ -40,7 +40,7 @@ vk::Format ToVkFormat(VideoCore::PixelFormat format) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Instance::Instance() {
|
Instance::Instance(bool validation, bool dump_command_buffers) {
|
||||||
// Fetch instance independant function pointers
|
// Fetch instance independant function pointers
|
||||||
auto vkGetInstanceProcAddr =
|
auto vkGetInstanceProcAddr =
|
||||||
dl.getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
|
dl.getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
|
||||||
@ -52,7 +52,19 @@ Instance::Instance() {
|
|||||||
.engineVersion = VK_MAKE_VERSION(1, 0, 0),
|
.engineVersion = VK_MAKE_VERSION(1, 0, 0),
|
||||||
.apiVersion = VK_API_VERSION_1_0};
|
.apiVersion = VK_API_VERSION_1_0};
|
||||||
|
|
||||||
const vk::InstanceCreateInfo instance_info = {.pApplicationInfo = &application_info};
|
u32 layer_count = 0;
|
||||||
|
std::array<const char*, 2> layers;
|
||||||
|
|
||||||
|
if (validation) {
|
||||||
|
layers[layer_count++] = "VK_LAYER_KHRONOS_validation";
|
||||||
|
}
|
||||||
|
if (dump_command_buffers) {
|
||||||
|
layers[layer_count++] = "VK_LAYER_LUNARG_api_dump";
|
||||||
|
}
|
||||||
|
|
||||||
|
const vk::InstanceCreateInfo instance_info = {.pApplicationInfo = &application_info,
|
||||||
|
.enabledLayerCount = layer_count,
|
||||||
|
.ppEnabledLayerNames = layers.data()};
|
||||||
|
|
||||||
instance = vk::createInstance(instance_info);
|
instance = vk::createInstance(instance_info);
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ struct FormatTraits {
|
|||||||
/// The global Vulkan instance
|
/// The global Vulkan instance
|
||||||
class Instance {
|
class Instance {
|
||||||
public:
|
public:
|
||||||
Instance(); ///< Portable constructor used to query physical devices
|
Instance(bool validation = false, bool dump_command_buffers = false);
|
||||||
Instance(Frontend::EmuWindow& window, u32 physical_device_index);
|
Instance(Frontend::EmuWindow& window, u32 physical_device_index);
|
||||||
~Instance();
|
~Instance();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user