build: Add flags to toggle specific renderer backends. (#7375)

This commit is contained in:
Steveice10
2024-01-21 23:29:46 -08:00
committed by GitHub
parent 77fce3cf82
commit 82294425e3
18 changed files with 443 additions and 211 deletions

View File

@@ -13,7 +13,9 @@
#include "common/logging/backend.h"
#include "common/settings.h"
#include "ui_configure_debug.h"
#ifdef ENABLE_VULKAN
#include "video_core/renderer_vulkan/vk_instance.h"
#endif
// The QSlider doesn't have an easy way to set a custom step amount,
// so we can just convert from the sliders range (0 - 79) to the expected
@@ -36,6 +38,7 @@ ConfigureDebug::ConfigureDebug(bool is_powered_on_, QWidget* parent)
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
});
#ifdef ENABLE_VULKAN
connect(ui->toggle_renderer_debug, &QCheckBox::clicked, this, [this](bool checked) {
if (checked && Settings::values.graphics_api.GetValue() == Settings::GraphicsAPI::Vulkan) {
try {
@@ -65,6 +68,7 @@ ConfigureDebug::ConfigureDebug(bool is_powered_on_, QWidget* parent)
}
}
});
#endif
ui->toggle_cpu_jit->setEnabled(!is_powered_on);
ui->toggle_renderer_debug->setEnabled(!is_powered_on);

View File

@@ -7,7 +7,9 @@
#include "citra_qt/configuration/configure_enhancements.h"
#include "common/settings.h"
#include "ui_configure_enhancements.h"
#ifdef ENABLE_OPENGL
#include "video_core/renderer_opengl/post_processing_opengl.h"
#endif
ConfigureEnhancements::ConfigureEnhancements(QWidget* parent)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureEnhancements>()) {
@@ -117,12 +119,14 @@ void ConfigureEnhancements::updateShaders(Settings::StereoRenderOption stereo_op
ui->shader_combobox->setCurrentIndex(0);
#ifdef ENABLE_OPENGL
for (const auto& shader : OpenGL::GetPostProcessingShaderList(
stereo_option == Settings::StereoRenderOption::Anaglyph)) {
ui->shader_combobox->addItem(QString::fromStdString(shader));
if (current_shader == shader)
ui->shader_combobox->setCurrentIndex(ui->shader_combobox->count() - 1);
}
#endif
}
void ConfigureEnhancements::RetranslateUI() {

View File

@@ -3,11 +3,14 @@
// Refer to the license.txt file included.
#include <QColorDialog>
#include <QStandardItemModel>
#include "citra_qt/configuration/configuration_shared.h"
#include "citra_qt/configuration/configure_graphics.h"
#include "common/settings.h"
#include "ui_configure_graphics.h"
#ifdef ENABLE_VULKAN
#include "video_core/renderer_vulkan/vk_instance.h"
#endif
ConfigureGraphics::ConfigureGraphics(std::span<const QString> physical_devices, bool is_powered_on,
QWidget* parent)
@@ -27,12 +30,32 @@ ConfigureGraphics::ConfigureGraphics(std::span<const QString> physical_devices,
// Set the index to -1 to ensure the below lambda is called with setCurrentIndex
ui->graphics_api_combo->setCurrentIndex(-1);
auto graphics_api_combo_model =
qobject_cast<QStandardItemModel*>(ui->graphics_api_combo->model());
#ifndef ENABLE_SOFTWARE_RENDERER
const auto software_item =
graphics_api_combo_model->item(static_cast<u32>(Settings::GraphicsAPI::Software));
software_item->setFlags(software_item->flags() & ~Qt::ItemIsEnabled);
#endif
#ifndef ENABLE_OPENGL
const auto opengl_item =
graphics_api_combo_model->item(static_cast<u32>(Settings::GraphicsAPI::OpenGL));
opengl_item->setFlags(opengl_item->flags() & ~Qt::ItemIsEnabled);
#endif
#ifndef ENABLE_VULKAN
const auto vulkan_item =
graphics_api_combo_model->item(static_cast<u32>(Settings::GraphicsAPI::Vulkan));
vulkan_item->setFlags(vulkan_item->flags() & ~Qt::ItemIsEnabled);
#else
if (physical_devices.empty()) {
const u32 index = static_cast<u32>(Settings::GraphicsAPI::Vulkan);
ui->graphics_api_combo->removeItem(index);
const auto vulkan_item =
graphics_api_combo_model->item(static_cast<u32>(Settings::GraphicsAPI::Vulkan));
vulkan_item->setFlags(vulkan_item->flags() & ~Qt::ItemIsEnabled);
ui->physical_device_combo->setVisible(false);
ui->spirv_shader_gen->setVisible(false);
}
#endif
connect(ui->graphics_api_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
[this](int index) {