renderer_opengl: Update DrawScreens for Switch.
This commit is contained in:
parent
292135a3b7
commit
9e2ad45c98
|
@ -349,19 +349,15 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
|
||||||
state.Apply();
|
state.Apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void RendererOpenGL::DrawSingleScreen(const ScreenInfo& screen_info, float x, float y, float w,
|
||||||
* Draws a single texture to the emulator window, rotating the texture to correct for the 3DS's LCD
|
float h) {
|
||||||
* rotation.
|
|
||||||
*/
|
|
||||||
void RendererOpenGL::DrawSingleScreenRotated(const ScreenInfo& screen_info, float x, float y,
|
|
||||||
float w, float h) {
|
|
||||||
auto& texcoords = screen_info.display_texcoords;
|
auto& texcoords = screen_info.display_texcoords;
|
||||||
|
|
||||||
std::array<ScreenRectVertex, 4> vertices = {{
|
std::array<ScreenRectVertex, 4> vertices = {{
|
||||||
ScreenRectVertex(x, y, texcoords.bottom, texcoords.left),
|
ScreenRectVertex(x, y, texcoords.top, texcoords.left),
|
||||||
ScreenRectVertex(x + w, y, texcoords.bottom, texcoords.right),
|
ScreenRectVertex(x + w, y, texcoords.bottom, texcoords.left),
|
||||||
ScreenRectVertex(x, y + h, texcoords.top, texcoords.left),
|
ScreenRectVertex(x, y + h, texcoords.top, texcoords.right),
|
||||||
ScreenRectVertex(x + w, y + h, texcoords.top, texcoords.right),
|
ScreenRectVertex(x + w, y + h, texcoords.bottom, texcoords.right),
|
||||||
}};
|
}};
|
||||||
|
|
||||||
state.texture_units[0].texture_2d = screen_info.display_texture;
|
state.texture_units[0].texture_2d = screen_info.display_texture;
|
||||||
|
@ -378,9 +374,8 @@ void RendererOpenGL::DrawSingleScreenRotated(const ScreenInfo& screen_info, floa
|
||||||
* Draws the emulated screens to the emulator window.
|
* Draws the emulated screens to the emulator window.
|
||||||
*/
|
*/
|
||||||
void RendererOpenGL::DrawScreens() {
|
void RendererOpenGL::DrawScreens() {
|
||||||
auto layout = render_window->GetFramebufferLayout();
|
const auto& layout = render_window->GetFramebufferLayout();
|
||||||
const auto& top_screen = layout.top_screen;
|
const auto& screen = layout.screen;
|
||||||
const auto& bottom_screen = layout.bottom_screen;
|
|
||||||
|
|
||||||
glViewport(0, 0, layout.width, layout.height);
|
glViewport(0, 0, layout.width, layout.height);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
@ -394,15 +389,8 @@ void RendererOpenGL::DrawScreens() {
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glUniform1i(uniform_color_texture, 0);
|
glUniform1i(uniform_color_texture, 0);
|
||||||
|
|
||||||
if (layout.top_screen_enabled) {
|
DrawSingleScreen(screen_infos[0], (float)screen.left, (float)screen.top,
|
||||||
DrawSingleScreenRotated(screen_infos[0], (float)top_screen.left, (float)top_screen.top,
|
(float)screen.GetWidth(), (float)screen.GetHeight());
|
||||||
(float)top_screen.GetWidth(), (float)top_screen.GetHeight());
|
|
||||||
}
|
|
||||||
if (layout.bottom_screen_enabled) {
|
|
||||||
DrawSingleScreenRotated(screen_infos[1], (float)bottom_screen.left,
|
|
||||||
(float)bottom_screen.top, (float)bottom_screen.GetWidth(),
|
|
||||||
(float)bottom_screen.GetHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
m_current_frame++;
|
m_current_frame++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ private:
|
||||||
void ConfigureFramebufferTexture(TextureInfo& texture,
|
void ConfigureFramebufferTexture(TextureInfo& texture,
|
||||||
const GPU::Regs::FramebufferConfig& framebuffer);
|
const GPU::Regs::FramebufferConfig& framebuffer);
|
||||||
void DrawScreens();
|
void DrawScreens();
|
||||||
void DrawSingleScreenRotated(const ScreenInfo& screen_info, float x, float y, float w, float h);
|
void DrawSingleScreen(const ScreenInfo& screen_info, float x, float y, float w, float h);
|
||||||
void UpdateFramerate();
|
void UpdateFramerate();
|
||||||
|
|
||||||
// Loads framebuffer from emulated memory into the display information structure
|
// Loads framebuffer from emulated memory into the display information structure
|
||||||
|
|
Loading…
Reference in a new issue