diff options
Diffstat (limited to 'src/video_core/renderer_opengl')
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 22 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.h | 1 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 1930fa6ef..7810b9147 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -154,6 +154,7 @@ void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuf | |||
| 154 | 154 | ||
| 155 | // Framebuffer orientation handling | 155 | // Framebuffer orientation handling |
| 156 | framebuffer_transform_flags = framebuffer.transform_flags; | 156 | framebuffer_transform_flags = framebuffer.transform_flags; |
| 157 | framebuffer_crop_rect = framebuffer.crop_rect; | ||
| 157 | 158 | ||
| 158 | // Ensure no bad interactions with GL_UNPACK_ALIGNMENT, which by default | 159 | // Ensure no bad interactions with GL_UNPACK_ALIGNMENT, which by default |
| 159 | // only allows rows to have a memory alignement of 4. | 160 | // only allows rows to have a memory alignement of 4. |
| @@ -320,11 +321,24 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x, | |||
| 320 | } | 321 | } |
| 321 | } | 322 | } |
| 322 | 323 | ||
| 324 | ASSERT_MSG(framebuffer_crop_rect.top == 0, "Unimplemented"); | ||
| 325 | ASSERT_MSG(framebuffer_crop_rect.left == 0, "Unimplemented"); | ||
| 326 | |||
| 327 | // Scale the output by the crop width/height. This is commonly used with 1280x720 rendering | ||
| 328 | // (e.g. handheld mode) on a 1920x1080 framebuffer. | ||
| 329 | f32 scale_u = 1.f, scale_v = 1.f; | ||
| 330 | if (framebuffer_crop_rect.GetWidth() > 0) { | ||
| 331 | scale_u = static_cast<f32>(framebuffer_crop_rect.GetWidth()) / screen_info.texture.width; | ||
| 332 | } | ||
| 333 | if (framebuffer_crop_rect.GetHeight() > 0) { | ||
| 334 | scale_v = static_cast<f32>(framebuffer_crop_rect.GetHeight()) / screen_info.texture.height; | ||
| 335 | } | ||
| 336 | |||
| 323 | std::array<ScreenRectVertex, 4> vertices = {{ | 337 | std::array<ScreenRectVertex, 4> vertices = {{ |
| 324 | ScreenRectVertex(x, y, texcoords.top, left), | 338 | ScreenRectVertex(x, y, texcoords.top * scale_u, left * scale_v), |
| 325 | ScreenRectVertex(x + w, y, texcoords.bottom, left), | 339 | ScreenRectVertex(x + w, y, texcoords.bottom * scale_u, left * scale_v), |
| 326 | ScreenRectVertex(x, y + h, texcoords.top, right), | 340 | ScreenRectVertex(x, y + h, texcoords.top * scale_u, right * scale_v), |
| 327 | ScreenRectVertex(x + w, y + h, texcoords.bottom, right), | 341 | ScreenRectVertex(x + w, y + h, texcoords.bottom * scale_u, right * scale_v), |
| 328 | }}; | 342 | }}; |
| 329 | 343 | ||
| 330 | state.texture_units[0].texture_2d = screen_info.display_texture; | 344 | state.texture_units[0].texture_2d = screen_info.display_texture; |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index fd0267cf5..59d92a3dc 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h | |||
| @@ -97,4 +97,5 @@ private: | |||
| 97 | 97 | ||
| 98 | /// Used for transforming the framebuffer orientation | 98 | /// Used for transforming the framebuffer orientation |
| 99 | Tegra::FramebufferConfig::TransformFlags framebuffer_transform_flags; | 99 | Tegra::FramebufferConfig::TransformFlags framebuffer_transform_flags; |
| 100 | MathUtil::Rectangle<int> framebuffer_crop_rect; | ||
| 100 | }; | 101 | }; |