mirror of https://github.com/PCSX2/pcsx2.git
GS/HW: Guess alpha values when using 16bit RT as TEX = RT
This commit is contained in:
parent
dc8c5e6209
commit
f81c5c2455
|
@ -3649,6 +3649,16 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
src->m_alpha_minmax.first = dst->m_alpha_min;
|
||||
src->m_alpha_minmax.second = dst->m_alpha_max;
|
||||
|
||||
// This is a bit rough, since if AEM is on, without rescanning the whole texture, we don't know if anything is transparent, so just go the hard way.
|
||||
if (!dst->m_32_bits_fmt)
|
||||
{
|
||||
const bool using_both = (src->m_alpha_minmax.first ^ src->m_alpha_minmax.second) & 128;
|
||||
const bool using_ta1 = (src->m_alpha_minmax.second & 128);
|
||||
|
||||
src->m_alpha_minmax.first = TEXA.AEM ? 0 : (using_both ? std::min(TEXA.TA1, TEXA.TA0) : (using_ta1 ? TEXA.TA1 : TEXA.TA0));
|
||||
src->m_alpha_minmax.second = (using_both ? std::max(TEXA.TA1, TEXA.TA0) : (using_ta1 ? TEXA.TA1 : TEXA.TA0));
|
||||
}
|
||||
|
||||
if (psm.pal > 0)
|
||||
{
|
||||
// Attach palette for GPU texture conversion
|
||||
|
@ -3691,6 +3701,16 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
src->m_alpha_minmax.first = dst->m_alpha_min;
|
||||
src->m_alpha_minmax.second = dst->m_alpha_max;
|
||||
|
||||
// This is a bit rough, since if AEM is on, without rescanning the whole texture, we don't know if anything is transparent, so just go the hard way.
|
||||
if (!dst->m_32_bits_fmt)
|
||||
{
|
||||
const bool using_both = (src->m_alpha_minmax.first ^ src->m_alpha_minmax.second) & 128;
|
||||
const bool using_ta1 = (src->m_alpha_minmax.second & 128);
|
||||
|
||||
src->m_alpha_minmax.first = TEXA.AEM ? 0 : (using_both ? std::min(TEXA.TA1, TEXA.TA0) : (using_ta1 ? TEXA.TA1 : TEXA.TA0));
|
||||
src->m_alpha_minmax.second = (using_both ? std::max(TEXA.TA1, TEXA.TA0) : (using_ta1 ? TEXA.TA1 : TEXA.TA0));
|
||||
}
|
||||
|
||||
dst->Update();
|
||||
|
||||
// Rounding up should never exceed the texture size (since it itself should be rounded up), but just in case.
|
||||
|
|
Loading…
Reference in New Issue