From 536c4ace732adea871fe0cc5fcbd2d904578f2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 14 Jun 2026 01:09:33 +0200 Subject: [PATCH] Fix the ugly line on Ridge Racer lens flares Turns out we were not updating one column and row of the lens flare image, which is done in a strange way by the game (CLUT in framebuffer). Some math of the game is a little off and for some reason it's not noticeable on hardware. --- GPU/Common/TextureCacheCommon.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index eca87f0efd..ef14e6d905 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -2498,6 +2498,7 @@ void TextureCacheCommon::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer } // Applies depal to a normal (non-framebuffer) texture, pre-decoded to CLUT8 format. +// TODO: Merge this function with the above. void TextureCacheCommon::ApplyTextureDepalFramebufferCLUT(TexCacheEntry *entry) { uint32_t clutMode = gstate.clutformat & 0xFFFFFF; @@ -2546,6 +2547,14 @@ void TextureCacheCommon::ApplyTextureDepalFramebufferCLUT(TexCacheEntry *entry) gstate_c.Dirty(DIRTY_TEXTURE_PARAMS); } + // If it nearly covers, just make it cover. This fixes Ridge Racer where the UVs are slightly off and it causes a bright line on the lens flare. + if (u1 > 0 && u1 < 3) { + u1 = 0; + } + if (v1 > 0 && v1 < 3) { + v1 = 0; + } + Draw::Framebuffer *depalFBO = framebufferManager_->GetTempFBO(TempFBO::DEPAL, texWidth, texHeight); draw_->BindTexture(0, nullptr); draw_->BindTexture(1, nullptr);