From 7c2488c942b1d52529e932b5d926babd21c7c3cc Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 19 Jan 2025 21:40:38 +1000 Subject: [PATCH] PostProcessing/GLSL: Fix image moved off-screen with alignment --- src/util/postprocessing_shader_glsl.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/util/postprocessing_shader_glsl.cpp b/src/util/postprocessing_shader_glsl.cpp index c3639252d..070f07bea 100644 --- a/src/util/postprocessing_shader_glsl.cpp +++ b/src/util/postprocessing_shader_glsl.cpp @@ -190,12 +190,17 @@ GPUDevice::PresentResult PostProcessing::GLSLShader::Apply(GPUTexture* input_col g_gpu_device->SetPipeline(m_pipeline.get()); g_gpu_device->SetTextureSampler(0, input_color, m_sampler.get()); - g_gpu_device->SetViewportAndScissor(final_rect); + + // need to flip the rect, since we're not drawing the entire fb + const GSVector4i real_final_rect = + g_gpu_device->UsesLowerLeftOrigin() ? g_gpu_device->FlipToLowerLeft(final_rect, target_height) : final_rect; + g_gpu_device->SetViewportAndScissor(real_final_rect); const u32 uniforms_size = GetUniformsSize(); void* uniforms = g_gpu_device->MapUniformBuffer(uniforms_size); - FillUniformBuffer(uniforms, final_rect.left, final_rect.top, final_rect.width(), final_rect.height(), target_width, - target_height, orig_width, orig_height, native_width, native_height, time); + FillUniformBuffer(uniforms, real_final_rect.left, real_final_rect.top, real_final_rect.width(), + real_final_rect.height(), target_width, target_height, orig_width, orig_height, native_width, + native_height, time); g_gpu_device->UnmapUniformBuffer(uniforms_size); g_gpu_device->Draw(3, 0); return GPUDevice::PresentResult::OK;