mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-28 07:18:33 +00:00
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.
This commit is contained in:
parent
59be5da24c
commit
f74dbc794c
10 changed files with 38 additions and 35 deletions
|
@ -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<u32>(coefficients[0]) + static_cast<u32>(coefficients[1]),
|
||||
static_cast<u32>(coefficients[2]) + static_cast<u32>(coefficients[3]) +
|
||||
static_cast<u32>(coefficients[4]),
|
||||
static_cast<u32>(coefficients[5]) + static_cast<u32>(coefficients[6])};
|
||||
return {
|
||||
static_cast<float>(static_cast<u32>(coefficients[0]) + static_cast<u32>(coefficients[1])) /
|
||||
64.0f,
|
||||
static_cast<float>(static_cast<u32>(coefficients[2]) + static_cast<u32>(coefficients[3]) +
|
||||
static_cast<u32>(coefficients[4])) /
|
||||
64.0f,
|
||||
static_cast<float>(static_cast<u32>(coefficients[5]) + static_cast<u32>(coefficients[6])) /
|
||||
64.0f};
|
||||
}
|
||||
|
||||
TextureCacheBase::CopyFilterCoefficientArray TextureCacheBase::GetVRAMCopyFilterCoefficients(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue