From 352a3405e80b87ffe3ad9b0e583d02968c6a1f94 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 16 Sep 2020 01:12:49 +1000 Subject: [PATCH] OpenGLHostDisplay: Fix offset image in libretro --- src/frontend-common/opengl_host_display.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/frontend-common/opengl_host_display.cpp b/src/frontend-common/opengl_host_display.cpp index 08be4000a..137875ab7 100644 --- a/src/frontend-common/opengl_host_display.cpp +++ b/src/frontend-common/opengl_host_display.cpp @@ -486,9 +486,9 @@ void OpenGLHostDisplay::RenderDisplay() #ifndef LIBRETRO if (!m_post_processing_chain.IsEmpty()) { - ApplyPostProcessingChain(0, left, top, width, height, m_display_texture_handle, m_display_texture_width, - m_display_texture_height, m_display_texture_view_x, m_display_texture_view_y, - m_display_texture_view_width, m_display_texture_view_height); + ApplyPostProcessingChain(0, left, GetWindowHeight() - top - height, width, height, m_display_texture_handle, + m_display_texture_width, m_display_texture_height, m_display_texture_view_x, + m_display_texture_view_y, m_display_texture_view_width, m_display_texture_view_height); return; } #endif @@ -502,7 +502,7 @@ void OpenGLHostDisplay::RenderDisplay(s32 left, s32 bottom, s32 width, s32 heigh u32 texture_width, s32 texture_height, s32 texture_view_x, s32 texture_view_y, s32 texture_view_width, s32 texture_view_height, bool linear_filter) { - glViewport(left, GetWindowHeight() - bottom - height, width, height); + glViewport(left, bottom, width, height); glDisable(GL_BLEND); glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); @@ -659,16 +659,18 @@ void OpenGLHostDisplay::ApplyPostProcessingChain(GLuint final_target, s32 final_ if (!CheckPostProcessingRenderTargets(GetWindowWidth(), GetWindowHeight())) { - RenderDisplay(final_left, final_top, final_width, final_height, texture_handle, texture_width, texture_height, - texture_view_x, texture_view_y, texture_view_width, texture_view_height, m_display_linear_filtering); + RenderDisplay(final_left, GetWindowHeight() - final_top - final_height, final_width, final_height, texture_handle, + texture_width, texture_height, texture_view_x, texture_view_y, texture_view_width, + texture_view_height, m_display_linear_filtering); return; } // downsample/upsample - use same viewport for remainder m_post_processing_input_texture.BindFramebuffer(GL_DRAW_FRAMEBUFFER); glClear(GL_COLOR_BUFFER_BIT); - RenderDisplay(final_left, final_top, final_width, final_height, texture_handle, texture_width, texture_height, - texture_view_x, texture_view_y, texture_view_width, texture_view_height, m_display_linear_filtering); + RenderDisplay(final_left, GetWindowHeight() - final_top - final_height, final_width, final_height, texture_handle, + texture_width, texture_height, texture_view_x, texture_view_y, texture_view_width, texture_view_height, + m_display_linear_filtering); texture_handle = reinterpret_cast(static_cast(m_post_processing_input_texture.GetGLId())); texture_width = m_post_processing_input_texture.GetWidth();