qt: Display OpenGL renderer name and add Mesa override to support Windows OpenGLOn12. (#7395)

This commit is contained in:
Steveice10
2024-01-29 12:24:41 -08:00
committed by GitHub
parent 7a4854c519
commit 469f76b075
12 changed files with 116 additions and 38 deletions

View File

@@ -23,14 +23,16 @@
#include "ui_configure.h"
ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_, Core::System& system_,
std::span<const QString> physical_devices, bool enable_web_config)
QString gl_renderer, std::span<const QString> physical_devices,
bool enable_web_config)
: QDialog(parent), ui{std::make_unique<Ui::ConfigureDialog>()}, registry{registry_},
system{system_}, is_powered_on{system.IsPoweredOn()},
general_tab{std::make_unique<ConfigureGeneral>(this)},
system_tab{std::make_unique<ConfigureSystem>(system, this)},
input_tab{std::make_unique<ConfigureInput>(this)},
hotkeys_tab{std::make_unique<ConfigureHotkeys>(this)},
graphics_tab{std::make_unique<ConfigureGraphics>(physical_devices, is_powered_on, this)},
graphics_tab{
std::make_unique<ConfigureGraphics>(gl_renderer, physical_devices, is_powered_on, this)},
enhancements_tab{std::make_unique<ConfigureEnhancements>(this)},
audio_tab{std::make_unique<ConfigureAudio>(is_powered_on, this)},
camera_tab{std::make_unique<ConfigureCamera>(this)},

View File

@@ -37,7 +37,7 @@ class ConfigureDialog : public QDialog {
public:
explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, Core::System& system,
std::span<const QString> physical_devices,
QString gl_renderer, std::span<const QString> physical_devices,
bool enable_web_config = true);
~ConfigureDialog() override;

View File

@@ -12,17 +12,13 @@
#include "video_core/renderer_vulkan/vk_instance.h"
#endif
ConfigureGraphics::ConfigureGraphics(std::span<const QString> physical_devices, bool is_powered_on,
QWidget* parent)
ConfigureGraphics::ConfigureGraphics(QString gl_renderer, std::span<const QString> physical_devices,
bool is_powered_on, QWidget* parent)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureGraphics>()) {
ui->setupUi(this);
SetupPerGameUI();
for (const QString& name : physical_devices) {
ui->physical_device_combo->addItem(name);
}
ui->graphics_api_combo->setEnabled(!is_powered_on);
ui->physical_device_combo->setEnabled(!is_powered_on);
ui->toggle_async_shaders->setEnabled(!is_powered_on);
@@ -37,11 +33,15 @@ ConfigureGraphics::ConfigureGraphics(std::span<const QString> physical_devices,
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);
#else
ui->opengl_renderer_name_label->setText(gl_renderer);
#endif
#ifndef ENABLE_VULKAN
const auto vulkan_item =
graphics_api_combo_model->item(static_cast<u32>(Settings::GraphicsAPI::Vulkan));
@@ -54,6 +54,10 @@ ConfigureGraphics::ConfigureGraphics(std::span<const QString> physical_devices,
ui->physical_device_combo->setVisible(false);
ui->spirv_shader_gen->setVisible(false);
} else {
for (const QString& name : physical_devices) {
ui->physical_device_combo->addItem(name);
}
}
#endif
@@ -202,24 +206,24 @@ void ConfigureGraphics::SetupPerGameUI() {
}
void ConfigureGraphics::SetPhysicalDeviceComboVisibility(int index) {
bool is_visible{};
Settings::GraphicsAPI effective_api{};
// When configuring per-game the physical device combo should be
// shown either when the global api is used and that is Vulkan or
// Vulkan is set as the per-game api.
if (!Settings::IsConfiguringGlobal()) {
const auto global_graphics_api = Settings::values.graphics_api.GetValue(true);
const bool using_global = index == 0;
if (!using_global) {
index -= ConfigurationShared::USE_GLOBAL_OFFSET;
if (using_global) {
effective_api = Settings::values.graphics_api.GetValue(true);
} else {
effective_api =
static_cast<Settings::GraphicsAPI>(index - ConfigurationShared::USE_GLOBAL_OFFSET);
}
const auto graphics_api = static_cast<Settings::GraphicsAPI>(index);
is_visible = (using_global && global_graphics_api == Settings::GraphicsAPI::Vulkan) ||
graphics_api == Settings::GraphicsAPI::Vulkan;
} else {
const auto graphics_api = static_cast<Settings::GraphicsAPI>(index);
is_visible = graphics_api == Settings::GraphicsAPI::Vulkan;
effective_api = static_cast<Settings::GraphicsAPI>(index);
}
ui->physical_device_group->setVisible(is_visible);
ui->spirv_shader_gen->setVisible(is_visible);
ui->physical_device_group->setVisible(effective_api == Settings::GraphicsAPI::Vulkan);
ui->spirv_shader_gen->setVisible(effective_api == Settings::GraphicsAPI::Vulkan);
ui->opengl_renderer_group->setVisible(effective_api == Settings::GraphicsAPI::OpenGL);
}

View File

@@ -21,8 +21,8 @@ class ConfigureGraphics : public QWidget {
Q_OBJECT
public:
explicit ConfigureGraphics(std::span<const QString> physical_devices, bool is_powered_on,
QWidget* parent = nullptr);
explicit ConfigureGraphics(QString gl_renderer, std::span<const QString> physical_devices,
bool is_powered_on, QWidget* parent = nullptr);
~ConfigureGraphics() override;
void ApplyConfiguration();

View File

@@ -101,6 +101,34 @@
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="opengl_renderer_group" native="true">
<layout class="QHBoxLayout" name="opengl_renderer_group_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="opengl_renderer_label">
<property name="text">
<string>OpenGL Renderer</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="opengl_renderer_name_label"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="spirv_shader_gen">
<property name="text">

View File

@@ -24,7 +24,8 @@
#include "ui_configure_per_game.h"
ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const QString& file_name,
std::span<const QString> physical_devices, Core::System& system_)
QString gl_renderer, std::span<const QString> physical_devices,
Core::System& system_)
: QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()),
filename{file_name.toStdString()}, title_id{title_id_}, system{system_} {
const auto config_file_name = title_id == 0 ? std::string(FileUtil::GetFilename(filename))
@@ -35,7 +36,8 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const QString
audio_tab = std::make_unique<ConfigureAudio>(is_powered_on, this);
general_tab = std::make_unique<ConfigureGeneral>(this);
enhancements_tab = std::make_unique<ConfigureEnhancements>(this);
graphics_tab = std::make_unique<ConfigureGraphics>(physical_devices, is_powered_on, this);
graphics_tab =
std::make_unique<ConfigureGraphics>(gl_renderer, physical_devices, is_powered_on, this);
system_tab = std::make_unique<ConfigureSystem>(system, this);
debug_tab = std::make_unique<ConfigureDebug>(is_powered_on, this);
cheat_tab = std::make_unique<ConfigureCheats>(system.CheatEngine(), title_id, this);

View File

@@ -38,7 +38,8 @@ class ConfigurePerGame : public QDialog {
public:
explicit ConfigurePerGame(QWidget* parent, u64 title_id_, const QString& file_name,
std::span<const QString> physical_devices, Core::System& system_);
QString gl_renderer, std::span<const QString> physical_devices,
Core::System& system_);
~ConfigurePerGame() override;
/// Loads all button configurations to settings file