From bd294f658f7abc95d946d096e64f355ff6dc67fd Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 4 Nov 2018 09:31:30 -0800 Subject: [PATCH] TexCache: Round DXT5 alpha up. This isn't quite right, but it seems better than rounding down. Experimented with a lower round up value, but none were right - the weighting must be more complex. --- GPU/Common/TextureDecoder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GPU/Common/TextureDecoder.cpp b/GPU/Common/TextureDecoder.cpp index d729ab976e..9e896872fe 100644 --- a/GPU/Common/TextureDecoder.cpp +++ b/GPU/Common/TextureDecoder.cpp @@ -385,13 +385,13 @@ static inline u8 lerp8(const DXT5Block *src, int n) { // These weights translate alpha1/alpha2 to fixed 8.8 point, pre-divided by 7. int weight1 = ((7 - n) << 8) / 7; int weight2 = (n << 8) / 7; - return (u8)((src->alpha1 * weight1 + src->alpha2 * weight2) >> 8); + return (u8)((src->alpha1 * weight1 + src->alpha2 * weight2 + 255) >> 8); } static inline u8 lerp6(const DXT5Block *src, int n) { int weight1 = ((5 - n) << 8) / 5; int weight2 = (n << 8) / 5; - return (u8)((src->alpha1 * weight1 + src->alpha2 * weight2) >> 8); + return (u8)((src->alpha1 * weight1 + src->alpha2 * weight2 + 255) >> 8); } void DXTDecoder::DecodeAlphaDXT5(const DXT5Block *src) {