summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-02-11 19:04:27 -0500
committerGravatar bunnei2018-02-11 21:03:55 -0500
commitdeadcb39c2914d77734907daf7ce304872265798 (patch)
treed5e62426c3a2ed38dcc6929a1e7066f0d0dd9933 /src
parentvi: Parse IGBPQueueBufferRequestParcel params and expose buffer flip vertical. (diff)
downloadyuzu-deadcb39c2914d77734907daf7ce304872265798.tar.gz
yuzu-deadcb39c2914d77734907daf7ce304872265798.tar.xz
yuzu-deadcb39c2914d77734907daf7ce304872265798.zip
renderer_opengl: Support framebuffer flip vertical.
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:
43 u32 height; 43 u32 height;
44 u32 stride; 44 u32 stride;
45 PixelFormat pixel_format; 45 PixelFormat pixel_format;
46 bool flip_vertical;
46 }; 47 };
47 48
48 virtual ~RendererBase() {} 49 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,
262 // only allows rows to have a memory alignement of 4. 262 // only allows rows to have a memory alignement of 4.
263 ASSERT(framebuffer_info.stride % 4 == 0); 263 ASSERT(framebuffer_info.stride % 4 == 0);
264 264
265 framebuffer_flip_vertical = framebuffer_info.flip_vertical;
266
265 // Reset the screen info's display texture to its own permanent texture 267 // Reset the screen info's display texture to its own permanent texture
266 screen_info.display_texture = screen_info.texture.resource.handle; 268 screen_info.display_texture = screen_info.texture.resource.handle;
267 screen_info.display_texcoords = MathUtil::Rectangle<float>(0.f, 0.f, 1.f, 1.f); 269 screen_info.display_texcoords = MathUtil::Rectangle<float>(0.f, 0.f, 1.f, 1.f);
@@ -401,13 +403,15 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
401 403
402void RendererOpenGL::DrawSingleScreen(const ScreenInfo& screen_info, float x, float y, float w, 404void RendererOpenGL::DrawSingleScreen(const ScreenInfo& screen_info, float x, float y, float w,
403 float h) { 405 float h) {
404 auto& texcoords = screen_info.display_texcoords; 406 const auto& texcoords = screen_info.display_texcoords;
407 const auto& left = framebuffer_flip_vertical ? texcoords.right : texcoords.left;
408 const auto& right = framebuffer_flip_vertical ? texcoords.left : texcoords.right;
405 409
406 std::array<ScreenRectVertex, 4> vertices = {{ 410 std::array<ScreenRectVertex, 4> vertices = {{
407 ScreenRectVertex(x, y, texcoords.top, texcoords.right), 411 ScreenRectVertex(x, y, texcoords.top, right),
408 ScreenRectVertex(x + w, y, texcoords.bottom, texcoords.right), 412 ScreenRectVertex(x + w, y, texcoords.bottom, right),
409 ScreenRectVertex(x, y + h, texcoords.top, texcoords.left), 413 ScreenRectVertex(x, y + h, texcoords.top, left),
410 ScreenRectVertex(x + w, y + h, texcoords.bottom, texcoords.left), 414 ScreenRectVertex(x + w, y + h, texcoords.bottom, left),
411 }}; 415 }};
412 416
413 state.texture_units[0].texture_2d = screen_info.display_texture; 417 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:
86 // Shader attribute input indices 86 // Shader attribute input indices
87 GLuint attrib_position; 87 GLuint attrib_position;
88 GLuint attrib_tex_coord; 88 GLuint attrib_tex_coord;
89
90 /// Flips the framebuffer vertically when true
91 bool framebuffer_flip_vertical;
89}; 92};