summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/renderer_opengl.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-18 02:11:41 +0200
committerbunnei <bunneidev@gmail.com>2018-07-18 02:13:17 +0200
commitc3dd456d513a989315d4e8a00ad8a1223bb8f9c4 (patch)
tree25e349c1885d70d9338841faaa16f31976e09994 /src/video_core/renderer_opengl/renderer_opengl.cpp
parentMerge pull request #675 from Subv/stencil (diff)
downloadyuzu-c3dd456d513a989315d4e8a00ad8a1223bb8f9c4.tar
yuzu-c3dd456d513a989315d4e8a00ad8a1223bb8f9c4.tar.gz
yuzu-c3dd456d513a989315d4e8a00ad8a1223bb8f9c4.tar.bz2
yuzu-c3dd456d513a989315d4e8a00ad8a1223bb8f9c4.tar.lz
yuzu-c3dd456d513a989315d4e8a00ad8a1223bb8f9c4.tar.xz
yuzu-c3dd456d513a989315d4e8a00ad8a1223bb8f9c4.tar.zst
yuzu-c3dd456d513a989315d4e8a00ad8a1223bb8f9c4.zip
Diffstat (limited to 'src/video_core/renderer_opengl/renderer_opengl.cpp')
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp22
1 files changed, 18 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
// Framebuffer orientation handling
framebuffer_transform_flags = framebuffer.transform_flags;
+ framebuffer_crop_rect = framebuffer.crop_rect;
// Ensure no bad interactions with GL_UNPACK_ALIGNMENT, which by default
// only allows rows to have a memory alignement of 4.
@@ -320,11 +321,24 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
}
}
+ ASSERT_MSG(framebuffer_crop_rect.top == 0, "Unimplemented");
+ ASSERT_MSG(framebuffer_crop_rect.left == 0, "Unimplemented");
+
+ // Scale the output by the crop width/height. This is commonly used with 1280x720 rendering
+ // (e.g. handheld mode) on a 1920x1080 framebuffer.
+ f32 scale_u = 1.f, scale_v = 1.f;
+ if (framebuffer_crop_rect.GetWidth() > 0) {
+ scale_u = static_cast<f32>(framebuffer_crop_rect.GetWidth()) / screen_info.texture.width;
+ }
+ if (framebuffer_crop_rect.GetHeight() > 0) {
+ scale_v = static_cast<f32>(framebuffer_crop_rect.GetHeight()) / screen_info.texture.height;
+ }
+
std::array<ScreenRectVertex, 4> vertices = {{
- ScreenRectVertex(x, y, texcoords.top, left),
- ScreenRectVertex(x + w, y, texcoords.bottom, left),
- ScreenRectVertex(x, y + h, texcoords.top, right),
- ScreenRectVertex(x + w, y + h, texcoords.bottom, right),
+ ScreenRectVertex(x, y, texcoords.top * scale_u, left * scale_v),
+ ScreenRectVertex(x + w, y, texcoords.bottom * scale_u, left * scale_v),
+ ScreenRectVertex(x, y + h, texcoords.top * scale_u, right * scale_v),
+ ScreenRectVertex(x + w, y + h, texcoords.bottom * scale_u, right * scale_v),
}};
state.texture_units[0].texture_2d = screen_info.display_texture;