renderer_opengl: Add support for custom shaders (#4578)
* Add Anaglyph 3D Change 3D slider in-game Change shaders while game is running Move shader loading into function Disable 3D slider setting when stereoscopy is off The rest of the shaders Address review issues Documentation and minor fixups Forgot clang-format Fix shader release on SDL2-software rendering Remove unnecessary state changes Respect 3D factor setting regardless of stereoscopic rendering Improve shader resolution passing Minor setting-related improvements Add option to toggle texture filtering Rebase fixes * One final clang-format * Fix OpenGL problems
This commit is contained in:
parent
3e9c2e77d9
commit
8131bd32e3
22 changed files with 587 additions and 48 deletions
|
@ -10,6 +10,7 @@
|
|||
#include "core/core.h"
|
||||
#include "core/settings.h"
|
||||
#include "ui_configure_graphics.h"
|
||||
#include "video_core/renderer_opengl/post_processing_opengl.h"
|
||||
|
||||
ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
||||
: QWidget(parent), ui(new Ui::ConfigureGraphics) {
|
||||
|
@ -37,6 +38,14 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
|||
}
|
||||
});
|
||||
#endif
|
||||
|
||||
connect(ui->render_3d_combobox,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
[this](int currentIndex) {
|
||||
updateShaders(static_cast<Settings::StereoRenderOption>(currentIndex) ==
|
||||
Settings::StereoRenderOption::Anaglyph);
|
||||
});
|
||||
|
||||
connect(ui->bg_button, &QPushButton::clicked, this, [this] {
|
||||
const QColor new_bg_color = QColorDialog::getColor(bg_color);
|
||||
if (!new_bg_color.isValid()) {
|
||||
|
@ -62,8 +71,10 @@ void ConfigureGraphics::SetConfiguration() {
|
|||
ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit);
|
||||
ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked());
|
||||
ui->frame_limit->setValue(Settings::values.frame_limit);
|
||||
ui->render_3d_combobox->setCurrentIndex(static_cast<int>(Settings::values.render_3d));
|
||||
ui->factor_3d->setValue(Settings::values.factor_3d);
|
||||
ui->toggle_3d->setChecked(Settings::values.toggle_3d);
|
||||
updateShaders(Settings::values.render_3d == Settings::StereoRenderOption::Anaglyph);
|
||||
ui->toggle_linear_filter->setChecked(Settings::values.filter_mode);
|
||||
ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option));
|
||||
ui->swap_screen->setChecked(Settings::values.swap_screen);
|
||||
bg_color = QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green,
|
||||
|
@ -84,8 +95,12 @@ void ConfigureGraphics::ApplyConfiguration() {
|
|||
static_cast<u16>(ui->resolution_factor_combobox->currentIndex());
|
||||
Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked();
|
||||
Settings::values.frame_limit = ui->frame_limit->value();
|
||||
Settings::values.render_3d =
|
||||
static_cast<Settings::StereoRenderOption>(ui->render_3d_combobox->currentIndex());
|
||||
Settings::values.factor_3d = ui->factor_3d->value();
|
||||
Settings::values.toggle_3d = ui->toggle_3d->isChecked();
|
||||
Settings::values.pp_shader_name =
|
||||
ui->shader_combobox->itemText(ui->shader_combobox->currentIndex()).toStdString();
|
||||
Settings::values.filter_mode = ui->toggle_linear_filter->isChecked();
|
||||
Settings::values.layout_option =
|
||||
static_cast<Settings::LayoutOption>(ui->layout_combobox->currentIndex());
|
||||
Settings::values.swap_screen = ui->swap_screen->isChecked();
|
||||
|
@ -94,6 +109,23 @@ void ConfigureGraphics::ApplyConfiguration() {
|
|||
Settings::values.bg_blue = static_cast<float>(bg_color.blueF());
|
||||
}
|
||||
|
||||
void ConfigureGraphics::updateShaders(bool anaglyph) {
|
||||
ui->shader_combobox->clear();
|
||||
|
||||
if (anaglyph)
|
||||
ui->shader_combobox->addItem("dubois (builtin)");
|
||||
else
|
||||
ui->shader_combobox->addItem("none (builtin)");
|
||||
|
||||
ui->shader_combobox->setCurrentIndex(0);
|
||||
|
||||
for (const auto& shader : OpenGL::GetPostProcessingShaderList(anaglyph)) {
|
||||
ui->shader_combobox->addItem(QString::fromStdString(shader));
|
||||
if (Settings::values.pp_shader_name == shader)
|
||||
ui->shader_combobox->setCurrentIndex(ui->shader_combobox->count() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureGraphics::RetranslateUI() {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue