From 8eaa1f312dd1e260e6553e473b8910ff1c348c88 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 22 Jan 2025 18:23:13 +1000 Subject: [PATCH] GPU: Fix overlay destination alpha with postfx Also don't assume the image has premultiplied alpha. --- src/core/gpu_presenter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/gpu_presenter.cpp b/src/core/gpu_presenter.cpp index 21dd020448..ce4fb99713 100644 --- a/src/core/gpu_presenter.cpp +++ b/src/core/gpu_presenter.cpp @@ -188,7 +188,8 @@ bool GPUPresenter::CompileDisplayPipelines(bool display, bool deinterlace, bool plconfig.blend.enable = true; plconfig.blend.src_blend = GPUPipeline::BlendFunc::InvDstAlpha; plconfig.blend.blend_op = GPUPipeline::BlendOp::Add; - plconfig.blend.dst_blend = GPUPipeline::BlendFunc::One; + plconfig.blend.dst_blend = + m_border_overlay_alpha_blend ? GPUPipeline::BlendFunc::One : GPUPipeline::BlendFunc::DstAlpha; plconfig.blend.src_alpha_blend = GPUPipeline::BlendFunc::One; plconfig.blend.alpha_blend_op = GPUPipeline::BlendOp::Add; plconfig.blend.dst_alpha_blend = GPUPipeline::BlendFunc::Zero; @@ -510,7 +511,7 @@ GPUDevice::PresentResult GPUPresenter::RenderDisplay(GPUTexture* target, const G DrawScreenQuad(overlay_rect, GSVector4::cxpr(0.0f, 0.0f, 1.0f, 1.0f), target_size, final_target_size, DisplayRotation::Normal, prerotation); - g_gpu_device->SetPipeline(m_border_overlay_pipeline.get()); + g_gpu_device->SetPipeline(m_present_copy_blend_pipeline.get()); g_gpu_device->SetTextureSampler(0, postfx_output, g_gpu_device->GetNearestSampler()); DrawScreenQuad(overlay_display_rect, src_uv_rect, target_size, final_target_size, DisplayRotation::Normal, prerotation);