Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
1998a3d38e | |||
f166cbc35b |
5
dist/qt_themes/qdarkstyle/style.qss
vendored
5
dist/qt_themes/qdarkstyle/style.qss
vendored
@ -298,11 +298,6 @@ QAbstractItemView:read-only {
|
|||||||
alternate-background-color: #232629;
|
alternate-background-color: #232629;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Workaround for https://bugreports.qt.io/browse/QTBUG-115529 */
|
|
||||||
QAbstractItemView:item {
|
|
||||||
border: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget:focus {
|
QWidget:focus {
|
||||||
border: 1px solid #3daee9;
|
border: 1px solid #3daee9;
|
||||||
}
|
}
|
||||||
|
@ -481,11 +481,6 @@ QAbstractItemView QLineEdit {
|
|||||||
padding: 2px;
|
padding: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Workaround for https://bugreports.qt.io/browse/QTBUG-115529 */
|
|
||||||
QAbstractItemView:item {
|
|
||||||
border: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* QAbstractScrollArea ----------------------------------------------------
|
/* QAbstractScrollArea ----------------------------------------------------
|
||||||
|
|
||||||
https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qabstractscrollarea
|
https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qabstractscrollarea
|
||||||
|
@ -143,7 +143,7 @@ void Config::ReadValues() {
|
|||||||
ReadSetting("Renderer", Settings::values.use_vsync_new);
|
ReadSetting("Renderer", Settings::values.use_vsync_new);
|
||||||
ReadSetting("Renderer", Settings::values.texture_filter);
|
ReadSetting("Renderer", Settings::values.texture_filter);
|
||||||
|
|
||||||
ReadSetting("Renderer", Settings::values.swap_eyes);
|
ReadSetting("Renderer", Settings::values.mono_render_option);
|
||||||
ReadSetting("Renderer", Settings::values.render_3d);
|
ReadSetting("Renderer", Settings::values.render_3d);
|
||||||
ReadSetting("Renderer", Settings::values.factor_3d);
|
ReadSetting("Renderer", Settings::values.factor_3d);
|
||||||
ReadSetting("Renderer", Settings::values.pp_shader_name);
|
ReadSetting("Renderer", Settings::values.pp_shader_name);
|
||||||
|
@ -582,14 +582,6 @@ void GRenderWindow::resizeEvent(QResizeEvent* event) {
|
|||||||
OnFramebufferSizeChanged();
|
OnFramebufferSizeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GRenderWindow::moveEvent(QMoveEvent* event) {
|
|
||||||
QWidget::moveEvent(event);
|
|
||||||
if (is_secondary) {
|
|
||||||
const auto screen_pos = Common::MakeVec(pos().x(), pos().y());
|
|
||||||
SetScreenPos(screen_pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GRenderWindow::InitRenderTarget() {
|
bool GRenderWindow::InitRenderTarget() {
|
||||||
{
|
{
|
||||||
// Create a dummy render widget so that Qt
|
// Create a dummy render widget so that Qt
|
||||||
|
@ -136,7 +136,6 @@ public:
|
|||||||
void closeEvent(QCloseEvent* event) override;
|
void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent* event) override;
|
void resizeEvent(QResizeEvent* event) override;
|
||||||
void moveEvent(QMoveEvent* event) override;
|
|
||||||
|
|
||||||
void keyPressEvent(QKeyEvent* event) override;
|
void keyPressEvent(QKeyEvent* event) override;
|
||||||
void keyReleaseEvent(QKeyEvent* event) override;
|
void keyReleaseEvent(QKeyEvent* event) override;
|
||||||
|
@ -505,9 +505,9 @@ void Config::ReadLayoutValues() {
|
|||||||
ReadGlobalSetting(Settings::values.swap_screen);
|
ReadGlobalSetting(Settings::values.swap_screen);
|
||||||
ReadGlobalSetting(Settings::values.upright_screen);
|
ReadGlobalSetting(Settings::values.upright_screen);
|
||||||
ReadGlobalSetting(Settings::values.large_screen_proportion);
|
ReadGlobalSetting(Settings::values.large_screen_proportion);
|
||||||
ReadBasicSetting(Settings::values.swap_eyes);
|
|
||||||
|
|
||||||
if (global) {
|
if (global) {
|
||||||
|
ReadBasicSetting(Settings::values.mono_render_option);
|
||||||
ReadBasicSetting(Settings::values.custom_layout);
|
ReadBasicSetting(Settings::values.custom_layout);
|
||||||
ReadBasicSetting(Settings::values.custom_top_left);
|
ReadBasicSetting(Settings::values.custom_top_left);
|
||||||
ReadBasicSetting(Settings::values.custom_top_top);
|
ReadBasicSetting(Settings::values.custom_top_top);
|
||||||
@ -1017,9 +1017,9 @@ void Config::SaveLayoutValues() {
|
|||||||
WriteGlobalSetting(Settings::values.swap_screen);
|
WriteGlobalSetting(Settings::values.swap_screen);
|
||||||
WriteGlobalSetting(Settings::values.upright_screen);
|
WriteGlobalSetting(Settings::values.upright_screen);
|
||||||
WriteGlobalSetting(Settings::values.large_screen_proportion);
|
WriteGlobalSetting(Settings::values.large_screen_proportion);
|
||||||
WriteBasicSetting(Settings::values.swap_eyes);
|
|
||||||
|
|
||||||
if (global) {
|
if (global) {
|
||||||
|
WriteBasicSetting(Settings::values.mono_render_option);
|
||||||
WriteBasicSetting(Settings::values.custom_layout);
|
WriteBasicSetting(Settings::values.custom_layout);
|
||||||
WriteBasicSetting(Settings::values.custom_top_left);
|
WriteBasicSetting(Settings::values.custom_top_left);
|
||||||
WriteBasicSetting(Settings::values.custom_top_top);
|
WriteBasicSetting(Settings::values.custom_top_top);
|
||||||
|
@ -74,8 +74,9 @@ void ConfigureEnhancements::SetConfiguration() {
|
|||||||
ui->render_3d_combobox->setCurrentIndex(
|
ui->render_3d_combobox->setCurrentIndex(
|
||||||
static_cast<int>(Settings::values.render_3d.GetValue()));
|
static_cast<int>(Settings::values.render_3d.GetValue()));
|
||||||
ui->factor_3d->setValue(Settings::values.factor_3d.GetValue());
|
ui->factor_3d->setValue(Settings::values.factor_3d.GetValue());
|
||||||
|
ui->mono_rendering_eye->setCurrentIndex(
|
||||||
|
static_cast<int>(Settings::values.mono_render_option.GetValue()));
|
||||||
updateShaders(Settings::values.render_3d.GetValue());
|
updateShaders(Settings::values.render_3d.GetValue());
|
||||||
ui->toggle_swap_eyes->setChecked(Settings::values.swap_eyes.GetValue());
|
|
||||||
ui->toggle_linear_filter->setChecked(Settings::values.filter_mode.GetValue());
|
ui->toggle_linear_filter->setChecked(Settings::values.filter_mode.GetValue());
|
||||||
ui->toggle_swap_screen->setChecked(Settings::values.swap_screen.GetValue());
|
ui->toggle_swap_screen->setChecked(Settings::values.swap_screen.GetValue());
|
||||||
ui->toggle_upright_screen->setChecked(Settings::values.upright_screen.GetValue());
|
ui->toggle_upright_screen->setChecked(Settings::values.upright_screen.GetValue());
|
||||||
@ -97,7 +98,8 @@ void ConfigureEnhancements::updateShaders(Settings::StereoRenderOption stereo_op
|
|||||||
ui->shader_combobox->clear();
|
ui->shader_combobox->clear();
|
||||||
ui->shader_combobox->setEnabled(true);
|
ui->shader_combobox->setEnabled(true);
|
||||||
|
|
||||||
if (stereo_option == Settings::StereoRenderOption::Interlaced) {
|
if (stereo_option == Settings::StereoRenderOption::Interlaced ||
|
||||||
|
stereo_option == Settings::StereoRenderOption::ReverseInterlaced) {
|
||||||
ui->shader_combobox->addItem(QStringLiteral("horizontal (builtin)"));
|
ui->shader_combobox->addItem(QStringLiteral("horizontal (builtin)"));
|
||||||
ui->shader_combobox->setCurrentIndex(0);
|
ui->shader_combobox->setCurrentIndex(0);
|
||||||
ui->shader_combobox->setEnabled(false);
|
ui->shader_combobox->setEnabled(false);
|
||||||
@ -133,6 +135,8 @@ void ConfigureEnhancements::ApplyConfiguration() {
|
|||||||
Settings::values.render_3d =
|
Settings::values.render_3d =
|
||||||
static_cast<Settings::StereoRenderOption>(ui->render_3d_combobox->currentIndex());
|
static_cast<Settings::StereoRenderOption>(ui->render_3d_combobox->currentIndex());
|
||||||
Settings::values.factor_3d = ui->factor_3d->value();
|
Settings::values.factor_3d = ui->factor_3d->value();
|
||||||
|
Settings::values.mono_render_option =
|
||||||
|
static_cast<Settings::MonoRenderOption>(ui->mono_rendering_eye->currentIndex());
|
||||||
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Anaglyph) {
|
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Anaglyph) {
|
||||||
Settings::values.anaglyph_shader_name =
|
Settings::values.anaglyph_shader_name =
|
||||||
ui->shader_combobox->itemText(ui->shader_combobox->currentIndex()).toStdString();
|
ui->shader_combobox->itemText(ui->shader_combobox->currentIndex()).toStdString();
|
||||||
@ -142,8 +146,6 @@ void ConfigureEnhancements::ApplyConfiguration() {
|
|||||||
}
|
}
|
||||||
Settings::values.large_screen_proportion = ui->large_screen_proportion->value();
|
Settings::values.large_screen_proportion = ui->large_screen_proportion->value();
|
||||||
|
|
||||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.swap_eyes, ui->toggle_swap_eyes,
|
|
||||||
swap_eyes);
|
|
||||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.filter_mode,
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.filter_mode,
|
||||||
ui->toggle_linear_filter, linear_filter);
|
ui->toggle_linear_filter, linear_filter);
|
||||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.texture_filter,
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.texture_filter,
|
||||||
@ -172,7 +174,6 @@ void ConfigureEnhancements::SetupPerGameUI() {
|
|||||||
if (Settings::IsConfiguringGlobal()) {
|
if (Settings::IsConfiguringGlobal()) {
|
||||||
ui->widget_resolution->setEnabled(Settings::values.resolution_factor.UsingGlobal());
|
ui->widget_resolution->setEnabled(Settings::values.resolution_factor.UsingGlobal());
|
||||||
ui->widget_texture_filter->setEnabled(Settings::values.texture_filter.UsingGlobal());
|
ui->widget_texture_filter->setEnabled(Settings::values.texture_filter.UsingGlobal());
|
||||||
ui->toggle_swap_eyes->setEnabled(Settings::values.swap_eyes.UsingGlobal());
|
|
||||||
ui->toggle_linear_filter->setEnabled(Settings::values.filter_mode.UsingGlobal());
|
ui->toggle_linear_filter->setEnabled(Settings::values.filter_mode.UsingGlobal());
|
||||||
ui->toggle_swap_screen->setEnabled(Settings::values.swap_screen.UsingGlobal());
|
ui->toggle_swap_screen->setEnabled(Settings::values.swap_screen.UsingGlobal());
|
||||||
ui->toggle_upright_screen->setEnabled(Settings::values.upright_screen.UsingGlobal());
|
ui->toggle_upright_screen->setEnabled(Settings::values.upright_screen.UsingGlobal());
|
||||||
@ -192,8 +193,6 @@ void ConfigureEnhancements::SetupPerGameUI() {
|
|||||||
linear_filter);
|
linear_filter);
|
||||||
ConfigurationShared::SetColoredTristate(ui->toggle_swap_screen, Settings::values.swap_screen,
|
ConfigurationShared::SetColoredTristate(ui->toggle_swap_screen, Settings::values.swap_screen,
|
||||||
swap_screen);
|
swap_screen);
|
||||||
ConfigurationShared::SetColoredTristate(ui->toggle_swap_eyes, Settings::values.swap_eyes,
|
|
||||||
swap_eyes);
|
|
||||||
ConfigurationShared::SetColoredTristate(ui->toggle_upright_screen,
|
ConfigurationShared::SetColoredTristate(ui->toggle_upright_screen,
|
||||||
Settings::values.upright_screen, upright_screen);
|
Settings::values.upright_screen, upright_screen);
|
||||||
ConfigurationShared::SetColoredTristate(ui->toggle_dump_textures,
|
ConfigurationShared::SetColoredTristate(ui->toggle_dump_textures,
|
||||||
|
@ -45,6 +45,5 @@ private:
|
|||||||
ConfigurationShared::CheckState custom_textures;
|
ConfigurationShared::CheckState custom_textures;
|
||||||
ConfigurationShared::CheckState preload_textures;
|
ConfigurationShared::CheckState preload_textures;
|
||||||
ConfigurationShared::CheckState async_custom_loading;
|
ConfigurationShared::CheckState async_custom_loading;
|
||||||
ConfigurationShared::CheckState swap_eyes;
|
|
||||||
QColor bg_color;
|
QColor bg_color;
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>440</width>
|
<width>440</width>
|
||||||
<height>781</height>
|
<height>748</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@ -239,11 +239,6 @@
|
|||||||
<string>Side by Side</string>
|
<string>Side by Side</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Top Bottom</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Anaglyph</string>
|
<string>Anaglyph</string>
|
||||||
@ -254,6 +249,11 @@
|
|||||||
<string>Interlaced</string>
|
<string>Interlaced</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Reverse Interlaced</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -288,12 +288,26 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="toggle_swap_eyes">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Swap Eyes</string>
|
<string>Eye to Render in Monoscopic Mode</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="mono_rendering_eye">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Left Eye (default)</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Right Eye</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -525,6 +539,7 @@
|
|||||||
<tabstop>texture_filter_combobox</tabstop>
|
<tabstop>texture_filter_combobox</tabstop>
|
||||||
<tabstop>render_3d_combobox</tabstop>
|
<tabstop>render_3d_combobox</tabstop>
|
||||||
<tabstop>factor_3d</tabstop>
|
<tabstop>factor_3d</tabstop>
|
||||||
|
<tabstop>mono_rendering_eye</tabstop>
|
||||||
<tabstop>layout_combobox</tabstop>
|
<tabstop>layout_combobox</tabstop>
|
||||||
<tabstop>toggle_swap_screen</tabstop>
|
<tabstop>toggle_swap_screen</tabstop>
|
||||||
<tabstop>toggle_upright_screen</tabstop>
|
<tabstop>toggle_upright_screen</tabstop>
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "citra_qt/debugger/graphics/graphics_cmdlists.h"
|
#include "citra_qt/debugger/graphics/graphics_cmdlists.h"
|
||||||
#include "citra_qt/util/util.h"
|
#include "citra_qt/util/util.h"
|
||||||
#include "common/vector_math.h"
|
#include "common/vector_math.h"
|
||||||
#include "core/core.h"
|
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
#include "video_core/debug_utils/debug_utils.h"
|
#include "video_core/debug_utils/debug_utils.h"
|
||||||
#include "video_core/pica_state.h"
|
#include "video_core/pica_state.h"
|
||||||
@ -167,7 +166,7 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) {
|
|||||||
const auto format = texture.format;
|
const auto format = texture.format;
|
||||||
|
|
||||||
const auto info = Pica::Texture::TextureInfo::FromPicaRegister(config, format);
|
const auto info = Pica::Texture::TextureInfo::FromPicaRegister(config, format);
|
||||||
const u8* src = system.Memory().GetPhysicalPointer(config.GetPhysicalAddress());
|
const u8* src = memory.GetPhysicalPointer(config.GetPhysicalAddress());
|
||||||
new_info_widget = new TextureInfoWidget(src, info);
|
new_info_widget = new TextureInfoWidget(src, info);
|
||||||
}
|
}
|
||||||
if (command_info_widget) {
|
if (command_info_widget) {
|
||||||
@ -181,8 +180,8 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) {
|
|||||||
}
|
}
|
||||||
#undef COMMAND_IN_RANGE
|
#undef COMMAND_IN_RANGE
|
||||||
|
|
||||||
GPUCommandListWidget::GPUCommandListWidget(Core::System& system_, QWidget* parent)
|
GPUCommandListWidget::GPUCommandListWidget(Memory::MemorySystem& memory_, QWidget* parent)
|
||||||
: QDockWidget(tr("Pica Command List"), parent), system{system_} {
|
: QDockWidget(tr("Pica Command List"), parent), memory{memory_} {
|
||||||
setObjectName(QStringLiteral("Pica Command List"));
|
setObjectName(QStringLiteral("Pica Command List"));
|
||||||
GPUCommandListModel* model = new GPUCommandListModel(this);
|
GPUCommandListModel* model = new GPUCommandListModel(this);
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
class QPushButton;
|
class QPushButton;
|
||||||
class QTreeView;
|
class QTreeView;
|
||||||
|
|
||||||
namespace Core {
|
namespace Memory {
|
||||||
class System;
|
class MemorySystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
class GPUCommandListModel : public QAbstractListModel {
|
class GPUCommandListModel : public QAbstractListModel {
|
||||||
@ -42,7 +42,7 @@ class GPUCommandListWidget : public QDockWidget {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GPUCommandListWidget(Core::System& system, QWidget* parent = nullptr);
|
explicit GPUCommandListWidget(Memory::MemorySystem& memory, QWidget* parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void OnToggleTracing();
|
void OnToggleTracing();
|
||||||
@ -57,7 +57,7 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Pica::DebugUtils::PicaTrace> pica_trace;
|
std::unique_ptr<Pica::DebugUtils::PicaTrace> pica_trace;
|
||||||
Core::System& system;
|
Memory::MemorySystem& memory;
|
||||||
QTreeView* list_widget;
|
QTreeView* list_widget;
|
||||||
QWidget* command_info_widget;
|
QWidget* command_info_widget;
|
||||||
QPushButton* toggle_tracing;
|
QPushButton* toggle_tracing;
|
||||||
|
@ -448,7 +448,7 @@ void GMainWindow::InitializeDebugWidgets() {
|
|||||||
graphicsWidget->hide();
|
graphicsWidget->hide();
|
||||||
debug_menu->addAction(graphicsWidget->toggleViewAction());
|
debug_menu->addAction(graphicsWidget->toggleViewAction());
|
||||||
|
|
||||||
graphicsCommandsWidget = new GPUCommandListWidget(system, this);
|
graphicsCommandsWidget = new GPUCommandListWidget(system.Memory(), this);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, graphicsCommandsWidget);
|
addDockWidget(Qt::RightDockWidgetArea, graphicsCommandsWidget);
|
||||||
graphicsCommandsWidget->hide();
|
graphicsCommandsWidget->hide();
|
||||||
debug_menu->addAction(graphicsCommandsWidget->toggleViewAction());
|
debug_menu->addAction(graphicsCommandsWidget->toggleViewAction());
|
||||||
@ -627,8 +627,6 @@ void GMainWindow::InitializeHotkeys() {
|
|||||||
Settings::values.frame_limit.SetGlobal(!Settings::values.frame_limit.UsingGlobal());
|
Settings::values.frame_limit.SetGlobal(!Settings::values.frame_limit.UsingGlobal());
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
});
|
});
|
||||||
connect_shortcut(QStringLiteral("Swap Eyes"),
|
|
||||||
[&] { Settings::values.swap_eyes = !Settings::values.swap_eyes; });
|
|
||||||
connect_shortcut(QStringLiteral("Toggle Texture Dumping"),
|
connect_shortcut(QStringLiteral("Toggle Texture Dumping"),
|
||||||
[&] { Settings::values.dump_textures = !Settings::values.dump_textures; });
|
[&] { Settings::values.dump_textures = !Settings::values.dump_textures; });
|
||||||
connect_shortcut(QStringLiteral("Toggle Custom Textures"),
|
connect_shortcut(QStringLiteral("Toggle Custom Textures"),
|
||||||
@ -2484,24 +2482,18 @@ void GMainWindow::OnMouseActivity() {
|
|||||||
ShowMouseCursor();
|
ShowMouseCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::mouseMoveEvent(QMouseEvent*) {
|
void GMainWindow::mouseMoveEvent([[maybe_unused]] QMouseEvent* event) {
|
||||||
OnMouseActivity();
|
OnMouseActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::mousePressEvent(QMouseEvent*) {
|
void GMainWindow::mousePressEvent([[maybe_unused]] QMouseEvent* event) {
|
||||||
OnMouseActivity();
|
OnMouseActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::mouseReleaseEvent(QMouseEvent*) {
|
void GMainWindow::mouseReleaseEvent([[maybe_unused]] QMouseEvent* event) {
|
||||||
OnMouseActivity();
|
OnMouseActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::moveEvent(QMoveEvent* event) {
|
|
||||||
QMainWindow::moveEvent(event);
|
|
||||||
const auto screen_pos = Common::MakeVec(pos().x(), pos().y());
|
|
||||||
render_window->SetScreenPos(screen_pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) {
|
void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) {
|
||||||
QString status_message;
|
QString status_message;
|
||||||
|
|
||||||
|
@ -374,7 +374,6 @@ protected:
|
|||||||
void mouseMoveEvent(QMouseEvent* event) override;
|
void mouseMoveEvent(QMouseEvent* event) override;
|
||||||
void mousePressEvent(QMouseEvent* event) override;
|
void mousePressEvent(QMouseEvent* event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||||
void moveEvent(QMoveEvent* event) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(std::size_t);
|
Q_DECLARE_METATYPE(std::size_t);
|
||||||
|
@ -84,7 +84,7 @@ void LogSettings() {
|
|||||||
log_setting("Renderer_TextureFilter", GetTextureFilterName(values.texture_filter.GetValue()));
|
log_setting("Renderer_TextureFilter", GetTextureFilterName(values.texture_filter.GetValue()));
|
||||||
log_setting("Stereoscopy_Render3d", values.render_3d.GetValue());
|
log_setting("Stereoscopy_Render3d", values.render_3d.GetValue());
|
||||||
log_setting("Stereoscopy_Factor3d", values.factor_3d.GetValue());
|
log_setting("Stereoscopy_Factor3d", values.factor_3d.GetValue());
|
||||||
log_setting("Stereoscopy_SwapEyes", values.swap_eyes.GetValue());
|
log_setting("Stereoscopy_MonoRenderOption", values.mono_render_option.GetValue());
|
||||||
if (values.render_3d.GetValue() == StereoRenderOption::Anaglyph) {
|
if (values.render_3d.GetValue() == StereoRenderOption::Anaglyph) {
|
||||||
log_setting("Renderer_AnaglyphShader", values.anaglyph_shader_name.GetValue());
|
log_setting("Renderer_AnaglyphShader", values.anaglyph_shader_name.GetValue());
|
||||||
}
|
}
|
||||||
|
@ -49,12 +49,19 @@ enum class LayoutOption : u32 {
|
|||||||
enum class StereoRenderOption : u32 {
|
enum class StereoRenderOption : u32 {
|
||||||
Off = 0,
|
Off = 0,
|
||||||
SideBySide = 1,
|
SideBySide = 1,
|
||||||
TopBottom = 2,
|
Anaglyph = 2,
|
||||||
Anaglyph = 3,
|
Interlaced = 3,
|
||||||
Interlaced = 4,
|
ReverseInterlaced = 4,
|
||||||
CardboardVR = 5
|
CardboardVR = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Which eye to render when 3d is off. 800px wide mode could be added here in the future, when
|
||||||
|
// implemented
|
||||||
|
enum class MonoRenderOption : u32 {
|
||||||
|
LeftEye = 0,
|
||||||
|
RightEye = 1,
|
||||||
|
};
|
||||||
|
|
||||||
enum class AudioEmulation : u32 {
|
enum class AudioEmulation : u32 {
|
||||||
HLE = 0,
|
HLE = 0,
|
||||||
LLE = 1,
|
LLE = 1,
|
||||||
@ -460,7 +467,8 @@ struct Values {
|
|||||||
|
|
||||||
SwitchableSetting<StereoRenderOption> render_3d{StereoRenderOption::Off, "render_3d"};
|
SwitchableSetting<StereoRenderOption> render_3d{StereoRenderOption::Off, "render_3d"};
|
||||||
SwitchableSetting<u32> factor_3d{0, "factor_3d"};
|
SwitchableSetting<u32> factor_3d{0, "factor_3d"};
|
||||||
SwitchableSetting<bool> swap_eyes{false, "swap_eyes"};
|
SwitchableSetting<MonoRenderOption> mono_render_option{MonoRenderOption::LeftEye,
|
||||||
|
"mono_render_option"};
|
||||||
|
|
||||||
Setting<u32> cardboard_screen_size{85, "cardboard_screen_size"};
|
Setting<u32> cardboard_screen_size{85, "cardboard_screen_size"};
|
||||||
Setting<s32> cardboard_x_shift{0, "cardboard_x_shift"};
|
Setting<s32> cardboard_x_shift{0, "cardboard_x_shift"};
|
||||||
|
@ -73,13 +73,6 @@ bool EmuWindow::IsWithinTouchscreen(const Layout::FramebufferLayout& layout, uns
|
|||||||
framebuffer_x < layout.bottom_screen.right / 2) ||
|
framebuffer_x < layout.bottom_screen.right / 2) ||
|
||||||
(framebuffer_x >= (layout.bottom_screen.left / 2) + (layout.width / 2) &&
|
(framebuffer_x >= (layout.bottom_screen.left / 2) + (layout.width / 2) &&
|
||||||
framebuffer_x < (layout.bottom_screen.right / 2) + (layout.width / 2))));
|
framebuffer_x < (layout.bottom_screen.right / 2) + (layout.width / 2))));
|
||||||
} else if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::TopBottom) {
|
|
||||||
return framebuffer_x >= layout.bottom_screen.left &&
|
|
||||||
framebuffer_x < layout.bottom_screen.right &&
|
|
||||||
((framebuffer_y >= layout.bottom_screen.top / 2 &&
|
|
||||||
framebuffer_y < layout.bottom_screen.bottom / 2) ||
|
|
||||||
(framebuffer_y >= (layout.bottom_screen.top / 2) + (layout.height / 2) &&
|
|
||||||
framebuffer_y < (layout.bottom_screen.bottom / 2) + (layout.height / 2)));
|
|
||||||
} else if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::CardboardVR) {
|
} else if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::CardboardVR) {
|
||||||
return (framebuffer_y >= layout.bottom_screen.top &&
|
return (framebuffer_y >= layout.bottom_screen.top &&
|
||||||
framebuffer_y < layout.bottom_screen.bottom &&
|
framebuffer_y < layout.bottom_screen.bottom &&
|
||||||
@ -98,35 +91,22 @@ bool EmuWindow::IsWithinTouchscreen(const Layout::FramebufferLayout& layout, uns
|
|||||||
|
|
||||||
std::tuple<unsigned, unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) const {
|
std::tuple<unsigned, unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) const {
|
||||||
if (new_x >= framebuffer_layout.width / 2) {
|
if (new_x >= framebuffer_layout.width / 2) {
|
||||||
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide) {
|
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide)
|
||||||
new_x -= framebuffer_layout.width / 2;
|
new_x -= framebuffer_layout.width / 2;
|
||||||
} else if (Settings::values.render_3d.GetValue() ==
|
else if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::CardboardVR)
|
||||||
Settings::StereoRenderOption::CardboardVR) {
|
|
||||||
new_x -=
|
new_x -=
|
||||||
(framebuffer_layout.width / 2) - (framebuffer_layout.cardboard.user_x_shift * 2);
|
(framebuffer_layout.width / 2) - (framebuffer_layout.cardboard.user_x_shift * 2);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (new_y >= framebuffer_layout.height / 2) {
|
|
||||||
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::TopBottom) {
|
|
||||||
new_y -= framebuffer_layout.height / 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide) {
|
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide) {
|
||||||
new_x = std::clamp(new_x, framebuffer_layout.bottom_screen.left / 2,
|
new_x = std::max(new_x, framebuffer_layout.bottom_screen.left / 2);
|
||||||
framebuffer_layout.bottom_screen.right / 2 - 1);
|
new_x = std::min(new_x, framebuffer_layout.bottom_screen.right / 2 - 1);
|
||||||
} else {
|
} else {
|
||||||
new_x = std::clamp(new_x, framebuffer_layout.bottom_screen.left,
|
new_x = std::max(new_x, framebuffer_layout.bottom_screen.left);
|
||||||
framebuffer_layout.bottom_screen.right - 1);
|
new_x = std::min(new_x, framebuffer_layout.bottom_screen.right - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::TopBottom) {
|
new_y = std::max(new_y, framebuffer_layout.bottom_screen.top);
|
||||||
new_y = std::clamp(new_y, framebuffer_layout.bottom_screen.top / 2,
|
new_y = std::min(new_y, framebuffer_layout.bottom_screen.bottom - 1);
|
||||||
framebuffer_layout.bottom_screen.bottom / 2 - 1);
|
|
||||||
} else {
|
|
||||||
new_y = std::clamp(new_y, framebuffer_layout.bottom_screen.top,
|
|
||||||
framebuffer_layout.bottom_screen.bottom - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::make_tuple(new_x, new_y);
|
return std::make_tuple(new_x, new_y);
|
||||||
}
|
}
|
||||||
@ -142,25 +122,17 @@ void EmuWindow::CreateTouchState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) {
|
bool EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) {
|
||||||
if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y)) {
|
if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (framebuffer_x >= framebuffer_layout.width / 2) {
|
if (framebuffer_x >= framebuffer_layout.width / 2) {
|
||||||
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide) {
|
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide)
|
||||||
framebuffer_x -= framebuffer_layout.width / 2;
|
framebuffer_x -= framebuffer_layout.width / 2;
|
||||||
} else if (Settings::values.render_3d.GetValue() ==
|
else if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::CardboardVR)
|
||||||
Settings::StereoRenderOption::CardboardVR) {
|
|
||||||
framebuffer_x -=
|
framebuffer_x -=
|
||||||
(framebuffer_layout.width / 2) - (framebuffer_layout.cardboard.user_x_shift * 2);
|
(framebuffer_layout.width / 2) - (framebuffer_layout.cardboard.user_x_shift * 2);
|
||||||
}
|
}
|
||||||
}
|
std::lock_guard guard(touch_state->mutex);
|
||||||
if (framebuffer_y >= framebuffer_layout.height / 2) {
|
|
||||||
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::TopBottom) {
|
|
||||||
framebuffer_y -= framebuffer_layout.height / 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
std::scoped_lock lock{touch_state->mutex};
|
|
||||||
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide) {
|
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide) {
|
||||||
touch_state->touch_x =
|
touch_state->touch_x =
|
||||||
static_cast<float>(framebuffer_x - framebuffer_layout.bottom_screen.left / 2) /
|
static_cast<float>(framebuffer_x - framebuffer_layout.bottom_screen.left / 2) /
|
||||||
@ -171,17 +143,9 @@ bool EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) {
|
|||||||
static_cast<float>(framebuffer_x - framebuffer_layout.bottom_screen.left) /
|
static_cast<float>(framebuffer_x - framebuffer_layout.bottom_screen.left) /
|
||||||
(framebuffer_layout.bottom_screen.right - framebuffer_layout.bottom_screen.left);
|
(framebuffer_layout.bottom_screen.right - framebuffer_layout.bottom_screen.left);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::TopBottom) {
|
|
||||||
touch_state->touch_y =
|
|
||||||
static_cast<float>(framebuffer_y - framebuffer_layout.bottom_screen.top / 2) /
|
|
||||||
(framebuffer_layout.bottom_screen.bottom / 2 -
|
|
||||||
framebuffer_layout.bottom_screen.top / 2);
|
|
||||||
} else {
|
|
||||||
touch_state->touch_y =
|
touch_state->touch_y =
|
||||||
static_cast<float>(framebuffer_y - framebuffer_layout.bottom_screen.top) /
|
static_cast<float>(framebuffer_y - framebuffer_layout.bottom_screen.top) /
|
||||||
(framebuffer_layout.bottom_screen.bottom - framebuffer_layout.bottom_screen.top);
|
(framebuffer_layout.bottom_screen.bottom - framebuffer_layout.bottom_screen.top);
|
||||||
}
|
|
||||||
|
|
||||||
if (!framebuffer_layout.is_rotated) {
|
if (!framebuffer_layout.is_rotated) {
|
||||||
std::swap(touch_state->touch_x, touch_state->touch_y);
|
std::swap(touch_state->touch_x, touch_state->touch_y);
|
||||||
@ -193,20 +157,18 @@ bool EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EmuWindow::TouchReleased() {
|
void EmuWindow::TouchReleased() {
|
||||||
std::scoped_lock lock{touch_state->mutex};
|
std::lock_guard guard{touch_state->mutex};
|
||||||
touch_state->touch_pressed = false;
|
touch_state->touch_pressed = false;
|
||||||
touch_state->touch_x = 0;
|
touch_state->touch_x = 0;
|
||||||
touch_state->touch_y = 0;
|
touch_state->touch_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y) {
|
void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y) {
|
||||||
if (!touch_state->touch_pressed) {
|
if (!touch_state->touch_pressed)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y)) {
|
if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y))
|
||||||
std::tie(framebuffer_x, framebuffer_y) = ClipToTouchScreen(framebuffer_x, framebuffer_y);
|
std::tie(framebuffer_x, framebuffer_y) = ClipToTouchScreen(framebuffer_x, framebuffer_y);
|
||||||
}
|
|
||||||
|
|
||||||
TouchPressed(framebuffer_x, framebuffer_y);
|
TouchPressed(framebuffer_x, framebuffer_y);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/vector_math.h"
|
|
||||||
#include "core/3ds.h"
|
#include "core/3ds.h"
|
||||||
#include "core/frontend/framebuffer_layout.h"
|
#include "core/frontend/framebuffer_layout.h"
|
||||||
|
|
||||||
@ -218,17 +217,6 @@ public:
|
|||||||
config = val;
|
config = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the position of the client window area relative to the origin of the host display.
|
|
||||||
*/
|
|
||||||
void SetScreenPos(const Common::Vec2i pos) {
|
|
||||||
screen_pos = pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
Common::Vec2i GetScreenPos() const {
|
|
||||||
return screen_pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns system information about the drawing area.
|
* Returns system information about the drawing area.
|
||||||
*/
|
*/
|
||||||
@ -286,7 +274,6 @@ protected:
|
|||||||
bool is_secondary{};
|
bool is_secondary{};
|
||||||
bool strict_context_required{};
|
bool strict_context_required{};
|
||||||
WindowSystemInfo window_info;
|
WindowSystemInfo window_info;
|
||||||
Common::Vec2i screen_pos{};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "common/alignment.h"
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "core/3ds.h"
|
#include "core/3ds.h"
|
||||||
|
@ -151,8 +151,8 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader) {
|
|||||||
static_cast<int>(Settings::values.render_3d.GetValue()));
|
static_cast<int>(Settings::values.render_3d.GetValue()));
|
||||||
AddField(Telemetry::FieldType::UserConfig, "Renderer_Factor3d",
|
AddField(Telemetry::FieldType::UserConfig, "Renderer_Factor3d",
|
||||||
Settings::values.factor_3d.GetValue());
|
Settings::values.factor_3d.GetValue());
|
||||||
AddField(Telemetry::FieldType::UserConfig, "Renderer_SwapEyes",
|
AddField(Telemetry::FieldType::UserConfig, "Renderer_MonoRenderOption",
|
||||||
static_cast<int>(Settings::values.swap_eyes.GetValue()));
|
static_cast<int>(Settings::values.mono_render_option.GetValue()));
|
||||||
AddField(Telemetry::FieldType::UserConfig, "System_IsNew3ds",
|
AddField(Telemetry::FieldType::UserConfig, "System_IsNew3ds",
|
||||||
Settings::values.is_new_3ds.GetValue());
|
Settings::values.is_new_3ds.GetValue());
|
||||||
AddField(Telemetry::FieldType::UserConfig, "System_RegionValue",
|
AddField(Telemetry::FieldType::UserConfig, "System_RegionValue",
|
||||||
|
@ -4,16 +4,17 @@
|
|||||||
|
|
||||||
//? #version 430 core
|
//? #version 430 core
|
||||||
|
|
||||||
// https://cybereality.com/rendepth-red-cyan-anaglyph-filter-optimized-for-stereoscopic-3d-on-lcd-monitors/
|
// Anaglyph Red-Cyan shader based on Dubois algorithm
|
||||||
const mat3 left_filter = mat3(
|
// Constants taken from the paper:
|
||||||
vec3(0.4561, 0.500484, 0.176381),
|
// "Conversion of a Stereo Pair to Anaglyph with
|
||||||
vec3(-0.400822, -0.0378246, -0.0157589),
|
// the Least-Squares Projection Method"
|
||||||
vec3(-0.0152161, -0.0205971, -0.00546856));
|
// Eric Dubois, March 2009
|
||||||
|
const mat3 l = mat3( 0.437, 0.449, 0.164,
|
||||||
const mat3 right_filter = mat3(
|
-0.062,-0.062,-0.024,
|
||||||
vec3(-0.0434706, -0.0879388, -0.00155529),
|
-0.048,-0.050,-0.017);
|
||||||
vec3(0.378476, 0.73364, -0.0184503),
|
const mat3 r = mat3(-0.011,-0.032,-0.007,
|
||||||
vec3(-0.0721527, -0.112961, 1.2264));
|
0.377, 0.761, 0.009,
|
||||||
|
-0.026,-0.093, 1.234);
|
||||||
|
|
||||||
layout(location = 0) in vec2 frag_tex_coord;
|
layout(location = 0) in vec2 frag_tex_coord;
|
||||||
layout(location = 0) out vec4 color;
|
layout(location = 0) out vec4 color;
|
||||||
@ -23,22 +24,9 @@ layout(binding = 1) uniform sampler2D color_texture_r;
|
|||||||
|
|
||||||
uniform vec4 resolution;
|
uniform vec4 resolution;
|
||||||
uniform int layer;
|
uniform int layer;
|
||||||
uniform bool swap_eyes;
|
|
||||||
|
|
||||||
const vec3 gamma_map = vec3(1.6, 0.8, 1.0);
|
|
||||||
|
|
||||||
vec3 correct_color(vec3 original) {
|
|
||||||
vec3 corrected;
|
|
||||||
corrected.r = pow(original.r, 1.0 / gamma_map.r);
|
|
||||||
corrected.g = pow(original.g, 1.0 / gamma_map.g);
|
|
||||||
corrected.b = pow(original.b, 1.0 / gamma_map.b);
|
|
||||||
return corrected;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec4 color_left = texture(color_texture, frag_tex_coord);
|
vec4 color_tex_l = texture(color_texture, frag_tex_coord);
|
||||||
vec4 color_right = texture(color_texture_r, frag_tex_coord);
|
vec4 color_tex_r = texture(color_texture_r, frag_tex_coord);
|
||||||
vec3 optimized_color = clamp(color_left.rgb * (swap_eyes ? right_filter : left_filter), vec3(0.0), vec3(1.0)) +
|
color = vec4(color_tex_l.rgb*l+color_tex_r.rgb*r, color_tex_l.a);
|
||||||
clamp(color_right.rgb * (swap_eyes ? left_filter : right_filter), vec3(0.0), vec3(1.0));
|
|
||||||
color = vec4(correct_color(optimized_color), color_left.a);
|
|
||||||
}
|
}
|
||||||
|
@ -7,22 +7,16 @@
|
|||||||
layout(location = 0) in vec2 frag_tex_coord;
|
layout(location = 0) in vec2 frag_tex_coord;
|
||||||
layout(location = 0) out vec4 color;
|
layout(location = 0) out vec4 color;
|
||||||
|
|
||||||
layout(binding = 0) uniform sampler2D color_texture_l;
|
layout(binding = 0) uniform sampler2D color_texture;
|
||||||
layout(binding = 1) uniform sampler2D color_texture_r;
|
layout(binding = 1) uniform sampler2D color_texture_r;
|
||||||
|
|
||||||
uniform vec4 o_resolution;
|
uniform vec4 o_resolution;
|
||||||
uniform ivec2 screen_pos;
|
uniform int reverse_interlaced;
|
||||||
uniform bool swap_eyes;
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
float screen_row = o_resolution.x * frag_tex_coord.x;
|
float screen_row = o_resolution.x * frag_tex_coord.x;
|
||||||
bool is_even = screen_pos.y % 2 == 0;
|
if (int(screen_row) % 2 == reverse_interlaced)
|
||||||
if (swap_eyes) {
|
color = texture(color_texture, frag_tex_coord);
|
||||||
is_even = !is_even;
|
else
|
||||||
}
|
|
||||||
if (int(screen_row) % 2 == int(is_even)) {
|
|
||||||
color = texture(color_texture_l, frag_tex_coord);
|
|
||||||
} else {
|
|
||||||
color = texture(color_texture_r, frag_tex_coord);
|
color = texture(color_texture_r, frag_tex_coord);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -49,8 +49,6 @@ uniform float4 i_resolution;
|
|||||||
uniform float4 o_resolution;
|
uniform float4 o_resolution;
|
||||||
// Layer
|
// Layer
|
||||||
uniform int layer;
|
uniform int layer;
|
||||||
// Screen position
|
|
||||||
uniform int2 screen_pos;
|
|
||||||
|
|
||||||
uniform sampler2D color_texture;
|
uniform sampler2D color_texture;
|
||||||
uniform sampler2D color_texture_r;
|
uniform sampler2D color_texture_r;
|
||||||
@ -121,11 +119,6 @@ float2 GetCoordinates()
|
|||||||
return frag_tex_coord;
|
return frag_tex_coord;
|
||||||
}
|
}
|
||||||
|
|
||||||
int2 GetScreenPos()
|
|
||||||
{
|
|
||||||
return screen_pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetOutput(float4 color_in)
|
void SetOutput(float4 color_in)
|
||||||
{
|
{
|
||||||
color = color_in;
|
color = color_in;
|
||||||
|
@ -54,7 +54,8 @@ struct ScreenRectVertex {
|
|||||||
*
|
*
|
||||||
* @param flipped Whether the frame should be flipped upside down.
|
* @param flipped Whether the frame should be flipped upside down.
|
||||||
*/
|
*/
|
||||||
static std::array<GLfloat, 3 * 2> MakeOrthographicMatrix(u32 width, u32 height, bool flipped) {
|
static std::array<GLfloat, 3 * 2> MakeOrthographicMatrix(const float width, const float height,
|
||||||
|
bool flipped) {
|
||||||
|
|
||||||
std::array<GLfloat, 3 * 2> matrix; // Laid out in column-major order
|
std::array<GLfloat, 3 * 2> matrix; // Laid out in column-major order
|
||||||
|
|
||||||
@ -404,7 +405,9 @@ void RendererOpenGL::ReloadShader() {
|
|||||||
shader_data += shader_text;
|
shader_data += shader_text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Interlaced) {
|
} else if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Interlaced ||
|
||||||
|
Settings::values.render_3d.GetValue() ==
|
||||||
|
Settings::StereoRenderOption::ReverseInterlaced) {
|
||||||
shader_data += HostShaders::OPENGL_PRESENT_INTERLACED_FRAG;
|
shader_data += HostShaders::OPENGL_PRESENT_INTERLACED_FRAG;
|
||||||
} else {
|
} else {
|
||||||
if (Settings::values.pp_shader_name.GetValue() == "none (builtin)") {
|
if (Settings::values.pp_shader_name.GetValue() == "none (builtin)") {
|
||||||
@ -426,14 +429,23 @@ void RendererOpenGL::ReloadShader() {
|
|||||||
uniform_modelview_matrix = glGetUniformLocation(shader.handle, "modelview_matrix");
|
uniform_modelview_matrix = glGetUniformLocation(shader.handle, "modelview_matrix");
|
||||||
uniform_color_texture = glGetUniformLocation(shader.handle, "color_texture");
|
uniform_color_texture = glGetUniformLocation(shader.handle, "color_texture");
|
||||||
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Anaglyph ||
|
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Anaglyph ||
|
||||||
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Interlaced) {
|
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Interlaced ||
|
||||||
uniform_swap_eyes = glGetUniformLocation(shader.handle, "swap_eyes");
|
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::ReverseInterlaced) {
|
||||||
uniform_color_texture_r = glGetUniformLocation(shader.handle, "color_texture_r");
|
uniform_color_texture_r = glGetUniformLocation(shader.handle, "color_texture_r");
|
||||||
}
|
}
|
||||||
|
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Interlaced ||
|
||||||
|
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::ReverseInterlaced) {
|
||||||
|
GLuint uniform_reverse_interlaced =
|
||||||
|
glGetUniformLocation(shader.handle, "reverse_interlaced");
|
||||||
|
if (Settings::values.render_3d.GetValue() ==
|
||||||
|
Settings::StereoRenderOption::ReverseInterlaced)
|
||||||
|
glUniform1i(uniform_reverse_interlaced, 1);
|
||||||
|
else
|
||||||
|
glUniform1i(uniform_reverse_interlaced, 0);
|
||||||
|
}
|
||||||
uniform_i_resolution = glGetUniformLocation(shader.handle, "i_resolution");
|
uniform_i_resolution = glGetUniformLocation(shader.handle, "i_resolution");
|
||||||
uniform_o_resolution = glGetUniformLocation(shader.handle, "o_resolution");
|
uniform_o_resolution = glGetUniformLocation(shader.handle, "o_resolution");
|
||||||
uniform_layer = glGetUniformLocation(shader.handle, "layer");
|
uniform_layer = glGetUniformLocation(shader.handle, "layer");
|
||||||
uniform_screen_pos = glGetUniformLocation(shader.handle, "screen_pos");
|
|
||||||
attrib_position = glGetAttribLocation(shader.handle, "vert_position");
|
attrib_position = glGetAttribLocation(shader.handle, "vert_position");
|
||||||
attrib_tex_coord = glGetAttribLocation(shader.handle, "vert_tex_coord");
|
attrib_tex_coord = glGetAttribLocation(shader.handle, "vert_tex_coord");
|
||||||
}
|
}
|
||||||
@ -666,7 +678,8 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f
|
|||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
// Set projection matrix
|
// Set projection matrix
|
||||||
const auto ortho_matrix = MakeOrthographicMatrix(layout.width, layout.height, flipped);
|
std::array<GLfloat, 3 * 2> ortho_matrix =
|
||||||
|
MakeOrthographicMatrix((float)layout.width, (float)layout.height, flipped);
|
||||||
glUniformMatrix3x2fv(uniform_modelview_matrix, 1, GL_FALSE, ortho_matrix.data());
|
glUniformMatrix3x2fv(uniform_modelview_matrix, 1, GL_FALSE, ortho_matrix.data());
|
||||||
|
|
||||||
// Bind texture in Texture Unit 0
|
// Bind texture in Texture Unit 0
|
||||||
@ -674,12 +687,8 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f
|
|||||||
|
|
||||||
const bool stereo_single_screen =
|
const bool stereo_single_screen =
|
||||||
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Anaglyph ||
|
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Anaglyph ||
|
||||||
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Interlaced;
|
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Interlaced ||
|
||||||
|
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::ReverseInterlaced;
|
||||||
// Set the screen position
|
|
||||||
const auto screen_pos = render_window.GetScreenPos() +
|
|
||||||
Common::MakeVec<s32>(layout.top_screen.left, layout.top_screen.bottom);
|
|
||||||
glUniform2i(uniform_screen_pos, screen_pos.x, screen_pos.y);
|
|
||||||
|
|
||||||
// Bind a second texture for the right eye if in Anaglyph mode
|
// Bind a second texture for the right eye if in Anaglyph mode
|
||||||
if (stereo_single_screen) {
|
if (stereo_single_screen) {
|
||||||
@ -747,7 +756,7 @@ void RendererOpenGL::DrawTopScreen(const Layout::FramebufferLayout& layout,
|
|||||||
: Layout::DisplayOrientation::Portrait;
|
: Layout::DisplayOrientation::Portrait;
|
||||||
switch (Settings::values.render_3d.GetValue()) {
|
switch (Settings::values.render_3d.GetValue()) {
|
||||||
case Settings::StereoRenderOption::Off: {
|
case Settings::StereoRenderOption::Off: {
|
||||||
const u32 eye = static_cast<u32>(Settings::values.swap_eyes.GetValue());
|
const int eye = static_cast<int>(Settings::values.mono_render_option.GetValue());
|
||||||
DrawSingleScreen(screen_infos[eye], top_screen_left, top_screen_top, top_screen_width,
|
DrawSingleScreen(screen_infos[eye], top_screen_left, top_screen_top, top_screen_width,
|
||||||
top_screen_height, orientation);
|
top_screen_height, orientation);
|
||||||
break;
|
break;
|
||||||
@ -761,15 +770,6 @@ void RendererOpenGL::DrawTopScreen(const Layout::FramebufferLayout& layout,
|
|||||||
top_screen_top, top_screen_width / 2, top_screen_height, orientation);
|
top_screen_top, top_screen_width / 2, top_screen_height, orientation);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Settings::StereoRenderOption::TopBottom: {
|
|
||||||
DrawSingleScreen(screen_infos[0], top_screen_left, top_screen_top / 2, top_screen_width,
|
|
||||||
top_screen_height / 2, orientation);
|
|
||||||
glUniform1i(uniform_layer, 1);
|
|
||||||
DrawSingleScreen(screen_infos[1], top_screen_left,
|
|
||||||
static_cast<float>((top_screen_top / 2) + (layout.height / 2)),
|
|
||||||
top_screen_width, top_screen_height / 2, orientation);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Settings::StereoRenderOption::CardboardVR: {
|
case Settings::StereoRenderOption::CardboardVR: {
|
||||||
DrawSingleScreen(screen_infos[0], top_screen_left, top_screen_top, top_screen_width,
|
DrawSingleScreen(screen_infos[0], top_screen_left, top_screen_top, top_screen_width,
|
||||||
top_screen_height, orientation);
|
top_screen_height, orientation);
|
||||||
@ -781,8 +781,8 @@ void RendererOpenGL::DrawTopScreen(const Layout::FramebufferLayout& layout,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Settings::StereoRenderOption::Anaglyph:
|
case Settings::StereoRenderOption::Anaglyph:
|
||||||
case Settings::StereoRenderOption::Interlaced: {
|
case Settings::StereoRenderOption::Interlaced:
|
||||||
glUniform1i(uniform_swap_eyes, Settings::values.swap_eyes.GetValue());
|
case Settings::StereoRenderOption::ReverseInterlaced: {
|
||||||
DrawSingleScreenStereo(screen_infos[0], screen_infos[1], top_screen_left, top_screen_top,
|
DrawSingleScreenStereo(screen_infos[0], screen_infos[1], top_screen_left, top_screen_top,
|
||||||
top_screen_width, top_screen_height, orientation);
|
top_screen_width, top_screen_height, orientation);
|
||||||
break;
|
break;
|
||||||
@ -803,17 +803,8 @@ void RendererOpenGL::DrawBottomScreen(const Layout::FramebufferLayout& layout,
|
|||||||
|
|
||||||
const auto orientation = layout.is_rotated ? Layout::DisplayOrientation::Landscape
|
const auto orientation = layout.is_rotated ? Layout::DisplayOrientation::Landscape
|
||||||
: Layout::DisplayOrientation::Portrait;
|
: Layout::DisplayOrientation::Portrait;
|
||||||
const auto render_3d =
|
|
||||||
#ifndef ANDROID
|
|
||||||
Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows &&
|
|
||||||
Settings::values.render_3d.GetValue() != Settings::StereoRenderOption::Anaglyph
|
|
||||||
? Settings::StereoRenderOption::Off
|
|
||||||
: Settings::values.render_3d.GetValue();
|
|
||||||
#else
|
|
||||||
const auto render_3d = Settings::values.render_3d.GetValue();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (render_3d) {
|
switch (Settings::values.render_3d.GetValue()) {
|
||||||
case Settings::StereoRenderOption::Off: {
|
case Settings::StereoRenderOption::Off: {
|
||||||
DrawSingleScreen(screen_infos[2], bottom_screen_left, bottom_screen_top,
|
DrawSingleScreen(screen_infos[2], bottom_screen_left, bottom_screen_top,
|
||||||
bottom_screen_width, bottom_screen_height, orientation);
|
bottom_screen_width, bottom_screen_height, orientation);
|
||||||
@ -828,15 +819,6 @@ void RendererOpenGL::DrawBottomScreen(const Layout::FramebufferLayout& layout,
|
|||||||
bottom_screen_top, bottom_screen_width / 2, bottom_screen_height, orientation);
|
bottom_screen_top, bottom_screen_width / 2, bottom_screen_height, orientation);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Settings::StereoRenderOption::TopBottom: {
|
|
||||||
DrawSingleScreen(screen_infos[2], bottom_screen_left, bottom_screen_top / 2,
|
|
||||||
bottom_screen_width, bottom_screen_height / 2, orientation);
|
|
||||||
glUniform1i(uniform_layer, 1);
|
|
||||||
DrawSingleScreen(screen_infos[2], bottom_screen_left,
|
|
||||||
static_cast<float>((bottom_screen_top / 2) + (layout.height / 2)),
|
|
||||||
bottom_screen_width, bottom_screen_height / 2, orientation);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Settings::StereoRenderOption::CardboardVR: {
|
case Settings::StereoRenderOption::CardboardVR: {
|
||||||
DrawSingleScreen(screen_infos[2], bottom_screen_left, bottom_screen_top,
|
DrawSingleScreen(screen_infos[2], bottom_screen_left, bottom_screen_top,
|
||||||
bottom_screen_width, bottom_screen_height, orientation);
|
bottom_screen_width, bottom_screen_height, orientation);
|
||||||
@ -848,8 +830,8 @@ void RendererOpenGL::DrawBottomScreen(const Layout::FramebufferLayout& layout,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Settings::StereoRenderOption::Anaglyph:
|
case Settings::StereoRenderOption::Anaglyph:
|
||||||
case Settings::StereoRenderOption::Interlaced: {
|
case Settings::StereoRenderOption::Interlaced:
|
||||||
glUniform1i(uniform_swap_eyes, Settings::values.swap_eyes.GetValue());
|
case Settings::StereoRenderOption::ReverseInterlaced: {
|
||||||
DrawSingleScreenStereo(screen_infos[2], screen_infos[2], bottom_screen_left,
|
DrawSingleScreenStereo(screen_infos[2], screen_infos[2], bottom_screen_left,
|
||||||
bottom_screen_top, bottom_screen_width, bottom_screen_height,
|
bottom_screen_top, bottom_screen_width, bottom_screen_height,
|
||||||
orientation);
|
orientation);
|
||||||
|
@ -103,13 +103,11 @@ private:
|
|||||||
GLuint uniform_modelview_matrix;
|
GLuint uniform_modelview_matrix;
|
||||||
GLuint uniform_color_texture;
|
GLuint uniform_color_texture;
|
||||||
GLuint uniform_color_texture_r;
|
GLuint uniform_color_texture_r;
|
||||||
GLuint uniform_swap_eyes;
|
|
||||||
|
|
||||||
// Shader uniform for Dolphin compatibility
|
// Shader uniform for Dolphin compatibility
|
||||||
GLuint uniform_i_resolution;
|
GLuint uniform_i_resolution;
|
||||||
GLuint uniform_o_resolution;
|
GLuint uniform_o_resolution;
|
||||||
GLuint uniform_layer;
|
GLuint uniform_layer;
|
||||||
GLuint uniform_screen_pos;
|
|
||||||
|
|
||||||
// Shader attribute input indices
|
// Shader attribute input indices
|
||||||
GLuint attrib_position;
|
GLuint attrib_position;
|
||||||
|
Reference in New Issue
Block a user