Skip to content

Commit

Permalink
PostProcessing/GLSL: Fix image moved off-screen with alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Jan 19, 2025
1 parent c03b6f3 commit 7c2488c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/util/postprocessing_shader_glsl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7c2488c

Please sign in to comment.