summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2018-01-09 22:47:49 -0500
committerGravatar bunnei2018-01-10 23:28:49 -0500
commit9e2ad45c9872f8f81d0e67cf08320fa388f2ca21 (patch)
tree08e83d5a4d6c1faca6a417c78f1076b9bb1c9c8c
parentCMakeLists: Add framebuffer_layout.cpp. (diff)
downloadyuzu-9e2ad45c9872f8f81d0e67cf08320fa388f2ca21.tar.gz
yuzu-9e2ad45c9872f8f81d0e67cf08320fa388f2ca21.tar.xz
yuzu-9e2ad45c9872f8f81d0e67cf08320fa388f2ca21.zip
renderer_opengl: Update DrawScreens for Switch.
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp32
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.h2
2 files changed, 11 insertions, 23 deletions
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 65c18aecc..ee9291f8c 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -349,19 +349,15 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
349 state.Apply(); 349 state.Apply();
350} 350}
351 351
352/** 352void RendererOpenGL::DrawSingleScreen(const ScreenInfo& screen_info, float x, float y, float w,
353 * Draws a single texture to the emulator window, rotating the texture to correct for the 3DS's LCD 353 float h) {
354 * rotation.
355 */
356void RendererOpenGL::DrawSingleScreenRotated(const ScreenInfo& screen_info, float x, float y,
357 float w, float h) {
358 auto& texcoords = screen_info.display_texcoords; 354 auto& texcoords = screen_info.display_texcoords;
359 355
360 std::array<ScreenRectVertex, 4> vertices = {{ 356 std::array<ScreenRectVertex, 4> vertices = {{
361 ScreenRectVertex(x, y, texcoords.bottom, texcoords.left), 357 ScreenRectVertex(x, y, texcoords.top, texcoords.left),
362 ScreenRectVertex(x + w, y, texcoords.bottom, texcoords.right), 358 ScreenRectVertex(x + w, y, texcoords.bottom, texcoords.left),
363 ScreenRectVertex(x, y + h, texcoords.top, texcoords.left), 359 ScreenRectVertex(x, y + h, texcoords.top, texcoords.right),
364 ScreenRectVertex(x + w, y + h, texcoords.top, texcoords.right), 360 ScreenRectVertex(x + w, y + h, texcoords.bottom, texcoords.right),
365 }}; 361 }};
366 362
367 state.texture_units[0].texture_2d = screen_info.display_texture; 363 state.texture_units[0].texture_2d = screen_info.display_texture;
@@ -378,9 +374,8 @@ void RendererOpenGL::DrawSingleScreenRotated(const ScreenInfo& screen_info, floa
378 * Draws the emulated screens to the emulator window. 374 * Draws the emulated screens to the emulator window.
379 */ 375 */
380void RendererOpenGL::DrawScreens() { 376void RendererOpenGL::DrawScreens() {
381 auto layout = render_window->GetFramebufferLayout(); 377 const auto& layout = render_window->GetFramebufferLayout();
382 const auto& top_screen = layout.top_screen; 378 const auto& screen = layout.screen;
383 const auto& bottom_screen = layout.bottom_screen;
384 379
385 glViewport(0, 0, layout.width, layout.height); 380 glViewport(0, 0, layout.width, layout.height);
386 glClear(GL_COLOR_BUFFER_BIT); 381 glClear(GL_COLOR_BUFFER_BIT);
@@ -394,15 +389,8 @@ void RendererOpenGL::DrawScreens() {
394 glActiveTexture(GL_TEXTURE0); 389 glActiveTexture(GL_TEXTURE0);
395 glUniform1i(uniform_color_texture, 0); 390 glUniform1i(uniform_color_texture, 0);
396 391
397 if (layout.top_screen_enabled) { 392 DrawSingleScreen(screen_infos[0], (float)screen.left, (float)screen.top,
398 DrawSingleScreenRotated(screen_infos[0], (float)top_screen.left, (float)top_screen.top, 393 (float)screen.GetWidth(), (float)screen.GetHeight());
399 (float)top_screen.GetWidth(), (float)top_screen.GetHeight());
400 }
401 if (layout.bottom_screen_enabled) {
402 DrawSingleScreenRotated(screen_infos[1], (float)bottom_screen.left,
403 (float)bottom_screen.top, (float)bottom_screen.GetWidth(),
404 (float)bottom_screen.GetHeight());
405 }
406 394
407 m_current_frame++; 395 m_current_frame++;
408} 396}
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h
index 0b4f69e8f..111b78466 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.h
+++ b/src/video_core/renderer_opengl/renderer_opengl.h
@@ -57,7 +57,7 @@ private:
57 void ConfigureFramebufferTexture(TextureInfo& texture, 57 void ConfigureFramebufferTexture(TextureInfo& texture,
58 const GPU::Regs::FramebufferConfig& framebuffer); 58 const GPU::Regs::FramebufferConfig& framebuffer);
59 void DrawScreens(); 59 void DrawScreens();
60 void DrawSingleScreenRotated(const ScreenInfo& screen_info, float x, float y, float w, float h); 60 void DrawSingleScreen(const ScreenInfo& screen_info, float x, float y, float w, float h);
61 void UpdateFramerate(); 61 void UpdateFramerate();
62 62
63 // Loads framebuffer from emulated memory into the display information structure 63 // Loads framebuffer from emulated memory into the display information structure