GS: Remove additional copy in FXAA/ShadeBoost

This commit is contained in:
Connor McLaughlin 2022-12-12 13:12:18 +10:00 committed by refractionpcsx2
parent a1fb735fde
commit 6ccb55d6f7
1 changed files with 11 additions and 23 deletions

View File

@ -387,38 +387,25 @@ void GSDevice::Interlace(const GSVector2i& ds, int field, int mode, float yoffse
default:
m_current = m_merge;
}
if ((GSConfig.FXAA || GSConfig.ShadeBoost) && m_current != m_merge)
{
const GSVector2i s = m_current->GetSize();
ResizeTexture(&m_merge, GSTexture::Type::RenderTarget, s.x, s.y, false);
StretchRect(m_current, GSVector4(0, 0, 1, 1), m_merge, GSVector4(0, 0, ds.x, ds.y), ShaderConvert::COPY, false);
m_current = m_merge;
}
}
void GSDevice::FXAA()
{
const GSVector2i s = m_current->GetSize();
if (ResizeTexture(&m_target_tmp, GSTexture::Type::RenderTarget, s.x, s.y, false))
// Combining FXAA+ShadeBoost can't share the same target.
GSTexture*& dTex = (m_current == m_target_tmp) ? m_merge : m_target_tmp;
if (ResizeTexture(&dTex, GSTexture::Type::RenderTarget, m_current->GetWidth(), m_current->GetHeight(), false, true))
{
const GSVector4 sRect(0, 0, 1, 1);
const GSVector4 dRect(0, 0, s.x, s.y);
StretchRect(m_current, sRect, m_target_tmp, dRect, ShaderConvert::TRANSPARENCY_FILTER, false);
DoFXAA(m_target_tmp, m_current);
InvalidateRenderTarget(dTex);
DoFXAA(m_current, dTex);
m_current = dTex;
}
}
void GSDevice::ShadeBoost()
{
const GSVector2i s = m_current->GetSize();
if (ResizeTexture(&m_target_tmp, GSTexture::Type::RenderTarget, s.x, s.y, false))
if (ResizeTexture(&m_target_tmp, GSTexture::Type::RenderTarget, m_current->GetWidth(), m_current->GetHeight(), false, true))
{
const GSVector4 sRect(0, 0, 1, 1);
const GSVector4 dRect(0, 0, s.x, s.y);
InvalidateRenderTarget(m_target_tmp);
// predivide to avoid the divide (multiply) in the shader
const float params[4] = {
@ -427,8 +414,9 @@ void GSDevice::ShadeBoost()
static_cast<float>(GSConfig.ShadeBoost_Saturation) * (1.0f / 50.0f),
};
StretchRect(m_current, sRect, m_target_tmp, dRect, ShaderConvert::COPY, false);
DoShadeBoost(m_target_tmp, m_current, params);
DoShadeBoost(m_current, m_target_tmp, params);
m_current = m_target_tmp;
}
}