From 9422b05ee3a0108eabfa7aa643b0113d2d53ac2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 9 Oct 2022 18:57:48 +0200 Subject: [PATCH] Fix depal bounds with dynamic CLUT. Fixes lens flare glitches in Ridge Racer With this wrong, we ended up drawing pixels that came from a DONT_CARE init of the depal temp buffer, which was a pile of garbage on Android and blank on PC. Now, we seem to end up not drawing anything because the depal operation results in transparent black into whatever is actually intended, but at least the screen isn't full of glitches when the sun is visible on Adreno. See issue #16083 --- GPU/Common/TextureCacheCommon.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index cf012d4010..f96d922a85 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -2242,10 +2242,11 @@ void TextureCacheCommon::ApplyTextureDepal(TexCacheEntry *entry) { float u2 = texWidth; float v2 = texHeight; if (bounds.minV < bounds.maxV) { - u1 = (bounds.minU + gstate_c.curTextureXOffset) * texWidth; - v1 = (bounds.minV + gstate_c.curTextureYOffset) * texHeight; - u2 = (bounds.maxU + gstate_c.curTextureXOffset) * texWidth; - v2 = (bounds.maxV + gstate_c.curTextureYOffset) * texHeight; + // These are already in pixel coords! Doesn't seem like we should multiply by texwidth/height. + u1 = bounds.minU + gstate_c.curTextureXOffset; + v1 = bounds.minV + gstate_c.curTextureYOffset; + u2 = bounds.maxU + gstate_c.curTextureXOffset; + v2 = bounds.maxV + gstate_c.curTextureYOffset; // We need to reapply the texture next time since we cropped UV. gstate_c.Dirty(DIRTY_TEXTURE_PARAMS); }