Update framebuffer layout and renderers to correctly render hybrid mode on both primary and secondary displays

This commit is contained in:
David Griswold 2026-05-10 08:54:58 +03:00 committed by OpenSauce
parent 41b4e77206
commit 21fbf9f5ca
4 changed files with 11 additions and 9 deletions

View file

@ -275,18 +275,19 @@ FramebufferLayout HybridScreenLayout(u32 width, u32 height, bool swapped, bool u
std::swap(width, height);
}
// Split the window into two parts. Give 2.25x width to the main screen,
// and make a bar on the right side with 1x width top screen and 1.25x width bottom screen
// To do that, find the total emulation box and maximize that based on window size
// use Large Screen layout with these specific ratios to get two of the pieces
const float scale_factor = swapped ? 2.25 : 1.8;
const Settings::SmallScreenPosition pos = swapped ? Settings::SmallScreenPosition::TopRight
: Settings::SmallScreenPosition::BottomRight;
FramebufferLayout res = LargeFrameLayout(width, height, swapped, upright, scale_factor, pos);
// always pass false as the upright value here, as it is being handled here not there
FramebufferLayout res = LargeFrameLayout(width, height, swapped, false, scale_factor, pos);
const Common::Rectangle<u32> main = swapped ? res.bottom_screen : res.top_screen;
const Common::Rectangle<u32> small = swapped ? res.top_screen : res.bottom_screen;
res.additional_screen = Common::Rectangle<u32>{small.left, swapped ? small.bottom : main.top,
small.right, swapped ? main.bottom : small.top};
res.additional_screen_is_bottom = swapped;
res.additional_screen_enabled = true;
res.is_rotated = !upright;
if (upright) {
return reverseLayout(res);
} else {

View file

@ -32,13 +32,14 @@ struct FramebufferLayout {
bool bottom_screen_enabled;
Common::Rectangle<u32> top_screen;
Common::Rectangle<u32> bottom_screen;
// is_rotated is true when the screen is in landscape mode - not sure why!
bool is_rotated = true;
bool is_portrait = false;
bool additional_screen_enabled;
bool additional_screen_enabled = false;
// top_opacity is currently not used but could be used in the future
float top_opacity = 1.0f;
float bottom_opacity = 1.0f;
bool additional_screen_is_bottom = false;
Common::Rectangle<u32> additional_screen;
CardboardSettings cardboard;
/**

View file

@ -706,7 +706,7 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f
if (layout.additional_screen_enabled) {
const auto& additional_screen = layout.additional_screen;
if (!Settings::values.swap_screen.GetValue()) {
if (!layout.additional_screen_is_bottom) {
DrawTopScreen(layout, additional_screen);
} else {
DrawBottomScreen(layout, additional_screen);

View file

@ -1037,7 +1037,7 @@ void RendererVulkan::DrawScreens(Frame* frame, const Layout::FramebufferLayout&
if (layout.additional_screen_enabled) {
const auto& additional_screen = layout.additional_screen;
if (!Settings::values.swap_screen.GetValue()) {
if (!layout.additional_screen_is_bottom) {
DrawTopScreen(layout, additional_screen);
} else {
DrawBottomScreen(layout, additional_screen);