summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-02-12 01:04:27 +0100
committerbunnei <bunneidev@gmail.com>2018-02-12 03:03:55 +0100
commitdeadcb39c2914d77734907daf7ce304872265798 (patch)
treed5e62426c3a2ed38dcc6929a1e7066f0d0dd9933 /src
parentvi: Parse IGBPQueueBufferRequestParcel params and expose buffer flip vertical. (diff)
downloadyuzu-deadcb39c2914d77734907daf7ce304872265798.tar
yuzu-deadcb39c2914d77734907daf7ce304872265798.tar.gz
yuzu-deadcb39c2914d77734907daf7ce304872265798.tar.bz2
yuzu-deadcb39c2914d77734907daf7ce304872265798.tar.lz
yuzu-deadcb39c2914d77734907daf7ce304872265798.tar.xz
yuzu-deadcb39c2914d77734907daf7ce304872265798.tar.zst
yuzu-deadcb39c2914d77734907daf7ce304872265798.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_base.h1
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp14
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.h3
3 files changed, 13 insertions, 5 deletions
diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h
index 28893b181..2aba50eda 100644
--- a/src/video_core/renderer_base.h
+++ b/src/video_core/renderer_base.h
@@ -43,6 +43,7 @@ public:
u32 height;
u32 stride;
PixelFormat pixel_format;
+ bool flip_vertical;
};
virtual ~RendererBase() {}
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 8c23128ae..7f921fa32 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -262,6 +262,8 @@ void RendererOpenGL::LoadFBToScreenInfo(const FramebufferInfo& framebuffer_info,
// only allows rows to have a memory alignement of 4.
ASSERT(framebuffer_info.stride % 4 == 0);
+ framebuffer_flip_vertical = framebuffer_info.flip_vertical;
+
// Reset the screen info's display texture to its own permanent texture
screen_info.display_texture = screen_info.texture.resource.handle;
screen_info.display_texcoords = MathUtil::Rectangle<float>(0.f, 0.f, 1.f, 1.f);
@@ -401,13 +403,15 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
void RendererOpenGL::DrawSingleScreen(const ScreenInfo& screen_info, float x, float y, float w,
float h) {
- auto& texcoords = screen_info.display_texcoords;
+ const auto& texcoords = screen_info.display_texcoords;
+ const auto& left = framebuffer_flip_vertical ? texcoords.right : texcoords.left;
+ const auto& right = framebuffer_flip_vertical ? texcoords.left : texcoords.right;
std::array<ScreenRectVertex, 4> vertices = {{
- ScreenRectVertex(x, y, texcoords.top, texcoords.right),
- ScreenRectVertex(x + w, y, texcoords.bottom, texcoords.right),
- ScreenRectVertex(x, y + h, texcoords.top, texcoords.left),
- ScreenRectVertex(x + w, y + h, texcoords.bottom, texcoords.left),
+ ScreenRectVertex(x, y, texcoords.top, right),
+ ScreenRectVertex(x + w, y, texcoords.bottom, right),
+ ScreenRectVertex(x, y + h, texcoords.top, left),
+ ScreenRectVertex(x + w, y + h, texcoords.bottom, left),
}};
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 db6c355a5..05bb3c5cf 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.h
+++ b/src/video_core/renderer_opengl/renderer_opengl.h
@@ -86,4 +86,7 @@ private:
// Shader attribute input indices
GLuint attrib_position;
GLuint attrib_tex_coord;
+
+ /// Flips the framebuffer vertically when true
+ bool framebuffer_flip_vertical;
};