renderer_gl: Add swap eyes options
* Remove reverse interlaced in favour of the checkbox
This commit is contained in:
parent
a9e5e59d9a
commit
651663e5f7
14 changed files with 44 additions and 76 deletions
|
@ -143,7 +143,7 @@ void Config::ReadValues() {
|
|||
ReadSetting("Renderer", Settings::values.use_vsync_new);
|
||||
ReadSetting("Renderer", Settings::values.texture_filter);
|
||||
|
||||
ReadSetting("Renderer", Settings::values.mono_render_option);
|
||||
ReadSetting("Renderer", Settings::values.swap_eyes);
|
||||
ReadSetting("Renderer", Settings::values.render_3d);
|
||||
ReadSetting("Renderer", Settings::values.factor_3d);
|
||||
ReadSetting("Renderer", Settings::values.pp_shader_name);
|
||||
|
|
|
@ -505,9 +505,9 @@ void Config::ReadLayoutValues() {
|
|||
ReadGlobalSetting(Settings::values.swap_screen);
|
||||
ReadGlobalSetting(Settings::values.upright_screen);
|
||||
ReadGlobalSetting(Settings::values.large_screen_proportion);
|
||||
ReadBasicSetting(Settings::values.swap_eyes);
|
||||
|
||||
if (global) {
|
||||
ReadBasicSetting(Settings::values.mono_render_option);
|
||||
ReadBasicSetting(Settings::values.custom_layout);
|
||||
ReadBasicSetting(Settings::values.custom_top_left);
|
||||
ReadBasicSetting(Settings::values.custom_top_top);
|
||||
|
@ -1017,9 +1017,9 @@ void Config::SaveLayoutValues() {
|
|||
WriteGlobalSetting(Settings::values.swap_screen);
|
||||
WriteGlobalSetting(Settings::values.upright_screen);
|
||||
WriteGlobalSetting(Settings::values.large_screen_proportion);
|
||||
WriteBasicSetting(Settings::values.swap_eyes);
|
||||
|
||||
if (global) {
|
||||
WriteBasicSetting(Settings::values.mono_render_option);
|
||||
WriteBasicSetting(Settings::values.custom_layout);
|
||||
WriteBasicSetting(Settings::values.custom_top_left);
|
||||
WriteBasicSetting(Settings::values.custom_top_top);
|
||||
|
|
|
@ -74,9 +74,8 @@ void ConfigureEnhancements::SetConfiguration() {
|
|||
ui->render_3d_combobox->setCurrentIndex(
|
||||
static_cast<int>(Settings::values.render_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());
|
||||
ui->toggle_swap_eyes->setChecked(Settings::values.swap_eyes.GetValue());
|
||||
ui->toggle_linear_filter->setChecked(Settings::values.filter_mode.GetValue());
|
||||
ui->toggle_swap_screen->setChecked(Settings::values.swap_screen.GetValue());
|
||||
ui->toggle_upright_screen->setChecked(Settings::values.upright_screen.GetValue());
|
||||
|
@ -98,8 +97,7 @@ void ConfigureEnhancements::updateShaders(Settings::StereoRenderOption stereo_op
|
|||
ui->shader_combobox->clear();
|
||||
ui->shader_combobox->setEnabled(true);
|
||||
|
||||
if (stereo_option == Settings::StereoRenderOption::Interlaced ||
|
||||
stereo_option == Settings::StereoRenderOption::ReverseInterlaced) {
|
||||
if (stereo_option == Settings::StereoRenderOption::Interlaced) {
|
||||
ui->shader_combobox->addItem(QStringLiteral("horizontal (builtin)"));
|
||||
ui->shader_combobox->setCurrentIndex(0);
|
||||
ui->shader_combobox->setEnabled(false);
|
||||
|
@ -135,8 +133,6 @@ void ConfigureEnhancements::ApplyConfiguration() {
|
|||
Settings::values.render_3d =
|
||||
static_cast<Settings::StereoRenderOption>(ui->render_3d_combobox->currentIndex());
|
||||
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) {
|
||||
Settings::values.anaglyph_shader_name =
|
||||
ui->shader_combobox->itemText(ui->shader_combobox->currentIndex()).toStdString();
|
||||
|
@ -146,6 +142,8 @@ void ConfigureEnhancements::ApplyConfiguration() {
|
|||
}
|
||||
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,
|
||||
ui->toggle_linear_filter, linear_filter);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.texture_filter,
|
||||
|
@ -174,6 +172,7 @@ void ConfigureEnhancements::SetupPerGameUI() {
|
|||
if (Settings::IsConfiguringGlobal()) {
|
||||
ui->widget_resolution->setEnabled(Settings::values.resolution_factor.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_swap_screen->setEnabled(Settings::values.swap_screen.UsingGlobal());
|
||||
ui->toggle_upright_screen->setEnabled(Settings::values.upright_screen.UsingGlobal());
|
||||
|
@ -193,6 +192,8 @@ void ConfigureEnhancements::SetupPerGameUI() {
|
|||
linear_filter);
|
||||
ConfigurationShared::SetColoredTristate(ui->toggle_swap_screen, Settings::values.swap_screen,
|
||||
swap_screen);
|
||||
ConfigurationShared::SetColoredTristate(ui->toggle_swap_eyes, Settings::values.swap_eyes,
|
||||
swap_eyes);
|
||||
ConfigurationShared::SetColoredTristate(ui->toggle_upright_screen,
|
||||
Settings::values.upright_screen, upright_screen);
|
||||
ConfigurationShared::SetColoredTristate(ui->toggle_dump_textures,
|
||||
|
|
|
@ -45,5 +45,6 @@ private:
|
|||
ConfigurationShared::CheckState custom_textures;
|
||||
ConfigurationShared::CheckState preload_textures;
|
||||
ConfigurationShared::CheckState async_custom_loading;
|
||||
ConfigurationShared::CheckState swap_eyes;
|
||||
QColor bg_color;
|
||||
};
|
||||
|
|
|
@ -254,11 +254,6 @@
|
|||
<string>Interlaced</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Reverse Interlaced</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -293,26 +288,12 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<widget class="QCheckBox" name="toggle_swap_eyes">
|
||||
<property name="text">
|
||||
<string>Eye to Render in Monoscopic Mode</string>
|
||||
<string>Swap Eyes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -544,7 +525,6 @@
|
|||
<tabstop>texture_filter_combobox</tabstop>
|
||||
<tabstop>render_3d_combobox</tabstop>
|
||||
<tabstop>factor_3d</tabstop>
|
||||
<tabstop>mono_rendering_eye</tabstop>
|
||||
<tabstop>layout_combobox</tabstop>
|
||||
<tabstop>toggle_swap_screen</tabstop>
|
||||
<tabstop>toggle_upright_screen</tabstop>
|
||||
|
|
|
@ -627,6 +627,8 @@ void GMainWindow::InitializeHotkeys() {
|
|||
Settings::values.frame_limit.SetGlobal(!Settings::values.frame_limit.UsingGlobal());
|
||||
UpdateStatusBar();
|
||||
});
|
||||
connect_shortcut(QStringLiteral("Swap Eyes"),
|
||||
[&] { Settings::values.swap_eyes = !Settings::values.swap_eyes; });
|
||||
connect_shortcut(QStringLiteral("Toggle Texture Dumping"),
|
||||
[&] { Settings::values.dump_textures = !Settings::values.dump_textures; });
|
||||
connect_shortcut(QStringLiteral("Toggle Custom Textures"),
|
||||
|
|
|
@ -84,7 +84,7 @@ void LogSettings() {
|
|||
log_setting("Renderer_TextureFilter", GetTextureFilterName(values.texture_filter.GetValue()));
|
||||
log_setting("Stereoscopy_Render3d", values.render_3d.GetValue());
|
||||
log_setting("Stereoscopy_Factor3d", values.factor_3d.GetValue());
|
||||
log_setting("Stereoscopy_MonoRenderOption", values.mono_render_option.GetValue());
|
||||
log_setting("Stereoscopy_SwapEyes", values.swap_eyes.GetValue());
|
||||
if (values.render_3d.GetValue() == StereoRenderOption::Anaglyph) {
|
||||
log_setting("Renderer_AnaglyphShader", values.anaglyph_shader_name.GetValue());
|
||||
}
|
||||
|
|
|
@ -52,15 +52,7 @@ enum class StereoRenderOption : u32 {
|
|||
TopBottom = 2,
|
||||
Anaglyph = 3,
|
||||
Interlaced = 4,
|
||||
ReverseInterlaced = 5,
|
||||
CardboardVR = 6
|
||||
};
|
||||
|
||||
// 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,
|
||||
CardboardVR = 5
|
||||
};
|
||||
|
||||
enum class AudioEmulation : u32 {
|
||||
|
@ -468,8 +460,7 @@ struct Values {
|
|||
|
||||
SwitchableSetting<StereoRenderOption> render_3d{StereoRenderOption::Off, "render_3d"};
|
||||
SwitchableSetting<u32> factor_3d{0, "factor_3d"};
|
||||
SwitchableSetting<MonoRenderOption> mono_render_option{MonoRenderOption::LeftEye,
|
||||
"mono_render_option"};
|
||||
SwitchableSetting<bool> swap_eyes{false, "swap_eyes"};
|
||||
|
||||
Setting<u32> cardboard_screen_size{85, "cardboard_screen_size"};
|
||||
Setting<s32> cardboard_x_shift{0, "cardboard_x_shift"};
|
||||
|
|
|
@ -151,8 +151,8 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader) {
|
|||
static_cast<int>(Settings::values.render_3d.GetValue()));
|
||||
AddField(Telemetry::FieldType::UserConfig, "Renderer_Factor3d",
|
||||
Settings::values.factor_3d.GetValue());
|
||||
AddField(Telemetry::FieldType::UserConfig, "Renderer_MonoRenderOption",
|
||||
static_cast<int>(Settings::values.mono_render_option.GetValue()));
|
||||
AddField(Telemetry::FieldType::UserConfig, "Renderer_SwapEyes",
|
||||
static_cast<int>(Settings::values.swap_eyes.GetValue()));
|
||||
AddField(Telemetry::FieldType::UserConfig, "System_IsNew3ds",
|
||||
Settings::values.is_new_3ds.GetValue());
|
||||
AddField(Telemetry::FieldType::UserConfig, "System_RegionValue",
|
||||
|
|
|
@ -103,4 +103,4 @@ add_custom_target(host_shaders
|
|||
${SHADER_HEADERS}
|
||||
SOURCES
|
||||
${SHADER_SOURCES}
|
||||
)
|
||||
)
|
|
@ -23,6 +23,7 @@ layout(binding = 1) uniform sampler2D color_texture_r;
|
|||
|
||||
uniform vec4 resolution;
|
||||
uniform int layer;
|
||||
uniform bool swap_eyes;
|
||||
|
||||
const vec3 gamma_map = vec3(1.6, 0.8, 1.0);
|
||||
|
||||
|
@ -37,7 +38,7 @@ vec3 correct_color(vec3 original) {
|
|||
void main() {
|
||||
vec4 color_left = texture(color_texture, frag_tex_coord);
|
||||
vec4 color_right = texture(color_texture_r, frag_tex_coord);
|
||||
vec3 optimized_color = clamp(color_left.rgb * left_filter, vec3(0.0), vec3(1.0)) +
|
||||
clamp(color_right.rgb * right_filter, vec3(0.0), vec3(1.0));
|
||||
vec3 optimized_color = clamp(color_left.rgb * (swap_eyes ? right_filter : left_filter), vec3(0.0), vec3(1.0)) +
|
||||
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,18 +7,22 @@
|
|||
layout(location = 0) in vec2 frag_tex_coord;
|
||||
layout(location = 0) out vec4 color;
|
||||
|
||||
layout(binding = 0) uniform sampler2D color_texture;
|
||||
layout(binding = 0) uniform sampler2D color_texture_l;
|
||||
layout(binding = 1) uniform sampler2D color_texture_r;
|
||||
|
||||
uniform vec4 o_resolution;
|
||||
uniform int reverse_interlaced;
|
||||
uniform ivec2 screen_pos;
|
||||
uniform bool swap_eyes;
|
||||
|
||||
void main() {
|
||||
float screen_row = o_resolution.x * frag_tex_coord.x;
|
||||
const int is_even = int(screen_pos.y % 2 == 0);
|
||||
if (int(screen_row) % 2 == is_even)
|
||||
color = texture(color_texture, frag_tex_coord);
|
||||
else
|
||||
bool is_even = screen_pos.y % 2 == 0;
|
||||
if (swap_eyes) {
|
||||
is_even = !is_even;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -404,9 +404,7 @@ void RendererOpenGL::ReloadShader() {
|
|||
shader_data += shader_text;
|
||||
}
|
||||
}
|
||||
} else if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Interlaced ||
|
||||
Settings::values.render_3d.GetValue() ==
|
||||
Settings::StereoRenderOption::ReverseInterlaced) {
|
||||
} else if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Interlaced) {
|
||||
shader_data += HostShaders::OPENGL_PRESENT_INTERLACED_FRAG;
|
||||
} else {
|
||||
if (Settings::values.pp_shader_name.GetValue() == "none (builtin)") {
|
||||
|
@ -428,20 +426,10 @@ void RendererOpenGL::ReloadShader() {
|
|||
uniform_modelview_matrix = glGetUniformLocation(shader.handle, "modelview_matrix");
|
||||
uniform_color_texture = glGetUniformLocation(shader.handle, "color_texture");
|
||||
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Anaglyph ||
|
||||
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Interlaced ||
|
||||
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::ReverseInterlaced) {
|
||||
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Interlaced) {
|
||||
uniform_swap_eyes = glGetUniformLocation(shader.handle, "swap_eyes");
|
||||
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_o_resolution = glGetUniformLocation(shader.handle, "o_resolution");
|
||||
uniform_layer = glGetUniformLocation(shader.handle, "layer");
|
||||
|
@ -686,8 +674,7 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f
|
|||
|
||||
const bool stereo_single_screen =
|
||||
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Anaglyph ||
|
||||
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Interlaced ||
|
||||
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::ReverseInterlaced;
|
||||
Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Interlaced;
|
||||
|
||||
// Set the screen position
|
||||
const auto screen_pos = render_window.GetScreenPos() +
|
||||
|
@ -760,7 +747,7 @@ void RendererOpenGL::DrawTopScreen(const Layout::FramebufferLayout& layout,
|
|||
: Layout::DisplayOrientation::Portrait;
|
||||
switch (Settings::values.render_3d.GetValue()) {
|
||||
case Settings::StereoRenderOption::Off: {
|
||||
const int eye = static_cast<int>(Settings::values.mono_render_option.GetValue());
|
||||
const u32 eye = static_cast<u32>(Settings::values.swap_eyes.GetValue());
|
||||
DrawSingleScreen(screen_infos[eye], top_screen_left, top_screen_top, top_screen_width,
|
||||
top_screen_height, orientation);
|
||||
break;
|
||||
|
@ -794,8 +781,8 @@ void RendererOpenGL::DrawTopScreen(const Layout::FramebufferLayout& layout,
|
|||
break;
|
||||
}
|
||||
case Settings::StereoRenderOption::Anaglyph:
|
||||
case Settings::StereoRenderOption::Interlaced:
|
||||
case Settings::StereoRenderOption::ReverseInterlaced: {
|
||||
case Settings::StereoRenderOption::Interlaced: {
|
||||
glUniform1i(uniform_swap_eyes, Settings::values.swap_eyes.GetValue());
|
||||
DrawSingleScreenStereo(screen_infos[0], screen_infos[1], top_screen_left, top_screen_top,
|
||||
top_screen_width, top_screen_height, orientation);
|
||||
break;
|
||||
|
@ -852,8 +839,8 @@ void RendererOpenGL::DrawBottomScreen(const Layout::FramebufferLayout& layout,
|
|||
break;
|
||||
}
|
||||
case Settings::StereoRenderOption::Anaglyph:
|
||||
case Settings::StereoRenderOption::Interlaced:
|
||||
case Settings::StereoRenderOption::ReverseInterlaced: {
|
||||
case Settings::StereoRenderOption::Interlaced: {
|
||||
glUniform1i(uniform_swap_eyes, Settings::values.swap_eyes.GetValue());
|
||||
DrawSingleScreenStereo(screen_infos[2], screen_infos[2], bottom_screen_left,
|
||||
bottom_screen_top, bottom_screen_width, bottom_screen_height,
|
||||
orientation);
|
||||
|
|
|
@ -103,6 +103,7 @@ private:
|
|||
GLuint uniform_modelview_matrix;
|
||||
GLuint uniform_color_texture;
|
||||
GLuint uniform_color_texture_r;
|
||||
GLuint uniform_swap_eyes;
|
||||
|
||||
// Shader uniform for Dolphin compatibility
|
||||
GLuint uniform_i_resolution;
|
||||
|
|
Loading…
Reference in a new issue