|
|
|
@ -1002,13 +1002,43 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
glUniform1i(uniform_layer, 0);
|
|
|
|
|
if (layout.top_screen_enabled) {
|
|
|
|
|
if (!Settings::values.swap_screen) {
|
|
|
|
|
DrawTopScreen(layout, top_screen, stereo_single_screen);
|
|
|
|
|
glUniform1i(uniform_layer, 0);
|
|
|
|
|
ApplySecondLayerOpacity();
|
|
|
|
|
DrawBottomScreen(layout, bottom_screen, stereo_single_screen);
|
|
|
|
|
} else {
|
|
|
|
|
DrawBottomScreen(layout, bottom_screen, stereo_single_screen);
|
|
|
|
|
glUniform1i(uniform_layer, 0);
|
|
|
|
|
ApplySecondLayerOpacity();
|
|
|
|
|
DrawTopScreen(layout, top_screen, stereo_single_screen);
|
|
|
|
|
}
|
|
|
|
|
state.blend.enabled = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RendererOpenGL::ApplySecondLayerOpacity() {
|
|
|
|
|
if (Settings::values.custom_layout &&
|
|
|
|
|
Settings::values.custom_second_layer_opacity.GetValue() < 100) {
|
|
|
|
|
state.blend.enabled = true;
|
|
|
|
|
state.blend.src_rgb_func = GL_CONSTANT_ALPHA;
|
|
|
|
|
state.blend.src_a_func = GL_CONSTANT_ALPHA;
|
|
|
|
|
state.blend.dst_a_func = GL_ONE_MINUS_CONSTANT_ALPHA;
|
|
|
|
|
state.blend.dst_rgb_func = GL_ONE_MINUS_CONSTANT_ALPHA;
|
|
|
|
|
state.blend.color.alpha = Settings::values.custom_second_layer_opacity.GetValue() / 100.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RendererOpenGL::DrawTopScreen(const Layout::FramebufferLayout& layout,
|
|
|
|
|
const Common::Rectangle<u32>& top_screen,
|
|
|
|
|
const bool stereo_single_screen) {
|
|
|
|
|
if (!layout.top_screen_enabled) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (layout.is_rotated) {
|
|
|
|
|
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Off) {
|
|
|
|
|
int eye = static_cast<int>(Settings::values.mono_render_option.GetValue());
|
|
|
|
|
DrawSingleScreenRotated(screen_infos[eye], (float)top_screen.left,
|
|
|
|
|
(float)top_screen.top, (float)top_screen.GetWidth(),
|
|
|
|
|
(float)top_screen.GetHeight());
|
|
|
|
|
DrawSingleScreenRotated(screen_infos[0], (float)top_screen.left, (float)top_screen.top,
|
|
|
|
|
(float)top_screen.GetWidth(), (float)top_screen.GetHeight());
|
|
|
|
|
} else if (Settings::values.render_3d.GetValue() ==
|
|
|
|
|
Settings::StereoRenderOption::SideBySide) {
|
|
|
|
|
DrawSingleScreenRotated(screen_infos[0], (float)top_screen.left / 2,
|
|
|
|
@ -1021,24 +1051,20 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f
|
|
|
|
|
(float)top_screen.GetHeight());
|
|
|
|
|
} else if (Settings::values.render_3d.GetValue() ==
|
|
|
|
|
Settings::StereoRenderOption::CardboardVR) {
|
|
|
|
|
DrawSingleScreenRotated(screen_infos[0], layout.top_screen.left,
|
|
|
|
|
layout.top_screen.top, layout.top_screen.GetWidth(),
|
|
|
|
|
layout.top_screen.GetHeight());
|
|
|
|
|
DrawSingleScreenRotated(screen_infos[0], layout.top_screen.left, layout.top_screen.top,
|
|
|
|
|
layout.top_screen.GetWidth(), layout.top_screen.GetHeight());
|
|
|
|
|
glUniform1i(uniform_layer, 1);
|
|
|
|
|
DrawSingleScreenRotated(screen_infos[1],
|
|
|
|
|
layout.cardboard.top_screen_right_eye +
|
|
|
|
|
((float)layout.width / 2),
|
|
|
|
|
layout.top_screen.top, layout.top_screen.GetWidth(),
|
|
|
|
|
layout.top_screen.GetHeight());
|
|
|
|
|
DrawSingleScreenRotated(
|
|
|
|
|
screen_infos[1], layout.cardboard.top_screen_right_eye + ((float)layout.width / 2),
|
|
|
|
|
layout.top_screen.top, layout.top_screen.GetWidth(), layout.top_screen.GetHeight());
|
|
|
|
|
} else if (stereo_single_screen) {
|
|
|
|
|
DrawSingleScreenStereoRotated(
|
|
|
|
|
screen_infos[0], screen_infos[1], (float)top_screen.left, (float)top_screen.top,
|
|
|
|
|
(float)top_screen.GetWidth(), (float)top_screen.GetHeight());
|
|
|
|
|
DrawSingleScreenStereoRotated(screen_infos[0], screen_infos[1], (float)top_screen.left,
|
|
|
|
|
(float)top_screen.top, (float)top_screen.GetWidth(),
|
|
|
|
|
(float)top_screen.GetHeight());
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Off) {
|
|
|
|
|
int eye = static_cast<int>(Settings::values.mono_render_option.GetValue());
|
|
|
|
|
DrawSingleScreen(screen_infos[eye], (float)top_screen.left, (float)top_screen.top,
|
|
|
|
|
DrawSingleScreen(screen_infos[0], (float)top_screen.left, (float)top_screen.top,
|
|
|
|
|
(float)top_screen.GetWidth(), (float)top_screen.GetHeight());
|
|
|
|
|
} else if (Settings::values.render_3d.GetValue() ==
|
|
|
|
|
Settings::StereoRenderOption::SideBySide) {
|
|
|
|
@ -1054,19 +1080,24 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f
|
|
|
|
|
DrawSingleScreen(screen_infos[0], layout.top_screen.left, layout.top_screen.top,
|
|
|
|
|
layout.top_screen.GetWidth(), layout.top_screen.GetHeight());
|
|
|
|
|
glUniform1i(uniform_layer, 1);
|
|
|
|
|
DrawSingleScreen(screen_infos[1],
|
|
|
|
|
layout.cardboard.top_screen_right_eye + ((float)layout.width / 2),
|
|
|
|
|
layout.top_screen.top, layout.top_screen.GetWidth(),
|
|
|
|
|
layout.top_screen.GetHeight());
|
|
|
|
|
DrawSingleScreen(
|
|
|
|
|
screen_infos[1], layout.cardboard.top_screen_right_eye + ((float)layout.width / 2),
|
|
|
|
|
layout.top_screen.top, layout.top_screen.GetWidth(), layout.top_screen.GetHeight());
|
|
|
|
|
} else if (stereo_single_screen) {
|
|
|
|
|
DrawSingleScreenStereo(screen_infos[0], screen_infos[1], (float)top_screen.left,
|
|
|
|
|
(float)top_screen.top, (float)top_screen.GetWidth(),
|
|
|
|
|
(float)top_screen.GetHeight());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RendererOpenGL::DrawBottomScreen(const Layout::FramebufferLayout& layout,
|
|
|
|
|
const Common::Rectangle<u32>& bottom_screen,
|
|
|
|
|
const bool stereo_single_screen) {
|
|
|
|
|
if (!layout.bottom_screen_enabled) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
glUniform1i(uniform_layer, 0);
|
|
|
|
|
if (layout.bottom_screen_enabled) {
|
|
|
|
|
|
|
|
|
|
if (layout.is_rotated) {
|
|
|
|
|
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Off) {
|
|
|
|
|
DrawSingleScreenRotated(screen_infos[2], (float)bottom_screen.left,
|
|
|
|
@ -1074,12 +1105,12 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f
|
|
|
|
|
(float)bottom_screen.GetHeight());
|
|
|
|
|
} else if (Settings::values.render_3d.GetValue() ==
|
|
|
|
|
Settings::StereoRenderOption::SideBySide) {
|
|
|
|
|
DrawSingleScreenRotated(
|
|
|
|
|
screen_infos[2], (float)bottom_screen.left / 2, (float)bottom_screen.top,
|
|
|
|
|
(float)bottom_screen.GetWidth() / 2, (float)bottom_screen.GetHeight());
|
|
|
|
|
DrawSingleScreenRotated(screen_infos[2], (float)bottom_screen.left / 2,
|
|
|
|
|
(float)bottom_screen.top, (float)bottom_screen.GetWidth() / 2,
|
|
|
|
|
(float)bottom_screen.GetHeight());
|
|
|
|
|
glUniform1i(uniform_layer, 1);
|
|
|
|
|
DrawSingleScreenRotated(
|
|
|
|
|
screen_infos[2], ((float)bottom_screen.left / 2) + ((float)layout.width / 2),
|
|
|
|
|
DrawSingleScreenRotated(screen_infos[2],
|
|
|
|
|
((float)bottom_screen.left / 2) + ((float)layout.width / 2),
|
|
|
|
|
(float)bottom_screen.top, (float)bottom_screen.GetWidth() / 2,
|
|
|
|
|
(float)bottom_screen.GetHeight());
|
|
|
|
|
} else if (Settings::values.render_3d.GetValue() ==
|
|
|
|
@ -1101,9 +1132,8 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (Settings::values.render_3d.GetValue() == Settings::StereoRenderOption::Off) {
|
|
|
|
|
DrawSingleScreen(screen_infos[2], (float)bottom_screen.left,
|
|
|
|
|
(float)bottom_screen.top, (float)bottom_screen.GetWidth(),
|
|
|
|
|
(float)bottom_screen.GetHeight());
|
|
|
|
|
DrawSingleScreen(screen_infos[2], (float)bottom_screen.left, (float)bottom_screen.top,
|
|
|
|
|
(float)bottom_screen.GetWidth(), (float)bottom_screen.GetHeight());
|
|
|
|
|
} else if (Settings::values.render_3d.GetValue() ==
|
|
|
|
|
Settings::StereoRenderOption::SideBySide) {
|
|
|
|
|
DrawSingleScreen(screen_infos[2], (float)bottom_screen.left / 2,
|
|
|
|
@ -1116,13 +1146,11 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f
|
|
|
|
|
(float)bottom_screen.GetHeight());
|
|
|
|
|
} else if (Settings::values.render_3d.GetValue() ==
|
|
|
|
|
Settings::StereoRenderOption::CardboardVR) {
|
|
|
|
|
DrawSingleScreen(screen_infos[2], layout.bottom_screen.left,
|
|
|
|
|
layout.bottom_screen.top, layout.bottom_screen.GetWidth(),
|
|
|
|
|
layout.bottom_screen.GetHeight());
|
|
|
|
|
DrawSingleScreen(screen_infos[2], layout.bottom_screen.left, layout.bottom_screen.top,
|
|
|
|
|
layout.bottom_screen.GetWidth(), layout.bottom_screen.GetHeight());
|
|
|
|
|
glUniform1i(uniform_layer, 1);
|
|
|
|
|
DrawSingleScreen(screen_infos[2],
|
|
|
|
|
layout.cardboard.bottom_screen_right_eye +
|
|
|
|
|
((float)layout.width / 2),
|
|
|
|
|
layout.cardboard.bottom_screen_right_eye + ((float)layout.width / 2),
|
|
|
|
|
layout.bottom_screen.top, layout.bottom_screen.GetWidth(),
|
|
|
|
|
layout.bottom_screen.GetHeight());
|
|
|
|
|
} else if (stereo_single_screen) {
|
|
|
|
@ -1131,7 +1159,6 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f
|
|
|
|
|
(float)bottom_screen.GetHeight());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RendererOpenGL::TryPresent(int timeout_ms, bool is_secondary) {
|
|
|
|
|