rsx/fp: Handle signed operator precedence

This was marked TODO for a long time
- Unsigned remap seems to be overriden by gamma mask (Resistance 3)
- We already know sign mask overrides gamma mask from UE3 titles
This commit is contained in:
kd-11 2021-08-29 17:45:51 +03:00 committed by kd-11
parent 6781373727
commit a5e455d8ed

View File

@ -1987,11 +1987,16 @@ namespace rsx
}
// Special operations applied to 8-bit formats such as gamma correction and sign conversion
// NOTE: The unsigned_remap being set to anything other than 0 flags the texture as being signed
// NOTE: The unsigned_remap being set to anything other than 0 flags the texture as being signed (UE3)
// This is a separate method of setting the format to signed mode without doing so per-channel
// NOTE2: Modifier precedence is not respected here. This is another TODO (kd-11)
u32 argb8_convert = tex.gamma();
if (const u32 sign_convert = tex.unsigned_remap() ? 0xF : tex.argb_signed())
// Precedence = SIGNED override > GAMMA > UNSIGNED_REMAP (See Resistance 3 for GAMMA/REMAP relationship, UE3 for REMAP effect)
const u32 argb8_signed = tex.argb_signed();
const u32 gamma = tex.gamma() & ~argb8_signed;
const u32 unsigned_remap = (tex.unsigned_remap() == CELL_GCM_TEXTURE_UNSIGNED_REMAP_NORMAL)? 0u : (~gamma & 0xF);
u32 argb8_convert = gamma;
if (const u32 sign_convert = (argb8_signed | unsigned_remap))
{
// Apply remap to avoid mapping 1 to -1. Only the sign conversion needs this check
// TODO: Use actual remap mask to account for 0 and 1 overrides in default mapping