From f74dbc794c124e6f1c5d5f60ff1d6fe65acc379f Mon Sep 17 00:00:00 2001 From: Stenzek Date: Tue, 22 May 2018 12:14:48 +1000 Subject: EFB2RAM: Apply copy filter as a float coefficient after sampling Using 8-bit integer math here lead to precision loss for depth copies, which broke various effects in games, e.g. lens flare in MK:DD. It's unlikely the console implements this as a floating-point multiply (fixed-point perhaps), but since we have the float round trip in our EFB2RAM shaders anyway, it's not going to make things any worse. If we do rewrite our shaders to use integer math completely, then it might be worth switching this conversion back to integers. However, the range of the values (format) should be known, or we should expand all values out to 24-bits first. --- Source/Core/VideoCommon/TextureCacheBase.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 48518911bd..c1e112e69a 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -1506,10 +1506,14 @@ TextureCacheBase::CopyFilterCoefficientArray TextureCacheBase::GetRAMCopyFilterC { // To simplify the backend, we precalculate the three coefficients in common. Coefficients 0, 1 // are for the row above, 2, 3, 4 are for the current pixel, and 5, 6 are for the row below. - return {static_cast(coefficients[0]) + static_cast(coefficients[1]), - static_cast(coefficients[2]) + static_cast(coefficients[3]) + - static_cast(coefficients[4]), - static_cast(coefficients[5]) + static_cast(coefficients[6])}; + return { + static_cast(static_cast(coefficients[0]) + static_cast(coefficients[1])) / + 64.0f, + static_cast(static_cast(coefficients[2]) + static_cast(coefficients[3]) + + static_cast(coefficients[4])) / + 64.0f, + static_cast(static_cast(coefficients[5]) + static_cast(coefficients[6])) / + 64.0f}; } TextureCacheBase::CopyFilterCoefficientArray TextureCacheBase::GetVRAMCopyFilterCoefficients( -- cgit v1.2.3