Skip to content

Commit

Permalink
Disable 3D for Touch Screen in Separate Window
Browse files Browse the repository at this point in the history
  • Loading branch information
oneup03 committed Mar 15, 2024
1 parent daaa44b commit affac17
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 21 deletions.
12 changes: 8 additions & 4 deletions src/core/frontend/emu_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ bool EmuWindow::IsWithinTouchscreen(const Layout::FramebufferLayout& layout, uns

std::tuple<unsigned, unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) const {
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 &&
Settings::values.layout_option.GetValue() != Settings::LayoutOption::SeparateWindows)
new_x -= framebuffer_layout.width / 2;
else if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::CardboardVR)
new_x -=
(framebuffer_layout.width / 2) - (framebuffer_layout.cardboard.user_x_shift * 2);
}
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide) {
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide &&
Settings::values.layout_option.GetValue() != Settings::LayoutOption::SeparateWindows) {
new_x = std::max(new_x, framebuffer_layout.bottom_screen.left / 2);
new_x = std::min(new_x, framebuffer_layout.bottom_screen.right / 2 - 1);
} else {
Expand Down Expand Up @@ -126,14 +128,16 @@ bool EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) {
return false;

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 &&
Settings::values.layout_option.GetValue() != Settings::LayoutOption::SeparateWindows)
framebuffer_x -= framebuffer_layout.width / 2;
else if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::CardboardVR)
framebuffer_x -=
(framebuffer_layout.width / 2) - (framebuffer_layout.cardboard.user_x_shift * 2);
}
std::scoped_lock guard(touch_state->mutex);
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide) {
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::SideBySide &&
Settings::values.layout_option.GetValue() != Settings::LayoutOption::SeparateWindows) {
touch_state->touch_x =
static_cast<float>(framebuffer_x - framebuffer_layout.bottom_screen.left / 2) /
(framebuffer_layout.bottom_screen.right / 2 -
Expand Down
28 changes: 19 additions & 9 deletions src/video_core/renderer_opengl/renderer_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,12 +788,17 @@ void RendererOpenGL::DrawBottomScreen(const Layout::FramebufferLayout& layout,
break;
}
case Settings::StereoRenderOption::SideBySide: {
DrawSingleScreen(screen_infos[2], bottom_screen_left / 2, bottom_screen_top,
bottom_screen_width / 2, bottom_screen_height, orientation);
glUniform1i(uniform_layer, 1);
DrawSingleScreen(
screen_infos[2], static_cast<float>((bottom_screen_left / 2) + (layout.width / 2)),
bottom_screen_top, bottom_screen_width / 2, bottom_screen_height, orientation);
if (Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows){
DrawSingleScreen(screen_infos[2], bottom_screen_left, bottom_screen_top,
bottom_screen_width, bottom_screen_height, orientation);
} else {
DrawSingleScreen(screen_infos[2], bottom_screen_left / 2, bottom_screen_top,
bottom_screen_width / 2, bottom_screen_height, orientation);
glUniform1i(uniform_layer, 1);
DrawSingleScreen(
screen_infos[2], static_cast<float>((bottom_screen_left / 2) + (layout.width / 2)),
bottom_screen_top, bottom_screen_width / 2, bottom_screen_height, orientation);
}
break;
}
case Settings::StereoRenderOption::CardboardVR: {
Expand All @@ -809,9 +814,14 @@ void RendererOpenGL::DrawBottomScreen(const Layout::FramebufferLayout& layout,
case Settings::StereoRenderOption::Anaglyph:
case Settings::StereoRenderOption::Interlaced:
case Settings::StereoRenderOption::ReverseInterlaced: {
DrawSingleScreenStereo(screen_infos[2], screen_infos[2], bottom_screen_left,
bottom_screen_top, bottom_screen_width, bottom_screen_height,
orientation);
if (Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows){
DrawSingleScreen(screen_infos[2], bottom_screen_left, bottom_screen_top,
bottom_screen_width, bottom_screen_height, orientation);
} else {
DrawSingleScreenStereo(screen_infos[2], screen_infos[2], bottom_screen_left,
bottom_screen_top, bottom_screen_width, bottom_screen_height,
orientation);
}
break;
}
}
Expand Down
26 changes: 18 additions & 8 deletions src/video_core/renderer_vulkan/renderer_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,12 +743,17 @@ void RendererVulkan::DrawBottomScreen(const Layout::FramebufferLayout& layout,
break;
}
case Settings::StereoRenderOption::SideBySide: {
DrawSingleScreen(2, bottom_screen_left / 2, bottom_screen_top, bottom_screen_width / 2,
bottom_screen_height, orientation);
draw_info.layer = 1;
DrawSingleScreen(2, static_cast<float>((bottom_screen_left / 2) + (layout.width / 2)),
bottom_screen_top, bottom_screen_width / 2, bottom_screen_height,
orientation);
if (Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows){
DrawSingleScreen(2, bottom_screen_left, bottom_screen_top, bottom_screen_width,
bottom_screen_height, orientation);
} else {
DrawSingleScreen(2, bottom_screen_left / 2, bottom_screen_top, bottom_screen_width / 2,
bottom_screen_height, orientation);
draw_info.layer = 1;
DrawSingleScreen(2, static_cast<float>((bottom_screen_left / 2) + (layout.width / 2)),
bottom_screen_top, bottom_screen_width / 2, bottom_screen_height,
orientation);
}
break;
}
case Settings::StereoRenderOption::CardboardVR: {
Expand All @@ -763,8 +768,13 @@ void RendererVulkan::DrawBottomScreen(const Layout::FramebufferLayout& layout,
case Settings::StereoRenderOption::Anaglyph:
case Settings::StereoRenderOption::Interlaced:
case Settings::StereoRenderOption::ReverseInterlaced: {
DrawSingleScreenStereo(2, 2, bottom_screen_left, bottom_screen_top, bottom_screen_width,
bottom_screen_height, orientation);
if (Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows){
DrawSingleScreen(2, bottom_screen_left, bottom_screen_top, bottom_screen_width,
bottom_screen_height, orientation);
} else {
DrawSingleScreenStereo(2, 2, bottom_screen_left, bottom_screen_top, bottom_screen_width,
bottom_screen_height, orientation);
}
break;
}
}
Expand Down

0 comments on commit affac17

Please sign in to comment.